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

Convert status to not be a pointer in the Span #2242

Merged
merged 2 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/pdatagen/internal/trace_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var span = &messageValueStruct{
defaultVal: "uint32(0)",
testVal: "uint32(17)",
},
&messagePtrField{
&messageValueField{
fieldName: "Status",
originFieldName: "Status",
returnMessage: spanStatus,
Expand Down Expand Up @@ -178,7 +178,7 @@ var spanLink = &messageValueStruct{
},
}

var spanStatus = &messagePtrStruct{
var spanStatus = &messageValueStruct{
structName: "SpanStatus",
description: "// SpanStatus is an optional final status for this span. Semantically when Status wasn't set\n" +
"// it is means span ended without errors and assume Status.Ok (code = 0).",
Expand Down
35 changes: 7 additions & 28 deletions consumer/pdata/generated_trace.go

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

14 changes: 0 additions & 14 deletions consumer/pdata/generated_trace_test.go

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

4 changes: 1 addition & 3 deletions consumer/pdata/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ const (
func (sc StatusCode) String() string { return otlptrace.Status_StatusCode(sc).String() }

// SetCode replaces the code associated with this SpanStatus.
//
// Important: This causes a runtime error if IsNil() returns "true".
func (ms SpanStatus) SetCode(v StatusCode) {
(*ms.orig).Code = otlptrace.Status_StatusCode(v)
ms.orig.Code = otlptrace.Status_StatusCode(v)

// According to OTLP spec we also need to set the deprecated_code field.
// See https://github.com/open-telemetry/opentelemetry-proto/blob/59c488bfb8fb6d0458ad6425758b70259ff4a2bd/opentelemetry/proto/trace/v1/trace.proto#L231
Expand Down
7 changes: 3 additions & 4 deletions exporter/loggingexporter/logging_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,9 @@ func (s *loggingExporter) pushTraceData(
buf.logAttr("Kind", span.Kind().String())
buf.logAttr("Start time", span.StartTime().String())
buf.logAttr("End time", span.EndTime().String())
if !span.Status().IsNil() {
buf.logAttr("Status code", span.Status().Code().String())
buf.logAttr("Status message", span.Status().Message())
}

buf.logAttr("Status code", span.Status().Code().String())
buf.logAttr("Status message", span.Status().Message())

buf.logAttributeMap("Attributes", span.Attributes())
buf.logEvents("Events", span.Events())
Expand Down
Loading