Skip to content

Commit 5cc0136

Browse files
[exporter/clickhouse] Update Trace SpanKind and StatusCode strings (#34799)
**Description:** Trace `SpanKind` and `StatusCode` are exporting [old enum values](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/04b3b9898b242c0b3b707bc043c025eb9f6f73ba/internal/coreinternal/traceutil/traceutil.go#L13-L47). This change will make these fields consistent with the specification. I have marked this as a breaking change since it may affect queries that filter by these strings. There should be no change to exporter deployments, only to the read queries. See above/below links for more information as well as a sample of the old vs new values. Example: `STATUS_CODE_ERROR` -> `Error` **Link to tracking Issue:** - open-telemetry/opentelemetry-collector#6250 - open-telemetry/opentelemetry-collector#6251 **Testing:** - Updated integration tests
1 parent 52c4b9a commit 5cc0136

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: clickhouseexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Upgrade trace SpanKind and StatusCode string values
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [34799]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
This change updates the output of the trace SpanKind and StatusCode fields to be consistent
20+
with the specification's enum values. While this change will not break any deployments, it may affect
21+
queries dependent on the old enum names.
22+
23+
For more details on old->new values, see this related PR:
24+
https://github.com/open-telemetry/opentelemetry-collector/pull/6250
25+
26+
27+
# If your change doesn't affect end users or the exported elements of any package,
28+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
29+
# Optional: The change log or logs in which this entry should be included.
30+
# e.g. '[user]' or '[user, api]'
31+
# Include 'user' if the change is relevant to end users.
32+
# Include 'api' if there is a change to a library API.
33+
# Default: '[user]'
34+
change_logs: []

exporter/clickhouseexporter/exporter_traces.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ func (e *tracesExporter) pushTraceData(ctx context.Context, td ptrace.Traces) er
9696
traceutil.SpanIDToHexOrEmptyString(r.ParentSpanID()),
9797
r.TraceState().AsRaw(),
9898
r.Name(),
99-
traceutil.SpanKindStr(r.Kind()),
99+
r.Kind().String(),
100100
serviceName,
101101
resAttr,
102102
scopeName,
103103
scopeVersion,
104104
spanAttr,
105105
r.EndTimestamp().AsTime().Sub(r.StartTimestamp().AsTime()).Nanoseconds(),
106-
traceutil.StatusCodeStr(status.Code()),
106+
status.Code().String(),
107107
status.Message(),
108108
eventTimes,
109109
eventNames,

exporter/clickhouseexporter/integration_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func verifyExporterTrace(t *testing.T, traceExporter *tracesExporter) {
183183
ParentSpanID: "0102040000000000",
184184
TraceState: "trace state",
185185
SpanName: "call db",
186-
SpanKind: "SPAN_KIND_INTERNAL",
186+
SpanKind: "Internal",
187187
ServiceName: "test-service",
188188
ResourceAttributes: map[string]string{
189189
"service.name": "test-service",
@@ -194,7 +194,7 @@ func verifyExporterTrace(t *testing.T, traceExporter *tracesExporter) {
194194
"service.name": "v",
195195
},
196196
Duration: 60000000000,
197-
StatusCode: "STATUS_CODE_ERROR",
197+
StatusCode: "Error",
198198
StatusMessage: "error",
199199
EventsTimestamp: []time.Time{
200200
time.Unix(1703498029, 0).UTC(),

0 commit comments

Comments
 (0)