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

Implement some of the stable database semantic conventions #11575

Merged

Conversation

heyams
Copy link
Contributor

@heyams heyams commented Jun 13, 2024

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Jun 13, 2024
@heyams heyams mentioned this pull request Aug 27, 2024
@heyams heyams marked this pull request as ready for review August 30, 2024 16:24
@heyams heyams requested a review from a team August 30, 2024 16:24
@heyams
Copy link
Contributor Author

heyams commented Sep 13, 2024

I will add 'error.type' and the opt-in db.query.parameter.<key> in a follow-up PR.

@heyams heyams requested a review from a team as a code owner September 30, 2024 19:22
@heyams heyams requested a review from trask October 2, 2024 17:53
@trask
Copy link
Member

trask commented Oct 17, 2024

status update, still need to:

  • add the db.client.operation.duration metric
  • add the db.query.summary attribute (requires updating the jflex sql parsing)
  • update db.operation.name and db.collection.name to only capture when there's a single one (currently they are populated as the first when there are multiple)
  • upstream db.namespace definitions to semconv repo for all of the supported instrumentations
  • API changes
    • remove DbClientCommonAttributesGetter (hopefully only need DbClientAttributesGetter)
    • change DbClientAttributesGetter generics from <REQUEST> to <REQUEST, RESPONSE> (need in order for it to extend NetworkAttributesGetter but also probably to make it more future proof because of db.response.return_rows and other future semconv)
    • make DbClientAttributesGetter extend NetworkAttributesGetter (and ServerAttributesGetter?) similar to HttpClientAttributesGetter
  • add tests for semconv opt-in for the remaining database modules
    • :instrumentation:aws-sdk:aws-sdk-22
    • :instrumentation:camel-220
    • :instrumentation:clickhouse-client-05
    • :instrumentation:elasticsearch:elasticsearch-api-client-716
    • :instrumentation:elasticsearch:elasticsearch-rest-50
    • :instrumentation:elasticsearch:elasticsearch-rest-64
    • :instrumentation:elasticsearch:elasticsearch-rest-70
    • :instrumentation:elasticsearch:elasticsearch-transport-53
    • :instrumentation:elasticsearch:elasticsearch-transport-common
    • :instrumentation:geode-14
    • :instrumentation:hibernate:hibernate-33
    • :instrumentation:hibernate:hibernate-40
    • :instrumentation:hibernate:hibernate-60
    • :instrumentation:hibernate:hibernate-60:spring-
    • :instrumentation:hibernate:hibernate-procedure-call-43
    • :instrumentation:influxdb-24
    • :instrumentation:jdbc
    • :instrumentation:jedis:jedis-14
    • :instrumentation:jedis:jedis-30
    • :instrumentation:lettuce:lettuce-40
    • :instrumentation:lettuce:lettuce-50
    • :instrumentation:lettuce:lettuce-51
    • :instrumentation:mongo:mongo-common
    • :instrumentation:opensearch:opensearch-rest-10
    • :instrumentation:r2dbc-10
    • :instrumentation:rediscala-18
    • :instrumentation:spring:spring-data:spring-data-30
    • :instrumentation:spring:spring-data:spring-data-common
    • :instrumentation:spymemcached-212
    • :instrumentation:vertx:vertx-rx-java-35
    • :smoke-tests-otel-starter:spring-boot-common
    • :smoke-tests-otel-starter:spring-boot-reactive-common

@trask trask force-pushed the heya/implement-database-stable-semconv branch from 22f2903 to 038fbec Compare October 28, 2024 02:46
@trask trask changed the title Implement stable database semantic conventions Implement some of the stable database semantic conventions Oct 28, 2024
Copy link
Contributor

@laurit laurit left a comment

Choose a reason for hiding this comment

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

I think we should merge #12292 before this one (there'll probably be conflicts) so we could use the new attributes. Idk why we stopped updating the semconv artifact.

}

@SuppressWarnings("unchecked")
public static <T> AttributeKey<T> getAttributeKey(AttributeKey<T> oldKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember which way we did this for the http but mapping from new to old might be preferable here as it reduces the need to suppress deprecation warnings when old attributes are used (after we update the semconv jars). For http this might not have been an issue because most of the http tests are in a base class so we needed to suppress the warnings only here.

Copy link
Member

Choose a reason for hiding this comment

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

we wouldn't be able to map db.collection.name since multiple attributes were consolidated into this one attribute

    map.put(DB_SQL_TABLE, DB_COLLECTION_NAME);
    map.put(DB_CASSANDRA_TABLE, DB_COLLECTION_NAME);
    map.put(DB_MONGODB_COLLECTION, DB_COLLECTION_NAME);
    map.put(DB_COSMOSDB_CONTAINER, DB_COLLECTION_NAME);

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can find ways to resolve the multiple mapping issue. This is just an idea, we can tackle this later if it seems to be worth the effort.

@trask trask merged commit 61c99cf into open-telemetry:main Oct 29, 2024
56 checks passed
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants