Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/awsxray] Metadata from X-Ray SDK wrapped in aws.xray.metadata #23610

Closed
jefchien opened this issue Jun 21, 2023 · 2 comments · Fixed by #24804
Closed

[exporter/awsxray] Metadata from X-Ray SDK wrapped in aws.xray.metadata #23610

jefchien opened this issue Jun 21, 2023 · 2 comments · Fixed by #24804
Assignees
Labels
bug Something isn't working exporter/awsxray priority:p2 Medium

Comments

@jefchien
Copy link
Contributor

Component(s)

exporter/awsxray

What happened?

Description

The awsxrayreceiver uses the JSON marshaler to convert the metadata received from the X-Ray SDK into a string as part of the translation to the OTEL span attributes. It also appends a prefix aws.xray.metadata to the metadata key. This isn't a problem for other exporters, but the awsxrayexporter should unmarshal the strings and strip the attribute prefix.

Steps to Reproduce

Start up the collector with awsxray receiver/exporter and the batch processor. Default configuration is fine. Use the X-Ray SDK to send a segment with metadata attached.

Expected Result

From inspecting the raw segment in the X-Ray console.

"metadata": {
    "http": {
        "connection": {
            "was_idle": false,
            "reused": false
        }
    }
},

Actual Result

"metadata": {
    "default": {
        "aws.xray.metadata.http": "{\"connection\":{\"reused\":false,\"was_idle\":false}}"
    }
},

Collector version

v0.78.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@jefchien jefchien added bug Something isn't working needs triage New item requiring triage labels Jun 21, 2023
@jefchien
Copy link
Contributor Author

Please assign this to me.

@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@bryan-aguilar bryan-aguilar added priority:p2 Medium and removed needs triage New item requiring triage labels Aug 11, 2023
@bryan-aguilar bryan-aguilar linked a pull request Sep 20, 2023 that will close this issue
codeboten pushed a commit that referenced this issue Sep 21, 2023
**Description:** The X-Ray receiver [marshals the
metadata](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awsxrayreceiver/internal/translator/metadata.go#L16)
from the X-Ray SDK, but the exporter doesn't unmarshal the metadata,
which results in squashed and incorrectly nested metadata.

```
"metadata": {
    "default": {
        "aws.xray.metadata.http": "{\"connection\":{\"reused\":false,\"was_idle\":false}}"
    }
},
```
instead of 
```
"metadata": {
    "http": {
        "connection": {
            "was_idle": false,
            "reused": false
        }
    }
},
```

Changes the exporter translator to check for the metadata attribute
prefix and attempt to unmarshal those.

**Link to tracking Issue:**
#23610

**Testing:** Added unit test. Ran the change with the collector and
verified in the AWS X-Ray console.
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
**Description:** The X-Ray receiver [marshals the
metadata](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awsxrayreceiver/internal/translator/metadata.go#L16)
from the X-Ray SDK, but the exporter doesn't unmarshal the metadata,
which results in squashed and incorrectly nested metadata.

```
"metadata": {
    "default": {
        "aws.xray.metadata.http": "{\"connection\":{\"reused\":false,\"was_idle\":false}}"
    }
},
```
instead of 
```
"metadata": {
    "http": {
        "connection": {
            "was_idle": false,
            "reused": false
        }
    }
},
```

Changes the exporter translator to check for the metadata attribute
prefix and attempt to unmarshal those.

**Link to tracking Issue:**
open-telemetry#23610

**Testing:** Added unit test. Ran the change with the collector and
verified in the AWS X-Ray console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter/awsxray priority:p2 Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants