Fix WithSpanHandler: remove hardcode, add constants instead#1927
Fix WithSpanHandler: remove hardcode, add constants instead#1927mdomansky wants to merge 5 commits intoopen-telemetry:mainfrom
Conversation
ChrisLightfootWild
left a comment
There was a problem hiding this comment.
This is intentionally hardcoded to avoid the dependency on SemConv in the API package.
Why do I get the issue like |
I believe Might be worth asking the otel collector devs on this one. The schema file links to open-telemetry/semantic-conventions#1624 from the ...trimmed
1.30.0:
all:
changes:
...trimmed
- rename_attributes:
attribute_map:
code.function: code.function.name
code.filepath: code.file.path
code.lineno: code.line.number
code.column: code.column.numberMy understanding is that we are emitting valid telemetry for the schema version we have declared, and that the collector should rename the attributes during ingestion. |
|
@open-telemetry/collector-approvers, can you weigh in here? |
|
The error on this PR's description seems specific to the opensearch exporter, feel free to file an issue on the opentelemetry-collector-contrib bug tracker and the code owners will take a look |
|
Updated the schema version and updated span attribute names according to the scheme. Left hardcoded attribute names. |
Co-authored-by: Tobias Bachert <github.dev.k9ps1@mail.tobiasbachert.com>
| ->setAttribute('code.function.name', $class !== null ? $class . '::' . $function : $function) | ||
| ->setAttribute('code.file.path', $filename) | ||
| ->setAttribute('code.line.number', $lineno) | ||
| ->setAttribute('code.column.number', $lineno) |
There was a problem hiding this comment.
This doesn't look right. I don't think we should use the line number as column number.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1927 +/- ##
============================================
- Coverage 68.29% 67.26% -1.04%
- Complexity 3009 3022 +13
============================================
Files 449 450 +1
Lines 8798 9139 +341
============================================
+ Hits 6009 6147 +138
- Misses 2789 2992 +203
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 218 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
| ->setAttribute('code.namespace', $class) | ||
| ->setAttribute('code.filepath', $filename) | ||
| ->setAttribute('code.lineno', $lineno) | ||
| ->setAttribute('code.function.name', $class !== null ? $class . '::' . $function : $function) |
There was a problem hiding this comment.
Could unify this with the span $name logic above:
$functionName = $class !== null ? $class . '::' . $function : $function;
$name = $span_args['name'] ?? $functionName;
I have a list of containers:
1 - my php app
2 - otel-collector
3 - opensearch
While using
#[WithSpan]attribute on methods on myphpcontainer, all span information is successfully sent to theotel-collectorcontainer, but while the last sends the info to theopensearchdatabase I get an exception:My env:
Having researched, I found that "wrong" attribute names are hardcoded, so I updated them with constants.