Skip to content

Commit

Permalink
Update the attribute names for the OTel attributes for the zipkin exp…
Browse files Browse the repository at this point in the history
…orter (#1201)

Based on the spec change: open-telemetry/opentelemetry-specification#967
  • Loading branch information
danrusei authored Sep 24, 2020
1 parent 7d71867 commit 559fecd
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 62 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Rename `Provider` to `TracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190)
- Rename `NewProvider` to `NewTracerProvider` in the `go.opentelemetry.io/otel/sdk/trace` package. (#1190)
- Renamed `SamplingDecision` values to comply with OpenTelemetry specification change. (#1192)
- Renamed Zipkin attribute names from `ot.status_code & ot.status_description` to `otel.status_code & otel.status_description`. (#1201)

### Removed

Expand Down
8 changes: 4 additions & 4 deletions exporters/trace/zipkin/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ func attributesToJSONMapString(attributes []label.KeyValue) string {

// extraZipkinTags are those that may be added to every outgoing span
var extraZipkinTags = []string{
"ot.status_code",
"ot.status_description",
"otel.status_code",
"otel.status_description",
keyInstrumentationLibraryName,
keyInstrumentationLibraryVersion,
}
Expand All @@ -153,8 +153,8 @@ func toZipkinTags(data *export.SpanData) map[string]string {
if v, ok := m["error"]; ok && v == "false" {
delete(m, "error")
}
m["ot.status_code"] = data.StatusCode.String()
m["ot.status_description"] = data.StatusMessage
m["otel.status_code"] = data.StatusCode.String()
m["otel.status_description"] = data.StatusMessage

if il := data.InstrumentationLibrary; il.Name != "" {
m[keyInstrumentationLibraryName] = il.Name
Expand Down
108 changes: 54 additions & 54 deletions exporters/trace/zipkin/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data with no parent
Expand Down Expand Up @@ -383,10 +383,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data of unspecified kind
Expand Down Expand Up @@ -422,10 +422,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data of internal kind
Expand Down Expand Up @@ -461,10 +461,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data of client kind
Expand Down Expand Up @@ -500,10 +500,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data of producer kind
Expand Down Expand Up @@ -539,10 +539,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data of consumer kind
Expand Down Expand Up @@ -578,10 +578,10 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data with no events
Expand All @@ -608,10 +608,10 @@ func TestModelConversion(t *testing.T) {
RemoteEndpoint: nil,
Annotations: nil,
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"attr1": "42",
"attr2": "bar",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model for span data with an "error" attribute set to "false"
Expand Down Expand Up @@ -647,8 +647,8 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
}
Expand Down Expand Up @@ -685,20 +685,20 @@ func Test_toZipkinTags(t *testing.T) {
},
},
want: map[string]string{
"double": fmt.Sprint(doubleValue),
"key": keyValue,
"ok": "true",
"uint": strconv.FormatInt(uintValue, 10),
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"double": fmt.Sprint(doubleValue),
"key": keyValue,
"ok": "true",
"uint": strconv.FormatInt(uintValue, 10),
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
{
name: "no attributes",
data: &export.SpanData{},
want: map[string]string{
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
{
Expand All @@ -709,8 +709,8 @@ func Test_toZipkinTags(t *testing.T) {
},
},
want: map[string]string{
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
{
Expand All @@ -724,10 +724,10 @@ func Test_toZipkinTags(t *testing.T) {
StatusMessage: statusMessage,
},
want: map[string]string{
"error": "true",
"key": keyValue,
"ot.status_code": codes.Unknown.String(),
"ot.status_description": statusMessage,
"error": "true",
"key": keyValue,
"otel.status_code": codes.Unknown.String(),
"otel.status_description": statusMessage,
},
},
{
Expand All @@ -736,8 +736,8 @@ func Test_toZipkinTags(t *testing.T) {
InstrumentationLibrary: instrumentation.Library{},
},
want: map[string]string{
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
{
Expand All @@ -750,8 +750,8 @@ func Test_toZipkinTags(t *testing.T) {
},
want: map[string]string{
"otel.instrumentation_library.name": instrLibName,
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
{
Expand All @@ -766,8 +766,8 @@ func Test_toZipkinTags(t *testing.T) {
want: map[string]string{
"otel.instrumentation_library.name": instrLibName,
"otel.instrumentation_library.version": instrLibVersion,
"ot.status_code": codes.OK.String(),
"ot.status_description": "",
"otel.status_code": codes.OK.String(),
"otel.status_description": "",
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions exporters/trace/zipkin/zipkin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ func TestExportSpans(t *testing.T) {
RemoteEndpoint: nil,
Annotations: nil,
Tags: map[string]string{
"ot.status_code": "NotFound",
"ot.status_description": "404, file not found",
"otel.status_code": "NotFound",
"otel.status_description": "404, file not found",
},
},
// model of child
Expand All @@ -325,8 +325,8 @@ func TestExportSpans(t *testing.T) {
RemoteEndpoint: nil,
Annotations: nil,
Tags: map[string]string{
"ot.status_code": "PermissionDenied",
"ot.status_description": "403, forbidden",
"otel.status_code": "PermissionDenied",
"otel.status_description": "403, forbidden",
},
},
}
Expand Down

0 comments on commit 559fecd

Please sign in to comment.