Skip to content

Commit 109d6e9

Browse files
committed
script groovy
1 parent 66592be commit 109d6e9

File tree

5 files changed

+71
-73
lines changed

5 files changed

+71
-73
lines changed

instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.instrumentation.awssdk.v2_2
77

8+
import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable;
89
import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil
910
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
1011
import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes
@@ -150,7 +151,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
150151
"$AwsIncubatingAttributes.AWS_REQUEST_ID" "$requestId"
151152
"aws.table.name" "sometable"
152153
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
153-
"$DbIncubatingAttributes.DB_OPERATION" "CreateTable"
154+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "CreateTable"
154155
"aws.dynamodb.global_secondary_indexes" "[{\"IndexName\":\"globalIndex\",\"KeySchema\":[{\"AttributeName\":\"attribute\"}],\"ProvisionedThroughput\":{\"ReadCapacityUnits\":10,\"WriteCapacityUnits\":12}},{\"IndexName\":\"globalIndexSecondary\",\"KeySchema\":[{\"AttributeName\":\"attributeSecondary\"}],\"ProvisionedThroughput\":{\"ReadCapacityUnits\":7,\"WriteCapacityUnits\":8}}]"
155156
"aws.dynamodb.provisioned_throughput.read_capacity_units" "1"
156157
"aws.dynamodb.provisioned_throughput.write_capacity_units" "1"
@@ -183,7 +184,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
183184
"$AwsIncubatingAttributes.AWS_REQUEST_ID" "$requestId"
184185
"aws.table.name" "sometable"
185186
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
186-
"$DbIncubatingAttributes.DB_OPERATION" "Query"
187+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "Query"
187188
"aws.dynamodb.limit" "10"
188189
"aws.dynamodb.select" "ALL_ATTRIBUTES"
189190
}
@@ -215,7 +216,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
215216
"$AwsIncubatingAttributes.AWS_REQUEST_ID" "$requestId"
216217
"aws.table.name" "sometable"
217218
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
218-
"$DbIncubatingAttributes.DB_OPERATION" "${operation}"
219+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "${operation}"
219220
}
220221
}
221222
}

instrumentation/hibernate/hibernate-6.0/spring-testing/src/test/groovy/SpringJpaTest.groovy

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
78
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes
89
import org.hibernate.Version
@@ -14,6 +15,7 @@ import spring.jpa.PersistenceConfig
1415

1516
import static io.opentelemetry.api.trace.SpanKind.CLIENT
1617
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
18+
import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable
1719

