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] Fix X-Ray metadata unmarshal. #24804

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

jefchien
Copy link
Contributor

@jefchien jefchien commented Aug 2, 2023

Description: The X-Ray receiver marshals the metadata 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.

@jefchien jefchien requested review from a team and codeboten August 2, 2023 18:32
@jefchien jefchien changed the title Fix X-Ray metadata unmarshal. [exporter/awsxray] Fix X-Ray metadata unmarshal. Aug 8, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 29, 2023
@github-actions github-actions bot removed the Stale label Sep 8, 2023
@jefchien jefchien force-pushed the fix-xray-metadata-unmarshal branch 2 times, most recently from abef923 to 7b38c4d Compare September 18, 2023 19:30
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage is 100.00% of modified lines.

Files Changed Coverage
...ter/awsxrayexporter/internal/translator/segment.go 100.00%

📢 Thoughts on this report? Let us know!.

@bryan-aguilar
Copy link
Contributor

@jefchien looks like codecov is going to fail as the project targeted percentage is below the 85% limit.

@jefchien
Copy link
Contributor Author

@bryan-aguilar Not really sure how to improve that. The changes are fully covered by the added unit test.

@bryan-aguilar bryan-aguilar added the ready to merge Code review completed; ready to merge by maintainers label Sep 20, 2023
@codeboten codeboten merged commit ef78231 into open-telemetry:main Sep 21, 2023
92 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 21, 2023
@jefchien jefchien deleted the fix-xray-metadata-unmarshal branch September 21, 2023 14:29
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this pull request 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
exporter/awsxray ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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