googleapis/python-bigquery

[OpenTelemetry] Can we add the `db.query.text` attribute to the spans?

Opened this issue ยท 10 comments

Hi there,

I was wondering if it would be possible to add the query itself in the span attributes. The list of official OTel attributes for db are listed here.

I'm happy to implement it, if wanted.

+1

This would be a great addition to help us identify which span is related to which of our queries in a much faster way.

This would be great, @chelsea-lin can you let us know if you would accept a PR for this?

Hoi ๐Ÿ‘‹

Friendly ping ๐Ÿ“ ๐Ÿ˜ƒ

@Kludex Thank you! It sounds good to me! Please go ahead to start the PR please.

Thank you @Kludex for the feature request and implementation! I also appreciate people upvoting the FR and letting us know your need :)
Indeed it would be very useful to have the query tracked in OpenTelemetry, but saving and sending query text may pose concerns about security and user privacy. I will look deeper into Google Cloud SDK's guidelines about PII data, and see what precautions or actions we need to take to ensure user privacy is protected.

It can be an opt-in feature as well, if you reach the conclusion is necessary to be.

@Linchin including the SQL in otel is absolutely necessary, every other db integration includes the SQL.

If you're really saying "we're not going to include the query", you're basically saying "we refuse to support otel with bigquery".

If we were to go through privacy review for query text anyway, are there any other things folks would like to track too? Suggestions are welcome.

Hoi ๐Ÿ‘‹

Friendly ping ๐Ÿ“ ๐Ÿ˜ƒ

Hi, thanks for the reminder. I'm currently in the process of figuring out Google Cloud's privacy requirement with this. Once we are clear on the steps needed to take, I will provide a timeline for adding this feature :)

At the same time, feel free to nominate any other OpenTelemetry fields you think we should add, and we can support them in the same batch!