cloudevents / spec

CloudEvents Specification
https://cloudevents.io
Apache License 2.0
5.1k stars 586 forks source link

CorrelationId - Why not use W3C on Json Event Format? #1318

Closed Leonardo-Ferreira closed 1 week ago

Leonardo-Ferreira commented 1 week ago

I've seen around some issues regarding this topic but my approach here, I believe to be fresh:

why don't we use W3C tracecontext standard on Json Event Format?

this would be a optional property that would allow the chain of observability to remain intact, this is a very well known pattern/style, its supported by a major entity and very big components are already using it...

the result would be something like:

{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext",
    "id" : "B234-1234-1234",
    "time" : "2018-04-05T17:31:00Z",
    "comexampleextension1" : "value",
    "comexampleothervalue" : 5,
    "unsetextension": null,
    "datacontenttype" : "application/xml",
    "traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
    "data" : "<much wow=\"xml\"/>"
}
duglin commented 1 week ago

https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/distributed-tracing.md

Leonardo-Ferreira commented 1 week ago

im sorry @duglin, I believe my original question was misleading on my intentions. Can you please read it again?

duglin commented 1 week ago

@Leonardo-Ferreira I'm confused. We already have an extension defined that uses the exact traceparent field you're looking for (defined in the link I posted). Is there something else you're looking for?

Leonardo-Ferreira commented 1 week ago

@duglin I was expecting to see a explicit mention of the traceparent/tracestate property on the definition of the Json Event Format like

{
    [other properties]
    "traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"    
}
duglin commented 1 week ago

@Leonardo-Ferreira it's an "extension" not a "spec defined optional attribute", which is why it doesn't appear in the JSON snippet you pointed to. There's a difference.

A "spec defined optional attribute" is one that we think is so common that almost everyone will use it, and therefore it makes sense to call it out as part of the core spec. time is a good example of this - very very popular, but not required for ALL events for CE to be useful.

"extensions" are similar to "spec defined optional attributes" in that they're "optional", but we don't yet have a good sense of how popular they are so we didn't feel comfortable encouraging their use yet as part of the "core" spec. However, since we did see value in trying to build a consensus and community around extensions we keep them in the spec github repo to encourage their development and use. Over time if some of them because so popular that we think it would benefit the community to move them into the "core" spec then we can do so. I'm not sure any of the extensions have reached that level yet though.

Does that help?

Leonardo-Ferreira commented 1 week ago

yes, perfect! thank you