Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pdata] Deprecate HexString func on SpanID and TraceID #6530

Merged
merged 1 commit into from
Nov 12, 2022

Conversation

dmitryax
Copy link
Member

@dmitryax dmitryax commented Nov 11, 2022

[SpanID|TraceID].HexString methods currently return an empty string for empty SpanID and TraceID instances. This behavior is not defined in the OTel spec and contradicts with w3c recommendations. We don't want to promote a behavior which possibly can be changed in future.

Additionally we introduce [SpanID|TraceID].String methods that have the same logic as HexString and implement fmt.Stringer interface to allow SpanID and TraceID instances to be used in log statements and avoid unnecessary allocation when log is not emitted. But the String method is not encouraged to be used as a replacement for HexString because of the concerns described above.

Updates #6514

@dmitryax dmitryax requested review from a team and mx-psi November 11, 2022 23:01
@codecov
Copy link

codecov bot commented Nov 11, 2022

Codecov Report

Base: 91.32% // Head: 91.33% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (82a1436) compared to base (65152ee).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6530   +/-   ##
=======================================
  Coverage   91.32%   91.33%           
=======================================
  Files         242      242           
  Lines       13878    13888   +10     
=======================================
+ Hits        12674    12684   +10     
  Misses        959      959           
  Partials      245      245           
Impacted Files Coverage Δ
...er/loggingexporter/internal/otlptext/databuffer.go 100.00% <100.00%> (ø)
exporter/loggingexporter/internal/otlptext/logs.go 100.00% <100.00%> (ø)
...porter/loggingexporter/internal/otlptext/traces.go 100.00% <100.00%> (ø)
pdata/pcommon/spanid.go 100.00% <100.00%> (ø)
pdata/pcommon/traceid.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

`[SpanID|TraceID].HexString` methods currently return an empty string for empty SpanID and TraceID instances. This behavior is not defined in the OTel spec and contradicts with w3c recommendations. We don't want to promote a behavior which possibly can be changed in future.

Additionally we introduce `[SpanID|TraceID].String` methods that have the same logic as `HexString` and implement `fmt.Stringer` interface to allow `SpanID` and `TraceID` instances to be used in log statements and avoid unnecessary allocation when log is not emitted. But the `String` method is not encouraged to be used as a replacement for `HexString` because of the concerns as described above.
@dmitryax dmitryax force-pushed the deprecate-hex-string branch from e5cbe08 to 82a1436 Compare November 11, 2022 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants