-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df04686
commit 2ca4a1f
Showing
12 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...c/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmRuntimeMetricsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
********************************************************************** | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICES file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
**********************************************************************/ | ||
package org.eclipse.microprofile.telemetry.metrics.tck.jvm; | ||
|
||
import org.eclipse.microprofile.telemetry.metrics.tck.TestLibraries; | ||
import org.eclipse.microprofile.telemetry.metrics.tck.exporter.InMemoryMetricExporter; | ||
import org.eclipse.microprofile.telemetry.metrics.tck.exporter.InMemoryMetricExporterProvider; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.testng.Arquillian; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.metrics.Meter; | ||
import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; | ||
import io.opentelemetry.instrumentation.api.internal.EmbeddedInstrumentationProperties; | ||
import io.opentelemetry.instrumentation.api.internal.SemconvStability; | ||
import io.opentelemetry.instrumentation.runtimemetrics.java8.Classes; | ||
import io.opentelemetry.instrumentation.runtimemetrics.java8.internal.JmxRuntimeMetricsUtil; | ||
import io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider; | ||
import jakarta.inject.Inject; | ||
|
||
public class JvmRuntimeMetricsTest extends Arquillian { | ||
private static final String counterName = "testDoubleCounter"; | ||
private static final String counterDescription = "Testing double counter"; | ||
private static final String counterUnit = "Metric Tonnes"; | ||
|
||
private static final double DOUBLE_WITH_ATTRIBUTES = 20.2; | ||
private static final double DOUBLE_WITHOUT_ATTRIBUTES = 10.1; | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Deployment | ||
public static WebArchive createTestArchive() { | ||
|
||
return ShrinkWrap.create(WebArchive.class) | ||
.addClasses(InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class, Classes.class, | ||
JmxRuntimeMetricsUtil.class, EmbeddedInstrumentationProperties.class, SemconvStability.class, | ||
ConfigPropertiesUtil.class) | ||
.addAsLibrary(TestLibraries.AWAITILITY_LIB) | ||
.addAsServiceProvider(ConfigurableMetricExporterProvider.class, InMemoryMetricExporterProvider.class) | ||
.addAsResource(new StringAsset( | ||
"otel.sdk.disabled=false\notel.metrics.exporter=in-memory\notel.logs.exporter=none\notel.traces.exporter=none\notel.metric.export.interval=3000"), | ||
"META-INF/microprofile-config.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
} | ||
|
||
@Inject | ||
private Meter sdkMeter; | ||
|
||
@Inject | ||
private InMemoryMetricExporter metricExporter; | ||
|
||
@BeforeMethod | ||
void setUp() { | ||
if (metricExporter != null) { | ||
metricExporter.reset(); | ||
} | ||
} | ||
|
||
@Test | ||
void testClassJVMMetrics() throws InterruptedException { | ||
Classes.registerObservers(openTelemetry); | ||
Thread.sleep(10000); | ||
} | ||
|
||
} |