Remove unnecessary method in test harness
MODIFY
instrumentation/jaxws/jaxws-2.0/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/JaxWsAnnotationsTest.groovy
instrumentation/jaxws/jaxws-2.0/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/JaxWsAnnotationsTest.groovy
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.test.SoapProvider
class JaxWsAnnotationsTest extends AgentInstrumentationSpecification {
@@ -18,10 +19,10 @@ class JaxWsAnnotationsTest extends AgentInstrumentationSpecification {
assertTraces(1) {
trace(0, 1) {
span(0) {
- name 'SoapProvider.invoke'
+ name "SoapProvider.invoke"
attributes {
- attribute('code.namespace', 'io.opentelemetry.test.SoapProvider')
- attribute('code.function', 'invoke')
+ "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.SoapProvider"
+ "${SemanticAttributes.CODE_FUNCTION.key}" "invoke"
}
}
}

MODIFY
instrumentation/jaxws/jws-1.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsAnnotationsTest.groovy
instrumentation/jaxws/jws-1.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsAnnotationsTest.groovy
package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.test.WebServiceClass
import io.opentelemetry.test.WebServiceDefinitionInterface
import io.opentelemetry.test.WebServiceFromInterface
@@ -25,8 +26,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) {
name "WebServiceClass.doSomethingPublic"
attributes {
- attribute('code.function', 'doSomethingPublic')
- attribute('code.namespace', 'io.opentelemetry.test.WebServiceClass')
+ "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceClass"
+ "${SemanticAttributes.CODE_FUNCTION.key}" "doSomethingPublic"
}
}
}
@@ -45,8 +46,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) {
name "WebServiceFromInterface.partOfPublicInterface"
attributes {
- attribute('code.function', 'partOfPublicInterface')
- attribute('code.namespace', 'io.opentelemetry.test.WebServiceFromInterface')
+ "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceFromInterface"
+ "${SemanticAttributes.CODE_FUNCTION.key}" "partOfPublicInterface"
}
}
}
@@ -69,8 +70,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) {
name "WebServiceFromInterface.partOfPublicInterface"
attributes {
- attribute('code.function', 'partOfPublicInterface')
- attribute('code.namespace', 'io.opentelemetry.test.WebServiceFromInterface')
+ "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceFromInterface"
+ "${SemanticAttributes.CODE_FUNCTION.key}" "partOfPublicInterface"
}
}
}

MODIFY
instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy
instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy
@@ -375,7 +375,7 @@ class RabbitMQTest extends AgentInstrumentationSpecification {
"rabbitmq.record.queue_time_ms" { it instanceof Long && it >= 0 }
}
- switch (attribute("rabbitmq.command")) {
+ switch (trace.span(index).attributes.get(AttributeKey.stringKey("rabbitmq.command"))) {
case "basic.publish":
"rabbitmq.command" "basic.publish"
"rabbitmq.routing_key" {

MODIFY
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/AttributesAssert.groovy
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/AttributesAssert.groovy
@@ -45,10 +45,6 @@ class AttributesAssert {
}
}
- def attribute(String name) {
- return attributes[name]
- }
-
def methodMissing(String name, args) {
if (args.length == 0) {
throw new IllegalArgumentException(args.toString())
@@ -56,6 +52,7 @@ class AttributesAssert {
attribute(name, args[0])
}
+ // this could be private, but then codenarc fails, thinking (incorrectly) that it's unused
void assertAttributesAllVerified() {
Set<String> allAttributes = new TreeSet<>(attributes.keySet())
Set<String> unverifiedAttributes = new TreeSet(allAttributes)

Remove unnecessary method in test harness (#3016)