Skip to content

Auto convert w3c trace format (#184) #332

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

vineethawal
Copy link
Contributor

@vineethawal vineethawal commented Mar 26, 2025

This PR implements support for automatically converting W3C Trace Context format to AWS X-Ray format. This mimics the transformation behavior available in the AWS X-Ray console and allows the plugin to interoperate more effectively with systems using the standardized W3C trace context specification.
Resolves: #184

@CLAassistant
Copy link

CLAassistant commented Mar 26, 2025

CLA assistant check
All committers have signed the CLA.

@vineethawal vineethawal changed the title implement support to auto convert w3c trace format (#184) Mar 26, 2025
@vineethawal vineethawal marked this pull request as ready for review March 26, 2025 12:40
@vineethawal vineethawal requested a review from a team as a code owner March 26, 2025 12:40
@vineethawal vineethawal requested review from kevinwcyu and njvrzm March 26, 2025 12:40
@vineethawal vineethawal force-pushed the feature/w3c-trace-id-support branch from d9786f6 to a3359b5 Compare March 26, 2025 12:51
@@ -414,7 +414,7 @@ func TestDatasource(t *testing.T) {
})

t.Run("getTrace query with different region", func(t *testing.T) {
response, err := queryDatasource(ds, datasource.QueryGetTrace, datasource.GetTraceQueryData{Query: "traceID", Region: "us-east-1"})
response, err := queryDatasource(ds, datasource.QueryGetTrace, datasource.GetTraceQueryData{Query: "trace1", Region: "us-east-1"})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to fix this test as I had to remove hardcoded traceId in line 185

@@ -398,7 +398,7 @@ func TestDatasource(t *testing.T) {
})

t.Run("getTrace query", func(t *testing.T) {
response, err := queryDatasource(ds, datasource.QueryGetTrace, datasource.GetTraceQueryData{Query: "traceID"})
response, err := queryDatasource(ds, datasource.QueryGetTrace, datasource.GetTraceQueryData{Query: "trace1"})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to fix this test as I had to remove hardcoded traceId in line 185

@vineethawal vineethawal changed the title Implement support to auto convert w3c trace format (#184) Mar 26, 2025
func convertW3CToXRayTraceID(w3cTraceID string) string {
// X-Ray format: 1-{8 chars}-{24 chars}
if len(w3cTraceID) == 32 {
return fmt.Sprintf("1-%s-%s", w3cTraceID[0:8], w3cTraceID[8:])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinwcyu kevinwcyu self-assigned this Mar 27, 2025
@kevinwcyu kevinwcyu moved this from Incoming to In Progress in AWS Datasources Mar 27, 2025
Copy link
Contributor

@kevinwcyu kevinwcyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @vineethawal!

@kevinwcyu kevinwcyu merged commit 423d16f into grafana:main Mar 27, 2025
14 of 23 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in AWS Datasources Mar 27, 2025
@vineethawal
Copy link
Contributor Author

@kevinwcyu Do we have any plans for next release of this plugin?

@idastambuk idastambuk mentioned this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants