How to add and process private custom attributes in elastic-apm-traceparent?

Kibana version:

v7.4.2

Elasticsearch version:

v7.4.2

APM Server version:

v7.4.2

APM Agent language and version:

v1.6.0

Question:

We hope to implement a requirement to add a private attribute identifier to the existing link identifier elastic-apm-traceparent, while ensuring that the original link trace is normal.

I have observed these methods (https://github.com/elastic/apm-agent-go/blob/master/internal/apmcontext/context.go#L22-L55), I customize the implementation and replace it, is it possible to implement My purpose?

Do you have any good suggestions, thank you!

@axw Hello, i'm here to disturb you again ...

@EDDYCJY sorry for the late reply, I've been away from computer for the past couple of weeks.

Adding custom attributes to elastic-apm-traceparent is not possible, as that header is meant to conform to the W3C Trace-Context standard.

I think Correlation-Context may address your needs. We don't currently have plans to add this, but that might change.

For now you will need to implement your own middleware to propagate custom attributes.