-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat!: Separate logical MySQL host from connected host #487
feat!: Separate logical MySQL host from connected host #487
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @open-telemetry/specs-semconv-approvers I could use some of your input/feedback here as well.
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.
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
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.
Nice find!
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.
cc: @andyedison
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
instrumentation/trilogy/lib/opentelemetry/instrumentation/trilogy/patches/client.rb
Outdated
Show resolved
Hide resolved
…ogy/patches/client.rb Co-authored-by: Christopher Schleiden <cschleiden@live.de>
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.
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 |
instrumentation/trilogy/test/opentelemetry/instrumentation/trilogy/instrumentation_test.rb
Outdated
Show resolved
Hide resolved
instrumentation/trilogy/test/opentelemetry/instrumentation/trilogy/instrumentation_test.rb
Outdated
Show resolved
Hide resolved
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.
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_host
as well as the configuredhost
name in itsconnection_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.cc: @cschleiden