Skip to content

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

Merged
bogdandrutu merged 1 commit into
open-telemetry:mainfrom
dmitryax:deprecate-hex-string
Nov 12, 2022
Merged

[pdata] Deprecate HexString func on SpanID and TraceID#6530
bogdandrutu merged 1 commit into
open-telemetry:mainfrom
dmitryax:deprecate-hex-string

Conversation

@dmitryax

@dmitryax dmitryax commented Nov 11, 2022

Copy link
Copy Markdown
Member

[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

codecov Bot commented Nov 11, 2022

Copy link
Copy Markdown

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