You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for Distributed Tracing extension #355
Is your feature request related to a problem? Please describe.
A Distributed Tracing Extension is part of the specification. Javascript SDK should support it.
Describe the solution you would like to see
An implementation of Distributed Tracing should be implemented in similar way as it is done for Go and Java SDK's.
Receiving an event message like this in the SDK would result in a CloudEvent that had the extension traceparent. For example assuming those headers above,
Producing an event, that includes this information is similarly straightforward.
constevent=newCloudEvent({source: '/example',type: 'tracer',traceparent: '00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01'});constmessage=HTTP.binary(event);console.log(message.headers);// should include a 'ce-traceparent: 00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01' header
Looking at the spec, I'm not sure there is anything else for us to support. Is there some specific behavior that you had in mind?
If what we have already is sufficient to consider the Distributed Tracing extension supported, we should add this to the README.md and maybe provide an example.
I think if both of those are supported, we should write those in documentation as examples, and maybe also add a unit test to make sure this behavior will be kept.
I assume tracestate is also supported, just as traceparent?
Yes - it behaves just as any extension. A ce-<extname>: <extvalue> header will get created when creating new events, and a ce-<extname> header will result in that <extname> being a property of the event.
@lance I think this issue is complete? Anything else this issue is waiting on?
Well, I think it would probably be good to document how a user adds traces to an event. Do you think we should just close this issue and open another one? Maybe just changing the title to something like "Document support for distributed tracing". 🤷
A user should be able to add the HTTP header traceparent: 01-asdfasdf-etc and see the value within their CloudEvent receiver, such as a property cloudevent.extensions.traceparent.
A user should be able to add the HTTP header traceparent: 01-asdfasdf-etc and see the value within their CloudEvent receiver, such as a property cloudevent.extensions.traceparent.
I believe this would just show up as an extension attribute naturally. We already have a test for a random extension here, which is essentially the same thing, just not using traceparent. I suppose we could add an explicit test.
Activity
cardil commentedon Oct 20, 2020
/cc @piecioshka
lance commentedon Oct 20, 2020
@cardil good catch!
To be clear, expectations for the SDKs do not require that this be implemented. https://github.com/cloudevents/spec/blob/master/SDK.md#technical-requirements
But I agree - it would be good.
github-actions commentedon Nov 21, 2020
This issue is stale because it has been open 30 days with no activity.
lance commentedon Nov 25, 2020
@cardil I've been thinking about this, and I wonder how you see this in practical usage. In the spec, the example given is,
Receiving an event message like this in the SDK would result in a
CloudEventthat had the extensiontraceparent. For example assuming those headers above,Producing an event, that includes this information is similarly straightforward.
Looking at the spec, I'm not sure there is anything else for us to support. Is there some specific behavior that you had in mind?
lance commentedon Nov 25, 2020
If what we have already is sufficient to consider the Distributed Tracing extension supported, we should add this to the README.md and maybe provide an example.
cardil commentedon Nov 25, 2020
Awesome. I think we can easily resolve this issue with just writing those examples above in documentation.
cardil commentedon Nov 25, 2020
I assume
tracestateis also supported, just astraceparent?cardil commentedon Nov 25, 2020
I think if both of those are supported, we should write those in documentation as examples, and maybe also add a unit test to make sure this behavior will be kept.
lance commentedon Nov 25, 2020
Yes - it behaves just as any extension. A
ce-<extname>: <extvalue>header will get created when creating new events, and ace-<extname>header will result in that<extname>being a property of the event.cardil commentedon Nov 30, 2020
@lance Looking at Golang implementation it seems like more than just passing those extensions should be done:
https://github.com/cloudevents/sdk-go/blob/8ff3fbc/v2/client/client_observed.go#L48-L57
2 remaining items
lholmquist commentedon Dec 7, 2020
So is the actual action item here just adding docs? That is sort of what i got from skimming this thread
lance commentedon Dec 7, 2020
I think so, yes
cardil commentedon Dec 9, 2020
Docs with code examples
github-actions commentedon Jan 9, 2021
This issue is stale because it has been open 30 days with no activity.
github-actions commentedon Feb 11, 2021
This issue is stale because it has been open 30 days with no activity.
grant commentedon Nov 19, 2021
@lance I think this issue is complete? Anything else this issue is waiting on?
lance commentedon Nov 19, 2021
Well, I think it would probably be good to document how a user adds traces to an event. Do you think we should just close this issue and open another one? Maybe just changing the title to something like "Document support for distributed tracing". 🤷
grant commentedon Nov 23, 2021
In terms of how a user uses this:
A user should be able to add the HTTP header
traceparent: 01-asdfasdf-etcand see the value within their CloudEvent receiver, such as a propertycloudevent.extensions.traceparent.lance commentedon Nov 23, 2021
They'd add it as
ce-traceparent. Here is an example. https://github.com/cloudevents/spec/blob/v1.0.1/extensions/distributed-tracing.md#using-the-distributed-tracing-extensionI believe this would just show up as an extension attribute naturally. We already have a test for a random extension here, which is essentially the same thing, just not using
traceparent. I suppose we could add an explicit test.sdk-javascript/test/integration/message_test.ts
Lines 299 to 300 in f7b2840
github-actions commentedon Dec 24, 2021
This issue is stale because it has been open 30 days with no activity.