1820
class SpringJpaTest extends AgentInstrumentationSpecification {
1921

@@ -62,12 +64,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
6264
childOf span(1)
6365
attributes {
6466
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
65-
"$DbIncubatingAttributes.DB_NAME" "test"
67+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
6668
"$DbIncubatingAttributes.DB_USER" "sa"
6769
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
68-
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName(.*)from Customer(.*)/
69-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
70-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
70+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName(.*)from Customer(.*)/
71+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
72+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
7173
}
7274
}
7375
span(3) {
@@ -118,11 +120,11 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
118120
childOf span(1)
119121
attributes {
120122
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
121-
"$DbIncubatingAttributes.DB_NAME" "test"
123+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
122124
"$DbIncubatingAttributes.DB_USER" "sa"
123-
"$DbIncubatingAttributes.DB_STATEMENT" "call next value for Customer_SEQ"
125+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" "call next value for Customer_SEQ"
124126
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
125-
"$DbIncubatingAttributes.DB_OPERATION" "CALL"
127+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "CALL"
126128
}
127129
}
128130
span(3) {
@@ -139,12 +141,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
139141
childOf span(3)
140142
attributes {
141143
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
142-
"$DbIncubatingAttributes.DB_NAME" "test"
144+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
143145
"$DbIncubatingAttributes.DB_USER" "sa"
144146
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
145-
"$DbIncubatingAttributes.DB_STATEMENT" ~/insert into Customer \(.*\) values \(.*\)/
146-
"$DbIncubatingAttributes.DB_OPERATION" "INSERT"
147-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
147+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/insert into Customer \(.*\) values \(.*\)/
148+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "INSERT"
149+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
148150
}
149151
}
150152
} else {
@@ -154,12 +156,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
154156
childOf span(1)
155157
attributes {
156158
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
157-
"$DbIncubatingAttributes.DB_NAME" "test"
159+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
158160
"$DbIncubatingAttributes.DB_USER" "sa"
159161
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
160-
"$DbIncubatingAttributes.DB_STATEMENT" ~/insert into Customer \(.*\) values \(.*\)/
161-
"$DbIncubatingAttributes.DB_OPERATION" "INSERT"
162-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
162+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/insert into Customer \(.*\) values \(.*\)/
163+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "INSERT"
164+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
163165
}
164166
}
165167
span(3) {
@@ -209,12 +211,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
209211
kind CLIENT
210212
attributes {
211213
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
212-
"$DbIncubatingAttributes.DB_NAME" "test"
214+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
213215
"$DbIncubatingAttributes.DB_USER" "sa"
214216
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
215-
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
216-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
217-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
217+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
218+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
219+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
218220
}
219221
}
220222
span(3) {
@@ -230,12 +232,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
230232
kind CLIENT
231233
attributes {
232234
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
233-
"$DbIncubatingAttributes.DB_NAME" "test"
235+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
234236
"$DbIncubatingAttributes.DB_USER" "sa"
235237
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
236-
"$DbIncubatingAttributes.DB_STATEMENT" ~/update Customer set firstName=\?,(.*)lastName=\? where id=\?/
237-
"$DbIncubatingAttributes.DB_OPERATION" "UPDATE"
238-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
238+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/update Customer set firstName=\?,(.*)lastName=\? where id=\?/
239+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "UPDATE"
240+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
239241
}
240242
}
241243
}
@@ -273,12 +275,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
273275
childOf span(1)
274276
attributes {
275277
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
276-
"$DbIncubatingAttributes.DB_NAME" "test"
278+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
277279
"$DbIncubatingAttributes.DB_USER" "sa"
278280
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
279-
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)(where ([^.]+)\.lastName( ?)=( ?)\?|)/
280-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
281-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
281+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)(where ([^.]+)\.lastName( ?)=( ?)\?|)/
282+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
283+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
282284
}
283285
}
284286
}
@@ -317,12 +319,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
317319
childOf span(1)
318320
attributes {
319321
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
320-
"$DbIncubatingAttributes.DB_NAME" "test"
322+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
321323
"$DbIncubatingAttributes.DB_USER" "sa"
322324
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
323-
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
324-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
325-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
325+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
326+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
327+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
326328
}
327329
}
328330
}
@@ -342,12 +344,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
342344
childOf span(1)
343345
attributes {
344346
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
345-
"$DbIncubatingAttributes.DB_NAME" "test"
347+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
346348
"$DbIncubatingAttributes.DB_USER" "sa"
347349
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
348-
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
349-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
350-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
350+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
351+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
352+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
351353
}
352354
}
353355
}
@@ -372,12 +374,12 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
372374
kind CLIENT
373375
attributes {
374376
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
375-
"$DbIncubatingAttributes.DB_NAME" "test"
377+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
376378
"$DbIncubatingAttributes.DB_USER" "sa"
377379
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
378-
"$DbIncubatingAttributes.DB_STATEMENT" "delete from Customer where id=?"
379-
"$DbIncubatingAttributes.DB_OPERATION" "DELETE"
380-
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
380+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" "delete from Customer where id=?"
381+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "DELETE"
382+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "Customer"
381383
}
382384
}
383385
}

