-
Notifications
You must be signed in to change notification settings - Fork 304
telemetry: Reduce cardinality of some otel span names #3558
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,8 +145,13 @@ impl v3::HostConnectionWithStore for crate::MqttFactorData { | |
| } | ||
|
|
||
| #[instrument(name = "spin_outbound_mqtt.publish", skip(accessor, connection, payload), err(level = Level::INFO), | ||
| fields(otel.kind = "producer", otel.name = format!("{} publish", topic), messaging.operation = "publish", | ||
| messaging.system = "mqtt"))] | ||
| fields( | ||
| otel.kind = "producer", | ||
| otel.name = "publish", | ||
| messaging.operation = "publish", | ||
| messaging.system = "mqtt", | ||
| messaging.destination.name = topic, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved topic here (per otel semantic conventions) |
||
| ))] | ||
| async fn publish<T: Send>( | ||
| accessor: &Accessor<T, Self>, | ||
| connection: Resource<v3::Connection>, | ||
|
|
@@ -218,8 +223,13 @@ impl v2::HostConnection for InstanceState { | |
| /// current trace context into the payload yourself. | ||
| /// https://w3c.github.io/trace-context-mqtt/#mqtt-v3-recommendation. | ||
| #[instrument(name = "spin_outbound_mqtt.publish", skip(self, connection, payload), err(level = Level::INFO), | ||
| fields(otel.kind = "producer", otel.name = format!("{} publish", topic), messaging.operation = "publish", | ||
| messaging.system = "mqtt"))] | ||
| fields( | ||
| otel.kind = "producer", | ||
| otel.name = "publish", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| messaging.operation = "publish", | ||
| messaging.system = "mqtt", | ||
| messaging.destination.name = topic, | ||
| ))] | ||
| async fn publish( | ||
| &mut self, | ||
| connection: Resource<v2::Connection>, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,14 +159,16 @@ impl<C: Client> v3::HostConnectionWithStore for MysqlFactorData<C> { | |
| impl<C: Client> v2::Host for InstanceState<C> {} | ||
|
|
||
| impl<C: Client> v2::HostConnection for InstanceState<C> { | ||
| #[instrument(name = "spin_outbound_mysql.open", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", db.system = "mysql", db.address = Empty, server.port = Empty, db.namespace = Empty))] | ||
| #[instrument(name = "spin_outbound_mysql.open", skip(self, address), err(level = Level::INFO), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: shouldn't we use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds fine but I don't really want to audit all arguments in this PR. |
||
| fields(otel.kind = "client", db.system = "mysql", db.address = Empty, server.port = Empty, db.namespace = Empty))] | ||
| async fn open(&mut self, address: String) -> Result<Resource<v2::Connection>, v2::Error> { | ||
| let mut state = self.0.lock().await; | ||
| state.otel.reparent_tracing_span(); | ||
| state.open_connection(&address).await.map(Resource::new_own) | ||
| } | ||
|
|
||
| #[instrument(name = "spin_outbound_mysql.execute", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", db.system = "mysql", otel.name = statement))] | ||
| #[instrument(name = "spin_outbound_mysql.execute", skip(self, connection, params), err(level = Level::INFO), | ||
| fields(otel.kind = "client", db.system = "mysql", otel.name = spin_telemetry::db::sql_span_name(&statement)))] | ||
|
Comment on lines
+170
to
+171
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, I'm not convinced that using some sort of simplified query representation is better than name being
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends a lot on your tooling. It doesn't really matter for something like Honeycomb which gives you a lot of flexibility in how you visualize traces, but for e.g. Jaeger you only see a few specific attributes at the top level and span name is a big one. |
||
| async fn execute( | ||
| &mut self, | ||
| connection: Resource<v2::Connection>, | ||
|
|
@@ -184,7 +186,8 @@ impl<C: Client> v2::HostConnection for InstanceState<C> { | |
| .map_err(track_db_error_on_span) | ||
| } | ||
|
|
||
| #[instrument(name = "spin_outbound_mysql.query", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", db.system = "mysql", otel.name = statement))] | ||
| #[instrument(name = "spin_outbound_mysql.query", skip(self, connection, params), err(level = Level::INFO), | ||
| fields(otel.kind = "client", db.system = "mysql", otel.name = spin_telemetry::db::sql_span_name(&statement)))] | ||
| async fn query( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love that otel consumers lose the knowledge that this comes from the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fair, though there is quiet a bit of other info available: |
||
| &mut self, | ||
| connection: Resource<v2::Connection>, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publishseems too general. I don't understand why using the"spin_outbound_mqtt.publish"name field would be inappropriate here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that would probably be fine. I was just going for minimal changes: "{topic} publish" -> "publish". 🤷