Skip to content

Commit

Permalink
Delete deprecated ptrace.TraceState and getter/setter (#6085)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan <[email protected]>

Signed-off-by: Bogdan <[email protected]>
  • Loading branch information
bogdandrutu authored Sep 21, 2022
1 parent c9d2040 commit a9f666f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 41 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### 🛑 Breaking changes 🛑

- Change `ptrace.Span[Link]?.TraceState` signature to match `ptrace.Span[Link]?.TraceStateStruct` (#6085)
- Delete deprecated `pmetric.NewMetricDataPointFlagsImmutable` func. (#6097)
- Delete deprecated `pmetric.*DataPoint.[Set]FlagsImmutable()` funcs. (#6097)
- Delete deprecated `config.Unmarshalable` interface. (#6084)
Expand All @@ -23,7 +24,8 @@
### 🚩 Deprecations 🚩

- Deprecate `go.opentelemetry.io/collector/service/featuregate` in favor of `go.opentelemetry.io/collector/featuregate`. (#6094)
- Deprecate pmetric.OptionalType, unused enum type. (#6096)
- Deprecate `pmetric.OptionalType`, unused enum type. (#6096)
- Deprecate `ptrace.Span[Link]?.TraceStateStruct` in favor of `ptrace.Span[Link]?.TraceState` (#6085)
- Deprecate `pcommon.NewValueBytesEmpty` in favor of `pcommon.NewValueBytes` that now has the same signature. (#6105)

### 💡 Enhancements 💡
Expand Down
2 changes: 1 addition & 1 deletion exporter/loggingexporter/internal/otlptext/databuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (b *dataBuffer) logLinks(description string, sl ptrace.SpanLinkSlice) {
b.logEntry("SpanLink #%d", i)
b.logEntry(" -> Trace ID: %s", l.TraceID().HexString())
b.logEntry(" -> ID: %s", l.SpanID().HexString())
b.logEntry(" -> TraceState: %s", l.TraceStateStruct().AsRaw())
b.logEntry(" -> TraceState: %s", l.TraceState().AsRaw())
b.logEntry(" -> DroppedAttributesCount: %d", l.DroppedAttributesCount())
if l.Attributes().Len() == 0 {
continue
Expand Down
2 changes: 1 addition & 1 deletion pdata/internal/cmd/pdatagen/internal/trace_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var spanStatus = &messageValueStruct{
}

var traceStateField = &messageValueField{
fieldName: "TraceStateStruct",
fieldName: "TraceState",
originFieldName: "TraceState",
returnMessage: traceState,
}
Expand Down
12 changes: 6 additions & 6 deletions pdata/ptrace/generated_traces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pdata/ptrace/generated_traces_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pdata/ptrace/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var tracesOTLPFull = func() Traces {
sp.SetDroppedLinksCount(1)
sp.SetEndTimestamp(pcommon.NewTimestampFromTime(time.Now()))
sp.SetParentSpanID(spanID)
sp.TraceStateStruct().FromRaw("state")
sp.TraceState().FromRaw("state")
sp.Status().SetCode(StatusCodeOk)
sp.Status().SetMessage("message")
// Add attributes.
Expand All @@ -111,7 +111,7 @@ var tracesOTLPFull = func() Traces {
event.Attributes().PutEmptyBytes("bytes").FromRaw([]byte("foo"))
// Add links.
link := sp.Links().AppendEmpty()
link.TraceStateStruct().FromRaw("state")
link.TraceState().FromRaw("state")
link.SetTraceID(traceID)
link.SetSpanID(spanID)
link.SetDroppedAttributesCount(1)
Expand Down
31 changes: 7 additions & 24 deletions pdata/ptrace/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.opentelemetry.io/collector/pdata/internal"
otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
otlptrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/trace/v1"
"go.opentelemetry.io/collector/pdata/pcommon"
)

// Traces is the top-level struct that is propagated through the traces pipeline.
Expand Down Expand Up @@ -70,32 +71,14 @@ func (ms Traces) ResourceSpans() ResourceSpansSlice {
return newResourceSpansSlice(&ms.getOrig().ResourceSpans)
}

// Deprecated: [v0.60.0] use pcommon.TraceState.
type TraceState string

const (
// Deprecated: [v0.60.0] use pcommon.TraceState.AsRaw() and compare with empty string.
TraceStateEmpty TraceState = ""
)

// Deprecated: [v0.60.0] use TraceStateStruct().AsRaw().
func (ms Span) TraceState() TraceState {
return TraceState(ms.getOrig().TraceState)
}

// Deprecated: [v0.60.0] use TraceStateStruct().FromRaw(val).
func (ms Span) SetTraceState(v TraceState) {
ms.getOrig().TraceState = string(v)
}

// Deprecated: [v0.60.0] use TraceStateStruct().AsRaw().
func (ms SpanLink) TraceState() TraceState {
return TraceState(ms.getOrig().TraceState)
// Deprecated: [v0.61.0] use TraceState().AsRaw().
func (ms Span) TraceStateStruct() pcommon.TraceState {
return ms.TraceState()
}

// Deprecated: [v0.60.0] use TraceStateStruct().FromRaw(val).
func (ms SpanLink) SetTraceState(v TraceState) {
ms.getOrig().TraceState = string(v)
// Deprecated: [v0.61.0] use TraceState().AsRaw().
func (ms SpanLink) TraceStateStruct() pcommon.TraceState {
return ms.TraceState()
}

// SpanKind is the type of span. Can be used to specify additional relationships between spans
Expand Down

0 comments on commit a9f666f

Please sign in to comment.