Skip to content
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

MySql.Data - natively supported by library #2836

Merged
merged 2 commits into from
Aug 14, 2023

Conversation

Kielek
Copy link
Contributor

@Kielek Kielek commented Aug 14, 2023

Why

Fixes #2542
Supersedes: #2686
Traces are natively supported by MySql.Data 8.1.0+

What

Dropped reference to OpenTelemetry.Instrumentation.MySqlData..
Drop bytecode instrumentation for couple versions of MySql.Data.
Support native instrumentation for MySql.Data 8.1.0+.

It is last good moment to drop support for old versions as we are still in pre-GA mode.

Tests

CI + manual verification.

Spans from our testing assembly.

  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "rsi9qPIsxU4=", "parentSpanId": "fX8Z9KbMbbA=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568358528800", "endTimeUnixNano": "1692003568480060900", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SELECT @@max_allowed_packet, @@character_set_client, \n        @@character_set_connection, @@license, @@sql_mode, @@lower_case_table_names, @@autocommit;" } }, { "key": "thread.id", "value": { "intValue": "9" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "T4PGcAPH0Do=", "parentSpanId": "fX8Z9KbMbbA=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568493827600", "endTimeUnixNano": "1692003568520438800", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP())" } }, { "key": "thread.id", "value": { "intValue": "9" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "Dlxz2gsT24U=", "parentSpanId": "fX8Z9KbMbbA=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568529934000", "endTimeUnixNano": "1692003568547432200", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SHOW COLLATION" } }, { "key": "thread.id", "value": { "intValue": "12" } }, { "key": "thread.name", "value": { "stringValue": ".NET ThreadPool Worker" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "W7zR1mJCiZw=", "parentSpanId": "fX8Z9KbMbbA=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568554957700", "endTimeUnixNano": "1692003568561390500", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SET NAMES utf8mb4" } }, { "key": "thread.id", "value": { "intValue": "9" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "tWZB0VQ8ubk=", "parentSpanId": "fX8Z9KbMbbA=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568565478100", "endTimeUnixNano": "1692003568570570900", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SET character_set_results=NULL" } }, { "key": "thread.id", "value": { "intValue": "9" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "85728DPuaIjfcE4vBM3DHA==", "spanId": "KC7eEihzLwE=", "name": "SQL Statement", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003568586073800", "endTimeUnixNano": "1692003568592915700", "attributes": [ { "key": "db.system", "value": { "stringValue": "mysql" } }, { "key": "db.name", "value": { "stringValue": "" } }, { "key": "db.user", "value": { "stringValue": "root" } }, { "key": "db.statement", "value": { "stringValue": "SELECT 123;" } }, { "key": "thread.id", "value": { "intValue": "9" } } ], "status": { "code": "STATUS_CODE_OK" } }"
  + "InstrumentationScopeName = connector-net, Span = { "traceId": "JgX/gm5iJPSL47GzVkeSUA==", "spanId": "fX8Z9KbMbbA=", "name": "Connection (pooled)", "kind": "SPAN_KIND_CLIENT", "startTimeUnixNano": "1692003567919962400", "endTimeUnixNano": "1692003568597012900", "attributes": [ { "key": "net.transport", "value": { "stringValue": "Socket" } }, { "key": "db.connection_string", "value": { "stringValue": "server=127.0.0.1;port=62329;user id=root" } }, { "key": "net.peer.port", "value": { "intValue": "62329" } } ], "status": { "code": "STATUS_CODE_OK" } }"

Checklist

  • CHANGELOG.md is updated.
  • Documentation is updated.
  • New features are covered by tests.

@github-actions github-actions bot requested a review from theletterf August 14, 2023 09:49
@Kielek Kielek marked this pull request as ready for review August 14, 2023 12:22
@Kielek Kielek requested a review from a team August 14, 2023 12:22
Copy link
Member

@nrcventura nrcventura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, and is better than relying on bytecode instrumentation that we need to keep updated (especially as the semantic conventions stabilize). With the native instrumentation, do we think that .net framework will be available too?

Copy link
Contributor

@pjanotti pjanotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/CommonExcludedAssets.props Show resolved Hide resolved
Copy link
Contributor

@zacharycmontoya zacharycmontoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is a great solution

@pjanotti pjanotti enabled auto-merge (squash) August 14, 2023 17:41
@pjanotti pjanotti merged commit e312446 into open-telemetry:main Aug 14, 2023
@Kielek Kielek deleted the mysql.data-native-support branch August 14, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite MySql.Data instrumentation to bytecode instrumenation
5 participants