Skip to content

Commit a23ba13

Browse files
jj22eeAneurysm9
andcommitted
[exporter/awsxray] Change exporter.awsxray.skiptimestampvalidation feature gate from Alpha to Beta (open-telemetry#26553)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Change `exporter.awsxray.skiptimestampvalidation` feature gate from Alpha to Beta. This will change the `awsxrayexporter` to not drop invalid trace ids (first 32-bits of trace id in Unix epoch time is not within past 30 days) by default. **Link to tracking Issue:** <Issue number if applicable> N/A **Testing:** <Describe what testing was performed and which tests were added.> Updated Unit tests. Local testing: Used [Golang OTel instrumented sample app](https://github.com/aws-observability/aws-otel-community/tree/master/centralized-sampling-tests/sample-apps/golang-http-server) Built the ADOT Collector locally with [the timestamp check removal change](open-telemetry#26041), and ran locally with feature gate enabled Scenarios tested with XRay Service (drops W3C trace): - Removed the ID Generator in Golang sample app, created a few traces with W3C trace ID - result: Collector logs indicate that XRay has dropped the segments - Created a batch of traces with W3C trace ID and XRay trace ID - result: Collector logs indicate that XRay has dropped only the w3c segments Example logs from XRay logged by awsxrayexporter due to invalid trace IDs sent to XRay: ``` 2023-09-07T17:29:30.495Z debug [email protected]/awsxray.go:79 response: { UnprocessedTraceSegments: [{ ErrorCode: "InvalidTraceId", Id: "33f5358b5290fbc8", Message: "Invalid segment. ErrorCode: InvalidTraceId" },{ ErrorCode: "InvalidTraceId", Id: "6be91641d130c356", Message: "Invalid segment. ErrorCode: InvalidTraceId" }] } {"kind": "exporter", "data_type": "traces", "name": "awsxray"} ``` **Documentation:** <Describe the documentation added.> Updated awsxrayexporter README to indicate that the exporter will not drop the traces with invalid trace ids anymore. Let X-Ray handle the logic for dropping the traces instead. --------- Co-authored-by: Anthony Mirabella <[email protected]>
1 parent 8635030 commit a23ba13

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: awsxrayexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Change `exporter.awsxray.skiptimestampvalidation` feature gate from Alpha to Beta"
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: [26553]
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+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

exporter/awsxrayexporter/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ propagated by them using the `X-Amzn-Trace-Id` HTTP header. However, other gener
1818
supported by replacing fully-random Trace IDs with X-Ray formatted Trace IDs where necessary:
1919

2020
> AWS X-Ray IDs are the same size as W3C Trace Context IDs but differ in that the first 32 bits of a Trace ID
21-
> is the Unix epoch time when the trace was started. Since X-Ray only allows submission of Trace IDs from the
22-
> past 30 days, received Trace IDs are checked and spans without a valid timestamp are dropped.
21+
> is the Unix epoch time when the trace was started. Note that X-Ray only allows submission of Trace IDs from
22+
> the past 30 days, otherwise the trace is dropped by X-Ray. The Exporter will not validate this timestamp.
2323
24-
This means in order for spans to appear in X-Ray, the client SDK MUST use an X-Ray ID generator. For more
24+
This means that until X-Ray supports Trace Ids consisting of fully random bits, in order for spans to appear in X-Ray, the client SDK MUST use an X-Ray ID generator. For more
2525
information, see
2626
[configuring the X-Ray exporter](https://aws-otel.github.io/docs/getting-started/x-ray#configuring-the-aws-x-ray-exporter).
2727

exporter/awsxrayexporter/awsxray_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ func TestXrayAndW3CSpanTraceExport(t *testing.T) {
6767
func TestXrayAndW3CSpanTraceResourceExtraction(t *testing.T) {
6868
td := constructXrayAndW3CSpanData()
6969
logger, _ := zap.NewProduction()
70-
assert.Len(t, extractResourceSpans(generateConfig(t), logger, td), 2, "2 spans have xay trace id")
70+
assert.Len(t, extractResourceSpans(generateConfig(t), logger, td), 4, "4 spans have xray/w3c trace id")
7171
}
7272

7373
func TestW3CSpanTraceResourceExtraction(t *testing.T) {
74-
t.Skip("Flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/9255")
7574
td := constructW3CSpanData()
7675
logger, _ := zap.NewProduction()
77-
assert.Len(t, extractResourceSpans(generateConfig(t), logger, td), 0, "0 spans have xray trace id")
76+
assert.Len(t, extractResourceSpans(generateConfig(t), logger, td), 2, "2 spans have w3c trace id")
7877
}
7978

8079
func TestTelemetryEnabled(t *testing.T) {
@@ -148,7 +147,6 @@ func constructSpanData() ptrace.Traces {
148147
return traces
149148
}
150149

151-
// nolint:unused
152150
func constructW3CSpanData() ptrace.Traces {
153151
resource := constructResource()
154152
traces := ptrace.NewTraces()

exporter/awsxrayexporter/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const (
3434

3535
var skipTimestampValidationFeatureGate = featuregate.GlobalRegistry().MustRegister(
3636
"exporter.awsxray.skiptimestampvalidation",
37-
featuregate.StageAlpha,
37+
featuregate.StageBeta,
3838
featuregate.WithRegisterDescription("Remove XRay's timestamp validation on first 32 bits of trace ID"),
3939
featuregate.WithRegisterFromVersion("v0.84.0"))
4040

exporter/awsxrayexporter/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestCreateDefaultConfig(t *testing.T) {
4646
ResourceARN: "",
4747
RoleARN: "",
4848
},
49-
skipTimestampValidation: false,
49+
skipTimestampValidation: true,
5050
}, "failed to create default config")
5151
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
5252
}

0 commit comments

Comments
 (0)