instrumentation/rediscala-1.8/javaagent/src/test/groovy/RediscalaClientTest.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable;
67
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
78
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes
89
import org.testcontainers.containers.GenericContainer
@@ -91,7 +92,7 @@ class RediscalaClientTest extends AgentInstrumentationSpecification {
9192
kind CLIENT
9293
attributes {
9394
"$DbIncubatingAttributes.DB_SYSTEM" "redis"
94-
"$DbIncubatingAttributes.DB_OPERATION" "SET"
95+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SET"
9596
}
9697
}
9798
}
@@ -126,7 +127,7 @@ class RediscalaClientTest extends AgentInstrumentationSpecification {
126127
childOf span(0)
127128
attributes {
128129
"$DbIncubatingAttributes.DB_SYSTEM" "redis"
129-
"$DbIncubatingAttributes.DB_OPERATION" "SET"
130+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SET"
130131
}
131132
}
132133
span(2) {
@@ -135,7 +136,7 @@ class RediscalaClientTest extends AgentInstrumentationSpecification {
135136
childOf span(0)
136137
attributes {
137138
"$DbIncubatingAttributes.DB_SYSTEM" "redis"
138-
"$DbIncubatingAttributes.DB_OPERATION" "GET"
139+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "GET"
139140
}
140141
}
141142
}

instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/VertxReactivePropagationTest.groovy

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
67
import io.opentelemetry.api.GlobalOpenTelemetry
78
import io.opentelemetry.api.trace.Span
89
import io.opentelemetry.api.trace.SpanKind
910
import io.opentelemetry.context.Context
1011
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
1112
import io.opentelemetry.instrumentation.test.utils.PortUtils
13+
import io.opentelemetry.semconv.*
1214
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes
13-
import io.opentelemetry.semconv.ServerAttributes
14-
import io.opentelemetry.semconv.ClientAttributes
15-
import io.opentelemetry.semconv.UserAgentAttributes
16-
import io.opentelemetry.semconv.HttpAttributes
17-
import io.opentelemetry.semconv.NetworkAttributes
18-
import io.opentelemetry.semconv.UrlAttributes
1915
import io.opentelemetry.testing.internal.armeria.client.WebClient
2016
import io.opentelemetry.testing.internal.armeria.common.HttpRequest
2117
import io.opentelemetry.testing.internal.armeria.common.HttpRequestBuilder
@@ -29,6 +25,7 @@ import static VertxReactiveWebServer.TEST_REQUEST_ID_ATTRIBUTE
2925
import static VertxReactiveWebServer.TEST_REQUEST_ID_PARAMETER
3026
import static io.opentelemetry.api.trace.SpanKind.CLIENT
3127
import static io.opentelemetry.api.trace.SpanKind.SERVER
28+
import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable
3229
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS
3330

3431
class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
@@ -99,12 +96,12 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
9996
childOf span(2)
10097
attributes {
10198
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
102-
"$DbIncubatingAttributes.DB_NAME" "test"
99+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
103100
"$DbIncubatingAttributes.DB_USER" "SA"
104101
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
105-
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id, name, price, weight FROM products"
106-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
107-
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
102+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" "SELECT id, name, price, weight FROM products"
103+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
104+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "products"
108105
}
109106
}
110107
}
@@ -199,12 +196,12 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
199196
childOf(span(3))
200197
attributes {
201198
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
202-
"$DbIncubatingAttributes.DB_NAME" "test"
199+
"${maybeStable(DbIncubatingAttributes.DB_NAME)}" "test"
203200
"$DbIncubatingAttributes.DB_USER" "SA"
204201
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
205-
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id AS request$requestId, name, price, weight FROM products"
206-
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
207-
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
202+
"${maybeStable(DbIncubatingAttributes.DB_STATEMENT)}" "SELECT id AS request$requestId, name, price, weight FROM products"
203+
"${maybeStable(DbIncubatingAttributes.DB_OPERATION)}" "SELECT"
204+
"${maybeStable(DbIncubatingAttributes.DB_SQL_TABLE)}" "products"
208205
}
209206
}
210207
}

0 commit comments

Comments
 (0)