Skip to content

Commit cf4401f

Browse files
committed
Rename db-statement-sanitizer property to db.query-sanitization
1 parent 558d563 commit cf4401f

44 files changed

Lines changed: 397 additions & 212 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@
88
and deprecated config key `otel.instrumentation.graphql.add-operation-name-to-span-name.enabled`
99
in favor of `setQuerySanitizationEnabled()`, `setOperationNameInSpanNameEnabled()`, and
1010
`otel.instrumentation.graphql.operation-name-in-span-name.enabled`
11-
- Deprecated the declarative config name `statement_sanitizer` in favor of `query_sanitization`
11+
- Deprecated the DB query sanitization system property names
12+
`otel.instrumentation.common.db-statement-sanitizer.enabled`,
13+
`otel.instrumentation.jdbc.statement-sanitizer.enabled`,
14+
`otel.instrumentation.mongo.statement-sanitizer.enabled`, and
15+
`otel.instrumentation.r2dbc.statement-sanitizer.enabled` in favor of the corresponding
16+
`*.query-sanitization.enabled` names, and deprecated the declarative config name
17+
`statement_sanitizer` in favor of `query_sanitization`
1218
- Deprecated the declarative config group `common.database` in favor of `common.db`
13-
- Deprecated the GraphQL declarative config name `query_sanitizer` in favor of
19+
- Deprecated the GraphQL system property name
20+
`otel.instrumentation.graphql.query-sanitizer.enabled` and declarative config name
21+
`query_sanitizer` in favor of `otel.instrumentation.graphql.query-sanitization.enabled` and
1422
`query_sanitization`
1523

1624
## Version 2.26.1 (2026-03-23)

declarative-config-bridge/src/main/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigProperties.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,8 @@ public final class ConfigPropertiesBackedDeclarativeConfigProperties
6464
"java.common.http.server.emit_experimental_telemetry/development",
6565
"otel.instrumentation.http.server.emit-experimental-telemetry");
6666
SPECIAL_MAPPINGS.put(
67-
"java.common.db.query_sanitization.enabled",
67+
"java.common.database.statement_sanitizer.enabled",
6868
"otel.instrumentation.common.db-statement-sanitizer.enabled");
69-
SPECIAL_MAPPINGS.put(
70-
"java.graphql.query_sanitization.enabled",
71-
"otel.instrumentation.graphql.query-sanitizer.enabled");
7269
SPECIAL_MAPPINGS.put(
7370
"java.common.db.sqlcommenter/development.enabled",
7471
"otel.instrumentation.common.experimental.db-sqlcommenter.enabled");

declarative-config-bridge/src/test/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,78 @@ void testGeneralHttpListMapping() {
100100
}
101101

102102
@Test
103-
void testQuerySanitizationMapping() {
103+
void testCommonDbQuerySanitizationMapping() {
104+
DeclarativeConfigProperties config =
105+
createConfig("otel.instrumentation.common.db.query-sanitization.enabled", "false");
106+
107+
assertThat(
108+
config
109+
.getStructured("java")
110+
.getStructured("common")
111+
.getStructured("db")
112+
.getStructured("query_sanitization")
113+
.getBoolean("enabled"))
114+
.isFalse();
115+
}
116+
117+
@Test
118+
void testDeprecatedCommonDbStatementSanitizerMapping() {
104119
DeclarativeConfigProperties config =
105120
createConfig("otel.instrumentation.common.db-statement-sanitizer.enabled", "false");
106121

122+
assertThat(
123+
config
124+
.getStructured("java")
125+
.getStructured("common")
126+
.getStructured("database")
127+
.getStructured("statement_sanitizer")
128+
.getBoolean("enabled"))
129+
.isFalse();
107130
assertThat(
108131
config
109132
.getStructured("java")
110133
.getStructured("common")
111134
.getStructured("db")
112135
.getStructured("query_sanitization")
113136
.getBoolean("enabled"))
137+
.isNull();
138+
}
139+
140+
@Test
141+
void testGraphqlQuerySanitizationMapping() {
142+
DeclarativeConfigProperties config =
143+
createConfig("otel.instrumentation.graphql.query-sanitization.enabled", "false");
144+
145+
assertThat(
146+
config
147+
.getStructured("java")
148+
.getStructured("graphql")
149+
.getStructured("query_sanitization")
150+
.getBoolean("enabled"))
114151
.isFalse();
115152
}
116153

154+
@Test
155+
void testDeprecatedGraphqlQuerySanitizerMapping() {
156+
DeclarativeConfigProperties config =
157+
createConfig("otel.instrumentation.graphql.query-sanitizer.enabled", "false");
158+
159+
assertThat(
160+
config
161+
.getStructured("java")
162+
.getStructured("graphql")
163+
.getStructured("query_sanitizer")
164+
.getBoolean("enabled"))
165+
.isFalse();
166+
assertThat(
167+
config
168+
.getStructured("java")
169+
.getStructured("graphql")
170+
.getStructured("query_sanitization")
171+
.getBoolean("enabled"))
172+
.isNull();
173+
}
174+
117175
@Test
118176
void testJavaCommonServicePeerMapping() {
119177
DeclarativeConfigProperties config =

docs/contributing/documenting-instrumentation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ disabled_by_default: true
9494
classification: library
9595
library_link: https://github.com/...
9696
configurations:
97-
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
98-
description: Enables statement sanitization for database queries.
97+
- name: otel.instrumentation.common.db.query-sanitization.enabled
98+
description: Enables query sanitization for database queries.
9999
type: boolean
100100
default: true
101101
override_telemetry: false
@@ -221,7 +221,7 @@ If an instrumentation module has configuration options, they should be documente
221221

222222
Each configuration should include:
223223

224-
* `name`: The full configuration property name, for example `otel.instrumentation.common.db-statement-sanitizer.enabled`.
224+
* `name`: The full configuration property name, for example `otel.instrumentation.common.db.query-sanitization.enabled`.
225225
* `description`: A brief description of what the configuration does.
226226
* `type`: The data type of the configuration value. Supported types are: `boolean`, `string`, `list`, and `map`.
227227
* `default`: The default value for the configuration.

0 commit comments

Comments
 (0)