Closed rdooley closed 1 year ago
Hi :wave:,
Thanks for opening this PR. I see that you're trying to push for semantic conventions, however I disagree with their usage in this case. The collected telemetry data will get more vague, and there are also some properties you lost in the conversion. I disagree that all attributes should be called db.cf.<x>
, as you lose searchability by name of attribute.
A specific example: Cloudflare also has a PubSub product, entirely separate from Queues. Eventually, that will also get more API in workers, so how will you differentiate a queue trigger from a pubsub trigger, if you use the semantic "queue" trigger type for both? I think it's best to keep the attributes not-entirely-semantic, so they convey more (and more accurate) information.
With all that said, I'm not the maintainer of this project, so @evanderkoogh will have the final say.
Thanks for opening this PR. I see that you're trying to push for semantic conventions, however I disagree with their usage in this case. The collected telemetry data will get more vague, and there are also some properties you lost in the conversion. I disagree that all attributes should be called
db.cf.<x>
, as you lose searchability by name of attribute.
I mostly care about the fetch/Http conventions (particularly span name). The KV and DO instrumentations are largely a best first stab.
Would using the existing SemanticAttributes
for DB_NAME, DB_SYSTEM, DB_OPERATION etc with the kv.*
and do.*
attributes becoming e.g. cf.kv.cache_ttl
? In this case the main thing is a desire to have camelCase suffixes become snake_case following the pattern of existing semantic conventions.
A specific example: Cloudflare also has a PubSub product, entirely separate from Queues. Eventually, that will also get more API in workers, so how will you differentiate a queue trigger from a pubsub trigger, if you use the semantic "queue" trigger type for both? I think it's best to keep the attributes not-entirely-semantic, so they convey more (and more accurate) information.
The semantic conventions has a Should
in there, so how about queue
for queue and pubsub
for pubsub?
With all that said, I'm not the maintainer of this project, so @evanderkoogh will have the final say.
Appreciate the feedback here, trying to make this better for all users, not just my specific use case đ
Anyways, here are some spans (I just logged them to console using a ConsoleSpanExporter I'll throw up in a separate PR)
@DaniFoldi and @evanderkoogh keen to hear any feedback on this if you have any
I agree that we should fully qualify the product in the attribute keys after cf...
(so db.cf.kv.foobar = 'wat'
). I think this would resolve your concerns about searchability @DaniFoldi?
Here's a general pitch in favor of semantic conventions:
db.statement
calls, Cloudflare spans will be analyzeable with no modification whatsoever.db.cf...
prefix), then we can submit them upstream and have them included in this page here. That will let OSS projects and vendors build custom Cloudflare trace analysis tooling on stable APIs. Hey @plantfansam, I am certainly very interested in your opinions on this, seeing as you have a ton more experience with the spec and with integrating that with query solutions. So thanks for chipping in here.
Now I am not a big fan of db.cf.x
for both the reason @DaniFoldi mentioned, but also because it would make some of those "prepared" queries completely useless if you run that over both KV and DO spans, because of the nature of the systems are so incredibly different.
But I also love to follow some of those conventions so that we can make it easier for external parties to automatically include those in their queries.
So @plantfansam, would it be better to do say db.cf.kv.key
or should we do a db.cf_kv.key
? Or would we expect those 3rd parties to also filter based on the dbSystem
key?
And we have had some discussions about the HTTP Span Name already, but I am relatively reluctant to go with the Semantic Convention there. We have no way of knowing a route
upfront. The pathname
is very likely to include things like IDs, so I really wouldn't want to treat that as the route
. And without route
, the span name would basically be GET
or POST
.
Now what we could do is at the end of the span check if the user has manually set the ROUTE information and then change the span name accordingly? But I am looking forward to people's opinion on that.
So @plantfansam, would it be better to do say
db.cf.kv.key
or should we do adb.cf_kv.key
? Or would we expect those 3rd parties to also filter based on thedbSystem
key?
I like db.cf.kv.key
because it hews more closely to current semantic conventions. As an example, take the semconv attributes for aws dynamodb: aws.dynamodb.consumed_capacity
, aws.dynamodb.table_names
.
And we have had some discussions about the HTTP Span Name already, but I am relatively reluctant to go with the Semantic Convention there. We have no way of knowing a
route
upfront.
I wonder if we performantly allow users to configure this. So on boot you pass a config option like:
{
"restfulAction/:id": {"regex": RegExp.new("https://foobar.com/restfulAction/[d+]"), // or whatever the regex is
"anotherRestfulAction/:id": {"regex": RegExp.new("https://foobar.com/anotherRestfulAction/[d+]")
}
If config is unset, then default to HTTP span name as host
, if config object set, try to parse. Would want to benchmark this for sure...
Rather than muddy things with intermediate work, I'll wait until we have some stronger consensus on attribute names before updating this PR.
So @plantfansam, would it be better to do say
db.cf.kv.key
or should we do adb.cf_kv.key
? Or would we expect those 3rd parties to also filter based on thedbSystem
key?I like
db.cf.kv.key
because it hews more closely to current semantic conventions. As an example, take the semconv attributes for aws dynamodb:aws.dynamodb.consumed_capacity
,aws.dynamodb.table_names
.
Following that pattern we should end up with cf.kv.key
and db.system="cloudflarekv"
right?
And we have had some discussions about the HTTP Span Name already, but I am relatively reluctant to go with the Semantic Convention there. We have no way of knowing a
route
upfront.I wonder if we performantly allow users to configure this. So on boot you pass a config option like:
{ "restfulAction/:id": {"regex": RegExp.new("https://foobar.com/restfulAction/[d+]"), // or whatever the regex is "anotherRestfulAction/:id": {"regex": RegExp.new("https://foobar.com/anotherRestfulAction/[d+]") }
If config is unset, then default to HTTP span name as
host
, if config object set, try to parse. Would want to benchmark this for sure...
I see where you are going, but that means that you need to perfectly duplicate your URL parsing. Once in your otel config and once in your router. And they could use different configuration mechanics.
And if you screw that up it is going to be hard to figure that out because the thing you are relying on to find that issue is wrong.
So @plantfansam, would it be better to do say
db.cf.kv.key
or should we do adb.cf_kv.key
? Or would we expect those 3rd parties to also filter based on thedbSystem
key?I like
db.cf.kv.key
because it hews more closely to current semantic conventions. As an example, take the semconv attributes for aws dynamodb:aws.dynamodb.consumed_capacity
,aws.dynamodb.table_names
.
So AWS doesnât use the âdbâ prefix for their databases?
My question more is, do we have to stick with two dots or can we have more?
I prefer db.cf.kv.key, but if vendors are going to not parse that properly, but handle db.cf_kv.key properly, I would pick that.
So AWS doesnât use the âdbâ prefix for their databases?
AWS doesn't (for some reason) but basically every other one with unique attribute keys (cassandradb used as example) does
My question more is, do we have to stick with two dots or can we have more?
I prefer db.cf.kv.key, but if vendors are going to not parse that properly, but handle db.cf_kv.key properly, I would pick that.
Making some assumptions based on our own experiences and a reading of the spec, but attribute keys are just strings so we should be fine to go with db.cf.kv.key
Cool.. I am happy to go with db.cf.kv.key
and db.cf.do.key
etc..
How about we revert the span name for now and I'll open up an issue to further discuss that. And then we can get all the db.*
one in. Want to get those in as early as possible for people to realise that they have changed before we get to a proper 1.0.0
So AWS doesnât use the âdbâ prefix for their databases?
Looks like no, but I think we can đ
My question more is, do we have to stick with two dots or can we have more?
I think it's OK to have more than 2 dots. See e.g. rabbitmq's messaging.rabbitmq.destination.routing_key
And if you screw that up it is going to be hard to figure that out because the thing you are relying on to find that issue is wrong.
Yeah, I think you're right. Needs more đ€
How about we revert the span name for now and I'll open up an issue to further discuss that. And then we can get all the db.* one in. Want to get those in as early as possible for people to realise that they have changed before we get to a proper 1.0.0
I'm happy with that đ
So @plantfansam, would it be better to do say
db.cf.kv.key
or should we do adb.cf_kv.key
? Or would we expect those 3rd parties to also filter based on thedbSystem
key?I like
db.cf.kv.key
because it hews more closely to current semantic conventions. As an example, take the semconv attributes for aws dynamodb:aws.dynamodb.consumed_capacity
,aws.dynamodb.table_names
.Following that pattern we should end up with
cf.kv.key
anddb.system="cloudflarekv"
right?
Yeah, I don't think there's an established convention for whether you should use e.g. db.
or messaging.
before vendor-specific attributes. Rabbitmq uses messaging.
while dynamodb (as you point out) uses aws.
. My personal preference is to include db.
in the attr name (so db.cf.kv.key
), but I don't think the community has an established perspective there.
Just documenting the HTTP_ROUTE
and span name behavior from upstream
Gonna revert the route/span name stuff for now in the interest of having a cleaner PR here, but just wanted to document this somewhere with some links for a convenient reference point.
I put your comment in a HTTP span name issue.
Hey @rdooley, that last commit means the PR is ready to go right? So shouldnât be a draft anymore?
Also, please donât take the discussion to mean I donât appreciate the PR. I absolutely love other people getting involved and improving things for not just themselves, but the entire community.
Hey @rdooley, that last commit means the PR is ready to go right? So shouldnât be a draft anymore?
I think so, but let me do a quick search of our span storage to ensure we don't have any other camelCase attrs I'm missing or anything that looks funky.
Also, please donât take the discussion to mean I donât appreciate the PR. I absolutely love other people getting involved and improving things for not just themselves, but the entire community.
This was perfect for me, discussion is good.
There are a few more http
attributes that I missed existing conventions of, and additionally for consistency I think the cf.*
attributes added via gatherOutgoingCfAttributes
should be cf.snake_case
instead of cf.camelCase
for consistency.
I'll do both of these additions as separate commits and then mark this PR as ready for review
This branch is now (finally) ready for review
A few notes here about opentelemetry-js SemanticConventions we are using that differ from spec (I'll open this as an issue here and try to update opentelemetry-js I guess)
http.request_content_length
should be http.request.body.size
http.status_code
should be http.response.status_code
http.scheme
should be url.scheme
http.user_agent
should be user-agent.original
Thanks @rdooley! I am merging this now, but might be a day or two before I have a chance to release it. Currently on PTO
Thanks @rdooley! I am merging this now, but might be a day or two before I have a chance to release it. Currently on PTO
Awesome, no rush on my end. I'm gonna try to get a look at #61 later this week and maybe get the ball rolling on #62 if i'm feeling ambitious
Getting the ball slowly rolling on moving towards Otel semantic conventions for span names and attributes
Most relevant links are
TODO: testing?