From c8ca56d16d428de580a6974c6bc92e40785fdb62 Mon Sep 17 00:00:00 2001 From: Spencer Torres Date: Wed, 21 Aug 2024 17:23:28 -0400 Subject: [PATCH 1/2] Update Kind and StatusCode strings, tests, changelog --- .../clickhouse-upgrade-statuscode-kind.yaml | 34 +++++++++++++++++++ .../clickhouseexporter/exporter_traces.go | 4 +-- .../clickhouseexporter/integration_test.go | 4 +-- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 .chloggen/clickhouse-upgrade-statuscode-kind.yaml diff --git a/.chloggen/clickhouse-upgrade-statuscode-kind.yaml b/.chloggen/clickhouse-upgrade-statuscode-kind.yaml new file mode 100644 index 000000000000..76943e572d65 --- /dev/null +++ b/.chloggen/clickhouse-upgrade-statuscode-kind.yaml @@ -0,0 +1,34 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: clickhouseexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Upgrade trace StatusCode and Kind string values + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + This change updates the output of the trace Kind and StatusCode fields to be consistent + with the specification's enum values. While this change will not break any deployments, it may affect + queries dependent on the old enum names. + + For more details on old->new values, see this related PR: + https://github.com/open-telemetry/opentelemetry-collector/pull/6250 + + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/exporter/clickhouseexporter/exporter_traces.go b/exporter/clickhouseexporter/exporter_traces.go index ff2aafb82f14..6a04f4d157b0 100644 --- a/exporter/clickhouseexporter/exporter_traces.go +++ b/exporter/clickhouseexporter/exporter_traces.go @@ -96,14 +96,14 @@ func (e *tracesExporter) pushTraceData(ctx context.Context, td ptrace.Traces) er traceutil.SpanIDToHexOrEmptyString(r.ParentSpanID()), r.TraceState().AsRaw(), r.Name(), - traceutil.SpanKindStr(r.Kind()), + r.Kind().String(), serviceName, resAttr, scopeName, scopeVersion, spanAttr, r.EndTimestamp().AsTime().Sub(r.StartTimestamp().AsTime()).Nanoseconds(), - traceutil.StatusCodeStr(status.Code()), + status.Code().String(), status.Message(), eventTimes, eventNames, diff --git a/exporter/clickhouseexporter/integration_test.go b/exporter/clickhouseexporter/integration_test.go index 2d15cb6a780c..cbcba99f732e 100644 --- a/exporter/clickhouseexporter/integration_test.go +++ b/exporter/clickhouseexporter/integration_test.go @@ -183,7 +183,7 @@ func verifyExporterTrace(t *testing.T, traceExporter *tracesExporter) { ParentSpanID: "0102040000000000", TraceState: "trace state", SpanName: "call db", - SpanKind: "SPAN_KIND_INTERNAL", + SpanKind: "Internal", ServiceName: "test-service", ResourceAttributes: map[string]string{ "service.name": "test-service", @@ -194,7 +194,7 @@ func verifyExporterTrace(t *testing.T, traceExporter *tracesExporter) { "service.name": "v", }, Duration: 60000000000, - StatusCode: "STATUS_CODE_ERROR", + StatusCode: "Error", StatusMessage: "error", EventsTimestamp: []time.Time{ time.Unix(1703498029, 0).UTC(), From 474077492e9dfb08295555f2df4cb52eb4ecc77f Mon Sep 17 00:00:00 2001 From: Spencer Torres Date: Wed, 21 Aug 2024 17:32:47 -0400 Subject: [PATCH 2/2] changelog --- .chloggen/clickhouse-upgrade-statuscode-kind.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.chloggen/clickhouse-upgrade-statuscode-kind.yaml b/.chloggen/clickhouse-upgrade-statuscode-kind.yaml index 76943e572d65..e58b48a4b32c 100644 --- a/.chloggen/clickhouse-upgrade-statuscode-kind.yaml +++ b/.chloggen/clickhouse-upgrade-statuscode-kind.yaml @@ -7,16 +7,16 @@ change_type: breaking component: clickhouseexporter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Upgrade trace StatusCode and Kind string values +note: Upgrade trace SpanKind and StatusCode string values # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [] +issues: [34799] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. # Use pipe (|) for multiline entries. subtext: | - This change updates the output of the trace Kind and StatusCode fields to be consistent + This change updates the output of the trace SpanKind and StatusCode fields to be consistent with the specification's enum values. While this change will not break any deployments, it may affect queries dependent on the old enum names.