Skip to content

Conversation

@comandeo-mongo
Copy link
Contributor

Update OpenTelemetry attribute from db.system to db.system.name, according to OpenTelemetry semantic convention changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the MongoDB Ruby driver’s OpenTelemetry span attributes to align with the newer semantic convention key (db.system.name instead of db.system), and updates the OpenTelemetry spec test fixtures accordingly.

Changes:

  • Switch OpenTelemetry span attribute key from db.system to db.system.name in Ruby tracing code.
  • Update OpenTelemetry spec-test YAML fixtures to expect db.system.name.
  • Adjust expected operation-span names / db.operation.* values in a few OpenTelemetry YAML fixtures (findAndModify/delete/count).

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/spec_tests/data/open_telemetry/transaction/core_api.yml Updates expected db.system.name attribute in transaction tracing fixtures.
spec/spec_tests/data/open_telemetry/transaction/convenient.yml Updates expected db.system.name attribute in transaction tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/update.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/retries.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/map_reduce.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/list_indexes.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/list_databases.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/list_collections.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/insert.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/find_without_query_text.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/find_and_modify.yml Updates expected db.system.name and also changes expected operation-span naming/db.operation.*.
spec/spec_tests/data/open_telemetry/operation/find.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/drop_indexes.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/drop_collection.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/distinct.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/delete.yml Updates expected db.system.name and also changes expected operation-span naming/db.operation.*.
spec/spec_tests/data/open_telemetry/operation/create_indexes.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/create_collection.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/count.yml Updates expected db.system.name and also changes expected operation-span naming/db.operation.*.
spec/spec_tests/data/open_telemetry/operation/bulk_write.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/atlas_search.yml Updates expected db.system.name attribute in operation tracing fixtures.
spec/spec_tests/data/open_telemetry/operation/aggregate.yml Updates expected db.system.name attribute in operation tracing fixtures.
lib/mongo/tracing/open_telemetry/tracer.rb Updates transaction span attribute key to db.system.name.
lib/mongo/tracing/open_telemetry/operation_tracer.rb Updates operation span attribute key to db.system.name.
lib/mongo/tracing/open_telemetry/command_tracer.rb Updates command span attribute key to db.system.name.
Comments suppressed due to low confidence (2)

lib/mongo/tracing/open_telemetry/command_tracer.rb:144

  • This changes the attribute key from 'db.system' to 'db.system.name', but the unit specs still assert on 'db.system' (e.g. spec/mongo/tracing/open_telemetry/command_tracer_spec.rb). Update the specs accordingly, and consider whether you need to emit both keys for backwards compatibility with any existing consumers expecting 'db.system'.
        def base_attributes(message)
          {
            'db.system.name' => 'mongodb',
            'db.namespace' => database(message),
            'db.collection.name' => collection_name(message),
            'db.command.name' => command_name(message),
            'db.query.summary' => query_summary(message),
            'db.query.text' => query_text(message)
          }

lib/mongo/tracing/open_telemetry/operation_tracer.rb:141

  • Same as CommandTracer: this switches from 'db.system' to 'db.system.name', but the existing unit spec asserts on 'db.system' (spec/mongo/tracing/open_telemetry/operation_tracer_spec.rb). Update the spec and/or consider emitting both attributes to avoid breaking existing consumers.
        def span_attributes(operation, op_name)
          {
            'db.system.name' => 'mongodb',
            'db.namespace' => operation.db_name.to_s,
            'db.collection.name' => collection_name(operation),
            'db.operation.name' => operation_name(operation, op_name),
            'db.operation.summary' => operation_span_name(operation, op_name),
            'db.mongodb.cursor_id' => operation.cursor_id,
          }.compact

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jamis
jamis previously approved these changes Feb 9, 2026
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.

2 participants