feat!: Separate logical MySQL host from connected host#487
feat!: Separate logical MySQL host from connected host#487arielvalentin merged 8 commits intoopen-telemetry:mainfrom
Conversation
MySQL server instances have a logical host name and an instance node names. This is particularly useful when running in clustered mode where a logical hostname is used to connect to a cluster but you also want to record what specific node is executing your query. Trilogy exposes the instance node name via `@connected_host` as well as the configured `host` name in its `connection_options`. This breaking change ensures that the `net.peer.name` is always set to the logical host name, while the individual instance name is being recorded in a separate attribute.
|
|
||
| attributes[::OpenTelemetry::SemanticConventions::Trace::DB_NAME] = database_name if database_name | ||
| attributes[::OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] unless config[:peer_service].nil? | ||
| attributes['db.mysql.instance.host.name'] = @connected_host if defined?(@connected_host) |
There was a problem hiding this comment.
I have no idea what this be named and I am struggling here.
What do you think @adrianna-chang-shopify @cschleiden ?
There was a problem hiding this comment.
cc: @open-telemetry/specs-semconv-approvers I could use some of your input/feedback here as well.
There was a problem hiding this comment.
I see https://github.com/open-telemetry/opentelemetry-ruby/blob/main/semantic_conventions/lib/opentelemetry/semantic_conventions/trace.rb#L71 for something similar for MSSQL
looking at open-telemetry/opentelemetry-specification#3402, maybe
db.mysql.instance.address or db.mysql.address? But db.mysql.instance.host.name would also work for me
cschleiden
left a comment
There was a problem hiding this comment.
Thanks for this change!
|
|
||
| attributes[::OpenTelemetry::SemanticConventions::Trace::DB_NAME] = database_name if database_name | ||
| attributes[::OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] unless config[:peer_service].nil? | ||
| attributes['db.mysql.instance.host.name'] = @connected_host if defined?(@connected_host) |
There was a problem hiding this comment.
I see https://github.com/open-telemetry/opentelemetry-ruby/blob/main/semantic_conventions/lib/opentelemetry/semantic_conventions/trace.rb#L71 for something similar for MSSQL
looking at open-telemetry/opentelemetry-specification#3402, maybe
db.mysql.instance.address or db.mysql.address? But db.mysql.instance.host.name would also work for me
…ogy/patches/client.rb Co-authored-by: Christopher Schleiden <[email protected]>
ericmustin
left a comment
There was a problem hiding this comment.
lgtm, may wanna confirm with known users of the instrumentation (cc @adrianna-chang-shopify ) that this works for them.
|
ah @arielvalentin looks like a couple typos, my apols on the early approval, that aside this lgtm |
plantfansam
left a comment
There was a problem hiding this comment.
Love this! As a trilogy instrumentation user, we can handle the churn in attr name 😄.
At GitHub we run MySQL in multi-node clusters and are often interested in knowing the hostname of a node that is executing a query or command. In order to acheive this we added an attribute to the Trilogy instrumentation named `db.mysql.instance.address` which is populated with the hostname of the node: <open-telemetry/opentelemetry-ruby-contrib#487> This change adds the attribute to the database model as a MySQL specific connection attribute.
At GitHub we run MySQL in multi-node clusters and are often interested in knowing the hostname of a node that is executing a query or command. In order to acheive this we added an attribute to the Trilogy instrumentation named `db.mysql.instance.address` which is populated with the hostname of the node: <open-telemetry/opentelemetry-ruby-contrib#487> This change adds the attribute to the database model as a MySQL specific connection attribute.
At GitHub we run MySQL in multi-node clusters and are often interested in knowing the hostname of a node that is executing a query or command. In order to acheive this we added an attribute to the Trilogy instrumentation named `db.mysql.instance.address` which is populated with the hostname of the node: <open-telemetry/opentelemetry-ruby-contrib#487> This change adds the attribute to the database model as a MySQL specific connection attribute.
At GitHub we run MySQL in multi-node clusters and are often interested in knowing the hostname of a node that is executing a query or command. In order to acheive this we added an attribute to the Trilogy instrumentation named `db.mysql.instance.address` which is populated with the hostname of the node: <open-telemetry/opentelemetry-ruby-contrib#487> This change adds the attribute to the database model as a MySQL specific connection attribute.
MySQL server instances have a logical host name and an instance node names.
This is particularly useful when running in clustered mode where a logical hostname is used to connect to a cluster but you also want to record what specific node is executing your query.
Trilogy exposes the instance node name via
@connected_hostas well as the configuredhostname in itsconnection_options.This breaking change ensures that the
net.peer.nameis always set to the logical host name, while the individual instance name is being recorded in a separate attribute.cc: @cschleiden