1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-09-16 09:26:25 +02:00

Update the attribute names for the OTel attributes for the zipkin exporter (#1201)

Based on the spec change: https://github.com/open-telemetry/opentelemetry-specification/pull/967
This commit is contained in:
Dan Rusei
2020-09-24 05:42:05 +03:00
committed by GitHub
parent 7d71867644
commit 559fecd73e
4 changed files with 63 additions and 62 deletions

View File

@@ -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

View File

@@ -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,
}
@@ -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

View File

@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"
@@ -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",
},
},
}
@@ -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": "",
},
},
{
@@ -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": "",
},
},
{
@@ -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,
},
},
{
@@ -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": "",
},
},
{
@@ -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": "",
},
},
{
@@ -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": "",
},
},
}

View File

@@ -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
@@ -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",
},
},
}