Skip to content

Commit e12631d

Browse files
authored
Couchbase metadata updates (#15088)
1 parent dbd47db commit e12631d

File tree

16 files changed

+271
-67
lines changed

16 files changed

+271
-67
lines changed

docs/instrumentation-list.yaml

Lines changed: 184 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2759,13 +2759,21 @@ libraries:
27592759
- name: couchbase-2.0
27602760
description: |
27612761
This instrumentation enables database client spans and database client metrics for Couchbase 2.0 operations. It automatically traces key-value operations (get, upsert, replace, remove), view queries, N1QL queries, and cluster management operations.
2762+
semantic_conventions:
2763+
- DATABASE_CLIENT_SPANS
2764+
- DATABASE_CLIENT_METRICS
27622765
library_link: https://github.com/couchbase/couchbase-java-client
27632766
source_path: instrumentation/couchbase/couchbase-2.0
27642767
scope:
27652768
name: io.opentelemetry.couchbase-2.0
27662769
target_versions:
27672770
javaagent:
27682771
- com.couchbase.client:java-client:[2,3)
2772+
configurations:
2773+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
2774+
description: Enables statement sanitization for database queries.
2775+
type: boolean
2776+
default: true
27692777
telemetry:
27702778
- when: default
27712779
spans:
@@ -2804,6 +2812,9 @@ libraries:
28042812
- name: couchbase-2.6
28052813
description: |
28062814
This instrumentation enables database client spans and database client metrics for Couchbase 2.6 operations. It automatically traces key-value operations (get, upsert, replace, remove), view queries, N1QL queries, and cluster management operations.
2815+
semantic_conventions:
2816+
- DATABASE_CLIENT_SPANS
2817+
- DATABASE_CLIENT_METRICS
28072818
library_link: https://github.com/couchbase/couchbase-java-client
28082819
source_path: instrumentation/couchbase/couchbase-2.6
28092820
scope:
@@ -2817,6 +2828,10 @@ libraries:
28172828
Enables experimental span attributes `couchbase.operation_id` and `couchbase.local.address`. Different operation types receive different experimental attributes.
28182829
type: boolean
28192830
default: false
2831+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
2832+
description: Enables statement sanitization for database queries.
2833+
type: boolean
2834+
default: true
28202835
telemetry:
28212836
- when: default
28222837
spans:
@@ -2893,33 +2908,201 @@ libraries:
28932908
- name: couchbase-3.1
28942909
description: |
28952910
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
2911+
semantic_conventions:
2912+
- DATABASE_CLIENT_SPANS
28962913
library_link: https://github.com/couchbase/couchbase-java-client
2914+
features:
2915+
- AUTO_INSTRUMENTATION_SHIM
28972916
source_path: instrumentation/couchbase/couchbase-3.1
28982917
scope:
28992918
name: io.opentelemetry.couchbase-3.1
29002919
target_versions:
29012920
javaagent:
29022921
- com.couchbase.client:java-client:[3.1,3.1.6)
2922+
telemetry:
2923+
- when: default
2924+
spans:
2925+
- span_kind: INTERNAL
2926+
attributes:
2927+
- name: db.couchbase.collection
2928+
type: STRING
2929+
- name: db.couchbase.local_id
2930+
type: STRING
2931+
- name: db.couchbase.operation_id
2932+
type: LONG
2933+
- name: db.couchbase.scope
2934+
type: STRING
2935+
- name: db.couchbase.server_duration
2936+
type: LONG
2937+
- name: db.couchbase.service
2938+
type: STRING
2939+
- name: db.name
2940+
type: STRING
2941+
- name: db.operation
2942+
type: STRING
2943+
- name: db.system
2944+
type: STRING
2945+
- name: net.host.name
2946+
type: STRING
2947+
- name: net.host.port
2948+
type: LONG
2949+
- name: net.peer.name
2950+
type: STRING
2951+
- name: net.peer.port
2952+
type: LONG
2953+
- name: net.transport
2954+
type: STRING
29032955
- name: couchbase-3.1.6
29042956
description: |
29052957
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
2958+
semantic_conventions:
2959+
- DATABASE_CLIENT_SPANS
29062960
library_link: https://github.com/couchbase/couchbase-java-client
2961+
features:
2962+
- AUTO_INSTRUMENTATION_SHIM
29072963
source_path: instrumentation/couchbase/couchbase-3.1.6
29082964
scope:
29092965
name: io.opentelemetry.couchbase-3.1.6
29102966
target_versions:
29112967
javaagent:
29122968
- com.couchbase.client:java-client:[3.1.6,3.2.0)
2969+
telemetry:
2970+
- when: default
2971+
spans:
2972+
- span_kind: INTERNAL
2973+
attributes:
2974+
- name: db.couchbase.collection
2975+
type: STRING
2976+
- name: db.couchbase.local_id
2977+
type: STRING
2978+
- name: db.couchbase.operation_id
2979+
type: LONG
2980+
- name: db.couchbase.retries
2981+
type: LONG
2982+
- name: db.couchbase.scope
2983+
type: STRING
2984+
- name: db.couchbase.server_duration
2985+
type: LONG
2986+
- name: db.couchbase.service
2987+
type: STRING
2988+
- name: db.name
2989+
type: STRING
2990+
- name: db.operation
2991+
type: STRING
2992+
- name: db.system
2993+
type: STRING
2994+
- name: net.host.name
2995+
type: STRING
2996+
- name: net.host.port
2997+
type: LONG
2998+
- name: net.peer.name
2999+
type: STRING
3000+
- name: net.peer.port
3001+
type: LONG
3002+
- name: net.transport
3003+
type: STRING
29133004
- name: couchbase-3.2
29143005
description: |
29153006
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
3007+
semantic_conventions:
3008+
- DATABASE_CLIENT_SPANS
29163009
library_link: https://github.com/couchbase/couchbase-java-client
3010+
features:
3011+
- AUTO_INSTRUMENTATION_SHIM
29173012
source_path: instrumentation/couchbase/couchbase-3.2
29183013
scope:
29193014
name: io.opentelemetry.couchbase-3.2
29203015
target_versions:
29213016
javaagent:
2922-
- com.couchbase.client:java-client:[3.2.0,)
3017+
- com.couchbase.client:java-client:[3.2.0,3.4.0)
3018+
telemetry:
3019+
- when: default
3020+
spans:
3021+
- span_kind: INTERNAL
3022+
attributes:
3023+
- name: db.couchbase.collection
3024+
type: STRING
3025+
- name: db.couchbase.document_id
3026+
type: STRING
3027+
- name: db.couchbase.local_id
3028+
type: STRING
3029+
- name: db.couchbase.operation_id
3030+
type: LONG
3031+
- name: db.couchbase.retries
3032+
type: LONG
3033+
- name: db.couchbase.scope
3034+
type: STRING
3035+
- name: db.couchbase.server_duration
3036+
type: LONG
3037+
- name: db.couchbase.service
3038+
type: STRING
3039+
- name: db.name
3040+
type: STRING
3041+
- name: db.operation
3042+
type: STRING
3043+
- name: db.system
3044+
type: STRING
3045+
- name: net.host.name
3046+
type: STRING
3047+
- name: net.host.port
3048+
type: LONG
3049+
- name: net.peer.name
3050+
type: STRING
3051+
- name: net.peer.port
3052+
type: LONG
3053+
- name: net.transport
3054+
type: STRING
3055+
- name: couchbase-3.4
3056+
description: |
3057+
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
3058+
semantic_conventions:
3059+
- DATABASE_CLIENT_SPANS
3060+
library_link: https://github.com/couchbase/couchbase-java-client
3061+
features:
3062+
- AUTO_INSTRUMENTATION_SHIM
3063+
source_path: instrumentation/couchbase/couchbase-3.4
3064+
scope:
3065+
name: io.opentelemetry.couchbase-3.4
3066+
target_versions:
3067+
javaagent:
3068+
- com.couchbase.client:java-client:[3.4.0,)
3069+
telemetry:
3070+
- when: default
3071+
spans:
3072+
- span_kind: CLIENT
3073+
attributes:
3074+
- name: db.couchbase.collection
3075+
type: STRING
3076+
- name: db.couchbase.document_id
3077+
type: STRING
3078+
- name: db.couchbase.local_id
3079+
type: STRING
3080+
- name: db.couchbase.operation_id
3081+
type: LONG
3082+
- name: db.couchbase.retries
3083+
type: LONG
3084+
- name: db.couchbase.scope
3085+
type: STRING
3086+
- name: db.couchbase.server_duration
3087+
type: LONG
3088+
- name: db.couchbase.service
3089+
type: STRING
3090+
- name: db.name
3091+
type: STRING
3092+
- name: db.operation
3093+
type: STRING
3094+
- name: db.system
3095+
type: STRING
3096+
- name: net.host.name
3097+
type: STRING
3098+
- name: net.host.port
3099+
type: LONG
3100+
- name: net.peer.name
3101+
type: STRING
3102+
- name: net.peer.port
3103+
type: LONG
3104+
- name: net.transport
3105+
type: STRING
29233106
dropwizard:
29243107
- name: dropwizard-metrics-4.0
29253108
description: |

instrumentation-docs/instrumentations.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ readonly INSTRUMENTATIONS=(
5252
"couchbase:couchbase-2.6:javaagent:test"
5353
"couchbase:couchbase-2.6:javaagent:testExperimental"
5454
"couchbase:couchbase-2.6:javaagent:testStableSemconv"
55+
"couchbase:couchbase-3.1:javaagent:test"
56+
"couchbase:couchbase-3.1.6:javaagent:test"
57+
"couchbase:couchbase-3.2:javaagent:test"
58+
"couchbase:couchbase-3.4:javaagent:test"
5559
"dropwizard:dropwizard-views-0.7:javaagent:test"
5660
"elasticsearch:elasticsearch-api-client-7.16:javaagent:test"
5761
"elasticsearch:elasticsearch-api-client-7.16:javaagent:testStableSemconv"

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/TelemetryParser.java

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,56 @@
55

66
package io.opentelemetry.instrumentation.docs.parsers;
77

8+
import static java.util.Collections.emptySet;
9+
import static java.util.Collections.singleton;
10+
import static java.util.Map.entry;
11+
812
import java.util.Map;
913
import java.util.Set;
1014

1115
class TelemetryParser {
1216

1317
// Key is the scope of the module being analyzed, value is a set of additional allowed scopes.
14-
private static final Map<String, Set<String>> scopeAllowList =
15-
Map.of(
16-
// armeria-grpc uses grpc-1.6 instrumenter.
17-
"io.opentelemetry.armeria-grpc-1.14", Set.of("io.opentelemetry.grpc-1.6"),
18-
// couchbase-2.6 extends couchbase-2.0 instrumentation with more attributes.
19-
"io.opentelemetry.couchbase-2.6", Set.of("io.opentelemetry.couchbase-2.0"),
20-
// elasticsearch-rest-7.0 extends elasticsearch-api-client-7.16 with more attributes.
21-
"io.opentelemetry.elasticsearch-api-client-7.16",
22-
Set.of("io.opentelemetry.elasticsearch-rest-7.0"),
23-
// jaxrs instrumentations add attributes to the jaxrs-2.0-annotations scope.
24-
"io.opentelemetry.jaxrs-2.0-cxf-3.2", Set.of("io.opentelemetry.jaxrs-2.0-annotations"),
25-
"io.opentelemetry.jaxrs-2.0-jersey-2.0", Set.of("io.opentelemetry.jaxrs-2.0-annotations"),
26-
"io.opentelemetry.jaxrs-2.0-resteasy-3.0",
27-
Set.of("io.opentelemetry.jaxrs-2.0-annotations"),
28-
"io.opentelemetry.jaxrs-2.0-resteasy-3.1",
29-
Set.of("io.opentelemetry.jaxrs-2.0-annotations"),
30-
"io.opentelemetry.jaxrs-3.0-jersey-3.0", Set.of("io.opentelemetry.jaxrs-3.0-annotations"),
31-
"io.opentelemetry.jaxrs-3.0-resteasy-6.0",
32-
Set.of("io.opentelemetry.jaxrs-3.0-annotations"));
18+
private static final Map<String, Set<String>> scopeAllowList;
19+
20+
static {
21+
scopeAllowList =
22+
Map.ofEntries(
23+
// armeria-grpc uses grpc-1.6 instrumenter.
24+
entry("io.opentelemetry.armeria-grpc-1.14", singleton("io.opentelemetry.grpc-1.6")),
25+
// couchbase-2.6 extends couchbase-2.0 instrumentation with more attributes.
26+
entry("io.opentelemetry.couchbase-2.6", singleton("io.opentelemetry.couchbase-2.0")),
27+
// elasticsearch-rest-7.0 extends elasticsearch-api-client-7.16 with more attributes.
28+
entry(
29+
"io.opentelemetry.elasticsearch-api-client-7.16",
30+
singleton("io.opentelemetry.elasticsearch-rest-7.0")),
31+
// jaxrs instrumentations add attributes to the jaxrs-2.0-annotations scope.
32+
entry(
33+
"io.opentelemetry.jaxrs-2.0-cxf-3.2",
34+
singleton("io.opentelemetry.jaxrs-2.0-annotations")),
35+
entry(
36+
"io.opentelemetry.jaxrs-2.0-jersey-2.0",
37+
singleton("io.opentelemetry.jaxrs-2.0-annotations")),
38+
entry(
39+
"io.opentelemetry.jaxrs-2.0-resteasy-3.0",
40+
singleton("io.opentelemetry.jaxrs-2.0-annotations")),
41+
entry(
42+
"io.opentelemetry.jaxrs-2.0-resteasy-3.1",
43+
singleton("io.opentelemetry.jaxrs-2.0-annotations")),
44+
entry(
45+
"io.opentelemetry.jaxrs-3.0-jersey-3.0",
46+
singleton("io.opentelemetry.jaxrs-3.0-annotations")),
47+
entry(
48+
"io.opentelemetry.jaxrs-3.0-resteasy-6.0",
49+
singleton("io.opentelemetry.jaxrs-3.0-annotations")),
50+
// couchbase-3.x instrumentations are auto-instrumentation shims
51+
entry(
52+
"io.opentelemetry.couchbase-3.1",
53+
singleton("io.opentelemetry.javaagent.couchbase-3.1")),
54+
entry("io.opentelemetry.couchbase-3.1.6", singleton("com.couchbase.client.jvm")),
55+
entry("io.opentelemetry.couchbase-3.2", singleton("com.couchbase.client.jvm")),
56+
entry("io.opentelemetry.couchbase-3.4", singleton("com.couchbase.client.jvm")));
57+
}
3358

3459
/**
3560
* Checks if the given telemetry scope is valid for the specified module scope.
@@ -45,7 +70,7 @@ class TelemetryParser {
4570
*/
4671
static boolean scopeIsValid(String telemetryScope, String moduleScope) {
4772
return telemetryScope.equals(moduleScope)
48-
|| scopeAllowList.getOrDefault(moduleScope, Set.of()).contains(telemetryScope);
73+
|| scopeAllowList.getOrDefault(moduleScope, emptySet()).contains(telemetryScope);
4974
}
5075

5176
private TelemetryParser() {}

instrumentation/couchbase/couchbase-2.0/metadata.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@ description: >
22
This instrumentation enables database client spans and database client metrics for Couchbase 2.0
33
operations. It automatically traces key-value operations (get, upsert, replace, remove), view
44
queries, N1QL queries, and cluster management operations.
5+
semantic_conventions:
6+
- DATABASE_CLIENT_SPANS
7+
- DATABASE_CLIENT_METRICS
58
library_link: https://github.com/couchbase/couchbase-java-client
9+
configurations:
10+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
11+
description: Enables statement sanitization for database queries.
12+
type: boolean
13+
default: true

instrumentation/couchbase/couchbase-2.6/metadata.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ description: >
22
This instrumentation enables database client spans and database client metrics for Couchbase 2.6
33
operations. It automatically traces key-value operations (get, upsert, replace, remove), view
44
queries, N1QL queries, and cluster management operations.
5+
semantic_conventions:
6+
- DATABASE_CLIENT_SPANS
7+
- DATABASE_CLIENT_METRICS
58
library_link: https://github.com/couchbase/couchbase-java-client
69
configurations:
710
- name: otel.instrumentation.couchbase.experimental-span-attributes
@@ -10,3 +13,7 @@ configurations:
1013
Different operation types receive different experimental attributes.
1114
type: boolean
1215
default: false
16+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
17+
description: Enables statement sanitization for database queries.
18+
type: boolean
19+
default: true

instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ dependencies {
4646
tasks {
4747
withType<Test>().configureEach {
4848
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
49-
}
50-
51-
val testStableSemconv by registering(Test::class) {
52-
testClassesDirs = sourceSets.test.get().output.classesDirs
53-
classpath = sourceSets.test.get().runtimeClasspath
54-
55-
jvmArgs("-Dotel.semconv-stability.opt-in=database")
56-
}
57-
58-
check {
59-
dependsOn(testStableSemconv)
49+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
6050
}
6151
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
description: >
22
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation
33
automatically configures the instrumentation provided by the Couchbase library.
4+
semantic_conventions:
5+
- DATABASE_CLIENT_SPANS
46
library_link: https://github.com/couchbase/couchbase-java-client
7+
features:
8+
- AUTO_INSTRUMENTATION_SHIM

0 commit comments

Comments
 (0)