Skip to content

Commit

Permalink
Enable stable JVM semconv by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Nov 28, 2023
1 parent 00b6398 commit b6e6642
Show file tree
Hide file tree
Showing 32 changed files with 184 additions and 1,436 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ public final class SemconvStability {

private static final boolean emitOldHttpSemconv;
private static final boolean emitStableHttpSemconv;
private static final boolean emitOldJvmSemconv;
private static final boolean emitStableJvmSemconv;

static {
boolean oldHttp = true;
boolean stableHttp = false;
boolean oldJvm = true;
boolean stableJvm = false;

String value = ConfigPropertiesUtil.getString("otel.semconv-stability.opt-in");
if (value != null) {
Expand All @@ -40,21 +36,10 @@ public final class SemconvStability {
oldHttp = true;
stableHttp = true;
}

if (values.contains("jvm")) {
oldJvm = false;
stableJvm = true;
}
if (values.contains("jvm/dup")) {
oldJvm = true;
stableJvm = true;
}
}

emitOldHttpSemconv = oldHttp;
emitStableHttpSemconv = stableHttp;
emitOldJvmSemconv = oldJvm;
emitStableJvmSemconv = stableJvm;
}

public static boolean emitOldHttpSemconv() {
Expand All @@ -65,13 +50,5 @@ public static boolean emitStableHttpSemconv() {
return emitStableHttpSemconv;
}

public static boolean emitOldJvmSemconv() {
return emitOldJvmSemconv;
}

public static boolean emitStableJvmSemconv() {
return emitStableJvmSemconv;
}

private SemconvStability() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@ void runtimeMetricsAreEnabled() {

testing.waitAndAssertMetrics(
"io.opentelemetry.runtime-telemetry-java8",
metric -> metric.hasName("process.runtime.jvm.classes.loaded"),
metric -> metric.hasName("process.runtime.jvm.classes.unloaded"),
metric -> metric.hasName("process.runtime.jvm.classes.current_loaded"),
metric -> metric.hasName("process.runtime.jvm.system.cpu.load_1m"),
metric -> metric.hasName("process.runtime.jvm.system.cpu.utilization"),
metric -> metric.hasName("process.runtime.jvm.cpu.utilization"),
metric -> metric.hasName("process.runtime.jvm.gc.duration"),
metric -> metric.hasName("process.runtime.jvm.memory.init"),
metric -> metric.hasName("process.runtime.jvm.memory.usage"),
metric -> metric.hasName("process.runtime.jvm.memory.committed"),
metric -> metric.hasName("process.runtime.jvm.memory.limit"),
metric -> metric.hasName("process.runtime.jvm.memory.usage_after_last_gc"),
metric -> metric.hasName("process.runtime.jvm.threads.count"),
metric -> metric.hasName("process.runtime.jvm.buffer.limit"),
metric -> metric.hasName("process.runtime.jvm.buffer.count"),
metric -> metric.hasName("process.runtime.jvm.buffer.usage"));
metric -> metric.hasName("jvm.class.loaded"),
metric -> metric.hasName("jvm.class.unloaded"),
metric -> metric.hasName("jvm.class.count"),
metric -> metric.hasName("jvm.cpu.time"),
metric -> metric.hasName("jvm.cpu.count"),
metric -> metric.hasName("jvm.cpu.recent_utilization"),
metric -> metric.hasName("jvm.gc.duration"),
metric -> metric.hasName("jvm.memory.used"),
metric -> metric.hasName("jvm.memory.committed"),
metric -> metric.hasName("jvm.memory.limit"),
metric -> metric.hasName("jvm.memory.used_after_last_gc"),
metric -> metric.hasName("jvm.thread.count"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.runtimemetrics.java8.BufferPools;
import io.opentelemetry.instrumentation.runtimemetrics.java8.Classes;
import io.opentelemetry.instrumentation.runtimemetrics.java8.Cpu;
import io.opentelemetry.instrumentation.runtimemetrics.java8.GarbageCollector;
Expand Down Expand Up @@ -106,7 +105,6 @@ private List<AutoCloseable> buildObservables() {
try {
// Set up metrics gathered by JMX
List<AutoCloseable> observables = new ArrayList<>();
observables.addAll(BufferPools.registerObservers(openTelemetry));
observables.addAll(Classes.registerObservers(openTelemetry));
observables.addAll(Cpu.registerObservers(openTelemetry));
observables.addAll(GarbageCollector.registerObservers(openTelemetry));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.google.auto.service.AutoService;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.runtimemetrics.java8.BufferPools;
import io.opentelemetry.instrumentation.runtimemetrics.java8.Classes;
import io.opentelemetry.instrumentation.runtimemetrics.java8.Cpu;
import io.opentelemetry.instrumentation.runtimemetrics.java8.GarbageCollector;
Expand Down Expand Up @@ -41,7 +40,6 @@ public void afterAgent(AutoConfiguredOpenTelemetrySdk autoConfiguredSdk) {

OpenTelemetry openTelemetry = GlobalOpenTelemetry.get();
List<AutoCloseable> observables = new ArrayList<>();
observables.addAll(BufferPools.registerObservers(openTelemetry));
observables.addAll(Classes.registerObservers(openTelemetry));
observables.addAll(Cpu.registerObservers(openTelemetry));
observables.addAll(GarbageCollector.registerObservers(openTelemetry));
Expand Down
Loading

0 comments on commit b6e6642

Please sign in to comment.