You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[exporter/awsxray] Support setting inProgress segment-field in X-Ray Exporter (#43962)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
When using OTel Collector with `X-Ray Receiver/Exporter`, X-Ray Segment
gets converted into OpenTelemetry Span (via X-Ray Receiver) and then
later gets converted into X-Ray Segment (via X-Ray Exporter).
In X-Ray Receiver, the `in_progress` Segment field attribute is
explicitly converted into the `aws.xray.inprogress` attribute.
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.138.0/receiver/awsxrayreceiver/internal/translator/translator.go#L169
In X-Ray Exporter, the `aws.xray.inprogress` attribute **is not**
converted back into the `in_progress` Segment field:
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.138.0/exporter/awsxrayexporter/internal/translator/segment.go#L336-L350
Therefore the `in_progress` functionality does not function as it was
intended as it is now part of metadata instead of being a Segment field.
The Segment doesn't have the ability to be updated later since it isn't
correctly labeled as `in_progress` in X-Ray. This PR fixes this issue by
ensuring that `in_progress` is converted back into a Segment field if
the original Segment ingested by X-Ray Receiver had `in_progress` set.
Furthermore, if `in_progress` is set, then `end_time` **shouldn't** be
set.
<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes#44001
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Tested with OCB:
`builder-config.yaml`:
```yaml
dist:
name: otelcol-dev-0.138.0
description: Basic OTel Collector distribution for Developers
output_path: ./otelcol-dev-prod-0.138.0
otelcol_version: 0.138.0
exporters:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.138.0
receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.138.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.138.0
extensions:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.138.0
replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.138.0 => github.com/jj22ee/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.138.1
```
config.yaml
```yaml
extensions:
awsproxy:
local_mode: true
region: 'us-west-2'
#health_check:
receivers:
awsxray:
transport: udp
proxy_server:
tls:
insecure: false
server_name_override: ""
region: 'us-west-2'
role_arn: ""
aws_endpoint: ""
local_mode: true
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
awsxray:
region: 'us-west-2'
index_all_attributes: true
service:
pipelines:
traces:
receivers: [awsxray, otlp]
exporters: [awsxray]
extensions: [awsproxy] #[health_check]
telemetry:
logs:
level: debug
```
Send segment to OTel Collector:
> `cat sample-trace.json | nc -u 127.0.0.1 2000`
sample-trace.json:
```
{"format":"json","version":1}
{"type":"segment","trace_id":"1-64d8bfaf-fd72e26886b3fdd3a272224e","id":"6222467a3d841238","start_time":1759136781.313,"in_progress":true,"name":"testName","user":"213456","origin":"AWS::EC2::Instance","namespace":"aws","aws":{"account_id":"123456789012"}}
```
Result before fix:
- X-Ray Segment in AWS X-Ray has `in_progress` as Segment metadata,
`end_time` is set.
Result after fix:
- X-Ray Segment in AWS X-Ray has `in_progress` as a Segment field,
`end_time` isn't set.
<!--Describe the documentation added.-->
#### Documentation
<!--Please delete paragraphs that you did not use before submitting.-->
0 commit comments