odigos-io / opentelemetry-go-instrumentation

OpenTelemetry auto-instrumentation for Go applications
Apache License 2.0
292 stars 44 forks source link

Generate ID for x-Ray #40

Open vasiliy-grinko opened 2 years ago

vasiliy-grinko commented 2 years ago

Feature request

As of now, go-agent is generating id in format which don't conforms with AWS X-Ray

I looked at code and didn't understand how to replace &eBPFSourceIDGenerator with xray.NewIDGenerator() without crushing the tracing.

Use case

In order to send traces to X-ray, go-agent needs generate ID in proper format.

vasiliy-grinko commented 2 years ago

I managed to generate ID for X-Ray by editing NewController() function: added lines:

idg := xray.NewIDGenerator()
otel.SetTracerProvider(tracerProvider)
otel.SetTextMapPropagator(xray.Propagator{})

chenaged line 114 sdktrace.WithIDGenerator(idg),

I also want to add status code and path of a request into traces

edeNFed commented 2 years ago

Sounds good, I will be happy to accept a PR.

vasiliy-grinko commented 2 years ago

Sounds good, I will be happy to accept a PR.

I'll create it after I fix this problem: in X-Ray I don't see a status code and a request path, in otel-collector logs I see this 2022-11-02T10:46:12.185Z debug awsxrayexporter@v0.55.0/awsxray.go:67 request: { TraceSegmentDocuments: ["{\"name\":\"backend\",\"id\":\"dc653d4977e1457b\",\"start_time\":1667385967.2310646,\"trace_id\":\"1-63624a6f-f40d0a0ff943e053208c61cd\",\"end_time\":1667385967.2310905,\"http\":{\"request\":{\"method\":\"GET\"},\"re} {"kind": "exporter", "data_type": "traces", "name": "awsxray"} 2022-11-02T10:46:12.192Z debug awsxrayexporter@v0.55.0/awsxray.go:74 response: { UnprocessedTraceSegments: [] } {"kind": "exporter", "data_type": "traces", "name": "awsxray"}