Fix WithSpanHandler: remove hardcode, add constants instead - #1927
Fix WithSpanHandler: remove hardcode, add constants instead#1927mdomansky wants to merge 7 commits into
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.97% -0.33%
- Complexity 3009 3084 +75
============================================
Files 449 459 +10
Lines 8798 9031 +233
============================================
+ Hits 6009 6139 +130
- Misses 2789 2892 +103
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 42 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 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;There was a problem hiding this comment.
Updated to the ->setAttribute('code.function.name', $name) due to $name setting above correct way I believe.
There was a problem hiding this comment.
We cannot use $name for code.function.name, it might be overridden via $span_args.
Using the snippet above:
$name -> span name provided to ->spanBuilder()
$functionName -> code.function.name attribute
|
It looks like all reviewers are happy with this change, but we're blocked on |
|
@mdomansky sorry this has been waiting so long. I've just kicked off the checks and they're failing, I think a rebase will probably fix it given the age of this PR. |
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.