Skip to content

Commit 1268579

Browse files
authored
Module cleanup (run 25325090878) (open-telemetry#18564)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 54dbb34 commit 1268579

10 files changed

Lines changed: 41 additions & 20 deletions

File tree

instrumentation/jms/jms-common-1.1/javaagent-unit-tests/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ plugins {
44

55
dependencies {
66
testImplementation(project(":instrumentation:jms:jms-common-1.1:javaagent"))
7-
testImplementation(project(":instrumentation-api"))
8-
testImplementation(project(":instrumentation-api-incubator"))
97
}

instrumentation/jmx-metrics/library/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ dependencies {
1616
}
1717

1818
tasks {
19-
withType<Test>().configureEach {
19+
test {
2020
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
21-
}
2221

23-
test {
2422
val shadowTask = project(":javaagent").tasks.named<Jar>("shadowJar")
2523
val testAppTask = project(":instrumentation:jmx-metrics:testing-apps:testing-webapp").tasks.named<War>("war")
2624
val camelTestAppTask = project(":instrumentation:jmx-metrics:testing-apps:camel-testing-app").tasks.named<Jar>("camelTestAppJar")

instrumentation/jmx-metrics/library/src/main/java/io/opentelemetry/instrumentation/jmx/internal/yaml/MetricStructure.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030
public abstract class MetricStructure {
3131

32+
private static final String STATE_MAPPING_DEFAULT = "*";
33+
3234
// Used by the YAML parser
3335
//
3436
// type: TYPE
@@ -49,7 +51,6 @@ public abstract class MetricStructure {
4951

5052
private Map<String, Object> metricAttribute;
5153
private StateMapping stateMapping = StateMapping.empty();
52-
private static final String STATE_MAPPING_DEFAULT = "*";
5354

5455
@Nullable private String sourceUnit;
5556
@Nullable private String unit;

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/internal/engine/AttributeExtractorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.assertj.core.api.Assertions.assertThat;
99

1010
import java.util.Set;
11+
import javax.management.JMException;
1112
import javax.management.MBeanServer;
1213
import javax.management.MBeanServerFactory;
1314
import javax.management.ObjectName;
@@ -104,7 +105,7 @@ private enum DummyEnum {
104105
private static MBeanServer theServer;
105106

106107
@BeforeAll
107-
static void setUp() throws Exception {
108+
static void setUp() throws JMException {
108109
theServer = MBeanServerFactory.createMBeanServer(DOMAIN);
109110
objectName = new ObjectName(OBJECT_NAME);
110111
theServer.registerMBean(test1, objectName);

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/internal/engine/MetricAggregationTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.concurrent.atomic.AtomicInteger;
2424
import java.util.function.Consumer;
2525
import javax.management.InstanceNotFoundException;
26+
import javax.management.JMException;
2627
import javax.management.MBeanRegistrationException;
2728
import javax.management.MBeanServer;
2829
import javax.management.MBeanServerFactory;
@@ -77,7 +78,7 @@ static void tearDown() {
7778
}
7879

7980
@AfterEach
80-
void after() throws Exception {
81+
void after() throws JMException {
8182
ObjectName objectName = new ObjectName(DOMAIN + ":type=" + Hello.class.getSimpleName() + ",*");
8283
theServer
8384
.queryMBeans(objectName, null)
@@ -109,7 +110,7 @@ static List<MetricInfo.Type> metricTypes() {
109110

110111
@ParameterizedTest(name = ARGUMENTS_PLACEHOLDER)
111112
@MethodSource("metricTypes")
112-
void singleInstance(MetricInfo.Type metricType) throws Exception {
113+
void singleInstance(MetricInfo.Type metricType) throws JMException {
113114
ObjectName bean = getObjectName(null, null);
114115
theServer.registerMBean(new Hello(42), bean);
115116

@@ -121,7 +122,7 @@ void singleInstance(MetricInfo.Type metricType) throws Exception {
121122

122123
@ParameterizedTest(name = ARGUMENTS_PLACEHOLDER)
123124
@MethodSource("metricTypes")
124-
void aggregateOneParam(MetricInfo.Type metricType) throws Exception {
125+
void aggregateOneParam(MetricInfo.Type metricType) throws JMException {
125126
theServer.registerMBean(new Hello(42), getObjectName("value1", null));
126127
theServer.registerMBean(new Hello(37), getObjectName("value2", null));
127128

@@ -141,7 +142,7 @@ void aggregateOneParam(MetricInfo.Type metricType) throws Exception {
141142

142143
@ParameterizedTest(name = ARGUMENTS_PLACEHOLDER)
143144
@MethodSource("metricTypes")
144-
void aggregateMultipleParams(MetricInfo.Type metricType) throws Exception {
145+
void aggregateMultipleParams(MetricInfo.Type metricType) throws JMException {
145146
theServer.registerMBean(new Hello(1), getObjectName("1", "x"));
146147
theServer.registerMBean(new Hello(2), getObjectName("2", "y"));
147148
theServer.registerMBean(new Hello(3), getObjectName("3", "x"));
@@ -163,7 +164,7 @@ void aggregateMultipleParams(MetricInfo.Type metricType) throws Exception {
163164

164165
@ParameterizedTest(name = ARGUMENTS_PLACEHOLDER)
165166
@MethodSource("metricTypes")
166-
void partialAggregateMultipleParams(MetricInfo.Type metricType) throws Exception {
167+
void partialAggregateMultipleParams(MetricInfo.Type metricType) throws JMException {
167168
theServer.registerMBean(new Hello(1), getObjectName("1", "x"));
168169
theServer.registerMBean(new Hello(2), getObjectName("2", "y"));
169170
theServer.registerMBean(new Hello(3), getObjectName("3", "x"));

instrumentation/jmx-metrics/metadata.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,24 @@ description: >
55
configured to extract JVM and application-level telemetry data from JMX MBeans such as memory
66
usage, thread counts, and garbage collection statistics, and translate these measurements into
77
OpenTelemetry metrics.
8+
configurations:
9+
- name: otel.jmx.enabled
10+
declarative_name: java.jmx.enabled
11+
description: Enables collection of JMX metrics.
12+
type: boolean
13+
default: true
14+
- name: otel.jmx.config
15+
declarative_name: java.jmx.config
16+
description: List of paths to JMX metric definition YAML files.
17+
type: list
18+
default: ""
19+
- name: otel.jmx.discovery.delay
20+
declarative_name: java.jmx.discovery.delay
21+
description: Time in milliseconds between JMX MBean detection attempts.
22+
type: int
23+
default: 60000
24+
- name: otel.jmx.target.system
25+
declarative_name: java.jmx.target.system
26+
description: List of predefined JMX target systems to collect metrics for.
27+
type: list
28+
default: ""

instrumentation/jodd-http-4.2/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ configurations:
2323
type: list
2424
default: ""
2525
- name: otel.instrumentation.common.peer-service-mapping
26+
declarative_name: java.common.peer_service_mapping
2627
description: Used to specify a mapping from host names or IP addresses to peer services.
2728
type: map
2829
default: ""

instrumentation/jsf/jsf-mojarra-1.2/javaagent/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ muzzle {
1313
group.set("org.glassfish")
1414
module.set("javax.faces")
1515
versions.set("[2.0.7,3)")
16-
extraDependency("javax.el:el-api:2.2")
1716
assertInverse.set(true)
17+
extraDependency("javax.el:el-api:2.2")
1818
}
1919
pass {
2020
group.set("com.sun.faces")
@@ -34,9 +34,9 @@ muzzle {
3434
group.set("javax.faces")
3535
module.set("jsf-impl")
3636
versions.set("[1.2,2)")
37+
assertInverse.set(true)
3738
extraDependency("javax.faces:jsf-api:1.2")
3839
extraDependency("javax.el:el-api:1.0")
39-
assertInverse.set(true)
4040
}
4141
fail {
4242
group.set("org.glassfish")

instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/v2_3/HttpJspPageInstrumentation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public static class AdviceScope {
5151
private final Context context;
5252
private final Scope scope;
5353

54-
private AdviceScope(Context context, Scope scope) {
54+
private AdviceScope(Context context) {
5555
this.context = context;
56-
this.scope = scope;
56+
this.scope = context.makeCurrent();
5757
}
5858

5959
@Nullable
@@ -63,7 +63,7 @@ public static AdviceScope start(HttpServletRequest req) {
6363
return null;
6464
}
6565
Context context = instrumenter().start(parentContext, req);
66-
return new AdviceScope(context, context.makeCurrent());
66+
return new AdviceScope(context);
6767
}
6868

6969
public void end(HttpServletRequest req, Throwable throwable) {

instrumentation/jsp-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsp/v2_3/JspCompilationContextInstrumentation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public static class AdviceScope {
4141
private final Context context;
4242
private final Scope scope;
4343

44-
private AdviceScope(Context context, Scope scope) {
44+
private AdviceScope(Context context) {
4545
this.context = context;
46-
this.scope = scope;
46+
this.scope = context.makeCurrent();
4747
}
4848

4949
@Nullable
@@ -53,7 +53,7 @@ public static AdviceScope start(JspCompilationContext jspCompilationContext) {
5353
return null;
5454
}
5555
Context context = instrumenter().start(parentContext, jspCompilationContext);
56-
return new AdviceScope(context, context.makeCurrent());
56+
return new AdviceScope(context);
5757
}
5858

5959
public void end(@Nullable Throwable throwable, JspCompilationContext jspCompilationContext) {

0 commit comments

Comments
 (0)