-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add db.cosmosdb.partition_key as a span attr on item ops #23664
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution @kjg! We will review the pull request and get back to you soon. |
@FabianMeiswinkel @sourabh1007 @jcocchi - any thoughts here on the impact of this? |
My main concern is PII leakage. The query text and parameters are in the Semantic Conventions but with explicit notes about sanitization. The partition key could be considered PII in some cases. I don't know for sure if we currently emit I'm OK having it as an option, it does seem quite useful if you know your PKs are not PII. |
azcosmos does not yet emit For my team's use case, I could see us wanting to emit |
I absolutely think we need One thought is to have a list of "enabled tracing attributes" in options := azcosmos.ClientOptions {
EnabledTracingAttributes: []string { "db.query.text", "db.cosmosdb.partition_key" },
} But I don't know if that's feasible. There's also the element of having to scan this list every time we build a span, to identify which attributes to specify. I'd be curious what, if anything, other SDKs (both other Azure services' Go SDKs and Azure SDKs for other languages) do here 🤔 . Might poke around a bit and see what I can find. |
@analogrelay We have added |
As @analogrelay pointed out, the primary concern here is protecting PII, particularly if referencing logical partition keys tied to customer data. Instead, we could use physical identifiers such as partitionid (and replicaid) or pkrangeid, which would help in identifying potential hot partition issues without exposing sensitive information. In the Cosmos DB SDK, we currently don't emit traces at the network level, as network interactions can involve multiple partition IDs per operation. Therefore, we haven't included this data in traces yet. However, we are planning to introduce it as an optional dimension in network-level OpenTelemetry (OTel) metrics (ref here). This would allow users to opt in as needed, helping to manage cardinality effectively. |
Since the Go SDK is purely gateway mode and doesn't support queries that cross logical partitions, I think using physical identifiers would be difficult. I don't believe we have any logic to fetch the pkrangeid in the Go SDK today. So, I'm OK with providing an option to trace the logical partition key. I don't think pkrangeid is what a user would expect to be able to trace here, though I'm fine if we also want to add that at some point. We definitely need an opt in. I think my earlier suggestion wouldn't be a good fit here, since we've already established some patterns in other SDKs for opt-in telemetry. I think what I'd propose is to add a |
It would be useful to have the partition_key as an attribute on Item operations to make it easier to see if there are any performance based patterns in certain partitions, what are you thoughts on including it?
I know that
db.cosmosdb.partition_key
isn't in the OpenTelemetry Semantic Conventions (yet) as an attribute, but we could open a PR for that as well.