-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add/Update Metrics TCK #186
Conversation
yasmin-aumeeruddy
commented
Jun 12, 2024
•
edited
Loading
edited
- Uses the logging exporter instead of the in-memory exporter.
- Updates metrics TCK to include the JVM metrics
- Changes the in-memory Metrics exporter to filter by metric names instead of metric types. This was done as multiple JVM metrics would be exported with the same metric type so it was no longer a unique identifier for the test metrics.
@yasmin-aumeeruddy please resolve the conflicts |
923577a
to
296c59b
Compare
1c91f0c
to
61e30d6
Compare
@yasmin-aumeeruddy please fix the build error? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build error needs to be resolved.
61e30d6
to
24ba3b1
Compare
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmCpuTest.java
Outdated
Show resolved
Hide resolved
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmCpuTest.java
Outdated
Show resolved
Hide resolved
...ics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/http/HttpHistogramTest.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmGarbageCollectionTest.java
Outdated
Show resolved
Hide resolved
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmMemoryTest.java
Outdated
Show resolved
Hide resolved
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmMemoryTest.java
Outdated
Show resolved
Hide resolved
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmMemoryTest.java
Outdated
Show resolved
Hide resolved
tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmMemoryTest.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/microprofile/telemetry/metrics/tck/jvm/JvmGarbageCollectionTest.java
Outdated
Show resolved
Hide resolved
c733559
to
701aa1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5e9c298
to
53a23d4
Compare
private static final String JUL_INFO_MESSAGE = "a very distinguishable info message"; | ||
private static final String JUL_WARN_MESSAGE = "a very distinguishable warning message"; | ||
|
||
private static final String SYS_OUT = "SystemOut"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only applies to Open Liberty, so should be removed
void julInfoTest() throws IOException { | ||
julLogger.log(Level.INFO, JUL_INFO_MESSAGE); | ||
try { | ||
Assert.assertTrue(checkMessage(SYS_OUT + ".*" + "INFO" + ".*" + JUL_INFO_MESSAGE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove SYS_OUT, but you'll need to add something else in the line to avoid matching with the logs from the runtime (since you actually want to match against the logs from OTel bridge).
|
||
@Test | ||
void julWarnTest() throws IOException { | ||
julLogger.log(Level.WARNING, JUL_INFO_MESSAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUL_INFO_MESSAGE -> JUL_WARN_MESSAGE
void julWarnTest() throws IOException { | ||
julLogger.log(Level.WARNING, JUL_INFO_MESSAGE); | ||
try { | ||
Assert.assertTrue(checkMessage(SYS_OUT + ".*" + "WARN" + ".*" + JUL_INFO_MESSAGE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUL_INFO_MESSAGE -> JUL_WARN_MESSAGE
BufferedReader reader = new BufferedReader(new FileReader(logFilePath)); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
if (line.contains(logMessage)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String contains
method doesn't do regex matching -- need to use matches
instead.
.addAsLibrary(TestLibraries.AWAITILITY_LIB) | ||
.addAsResource(new StringAsset( | ||
"otel.sdk.disabled=false\notel.logs.exporter=none\notel.traces.exporter=none"), | ||
"META-INF/microprofile-config.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need any of these lines anymore
.addAsLibrary(TestLibraries.AWAITILITY_LIB) | ||
.addAsResource(new StringAsset( | ||
"otel.sdk.disabled=false\notel.logs.exporter=none\notel.traces.exporter=none"), | ||
"META-INF/microprofile-config.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need any of these lines anymore
.addAsLibrary(TestLibraries.AWAITILITY_LIB) | ||
.addAsResource(new StringAsset( | ||
"otel.sdk.disabled=false\notel.logs.exporter=none\notel.traces.exporter=none"), | ||
"META-INF/microprofile-config.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need any of these lines anymore
.addAsLibrary(TestLibraries.AWAITILITY_LIB) | ||
.addAsResource(new StringAsset( | ||
"otel.sdk.disabled=false\notel.logs.exporter=none\notel.traces.exporter=none"), | ||
"META-INF/microprofile-config.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need any of these lines anymore
tck/metrics/README.adoc
Outdated
If you want to run the metrics tests, you can specify all tests in the `tck-suite.xml`. E.g. | ||
== Running the tests | ||
|
||
The jvm metrics tests require runtime configuration to enable metric reading at a runtime level. The metrics must be sent to stdout in the tests. Ensure logs written to stdout are captured in a file and set the system property `log.file.path` to the file containing the log output when running the logs TCK. Configure the runtime with `otel.metrics.exporter=console`/`OTEL_METRICS_EXPORTER=CONSOLE` and `otel.sdk.disabled=false`/`OTEL_SDK_DISABLED=FALSE` as a system property or environment variable. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jvm -> JVM
f3fcf17
to
5b84e7c
Compare
void julWarnTest() throws IOException { | ||
julLogger.log(Level.WARNING, JUL_WARN_MESSAGE); | ||
try { | ||
Assert.assertTrue(checkMessage(".*INFO.*" + JUL_WARN_MESSAGE + ".*scopeInfo:.*")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does OTel show "INFO" when we log a warning? would have expected WARN or WARNING
495a4c9
to
b472847
Compare
Add jvm metrics to TCK Remove log appender dependencies create test for http metrics (#197) Change exporter for jvm metrics separate metric tests for runtime tests Update logs tck
b472847
to
4a7ded7
Compare
…ADME to include configuration of export interval
tck/metrics/README.adoc
Outdated
The JVM metrics tests require runtime configuration to enable metric reading at a runtime level. The metrics must be sent to stdout in the tests. Ensure logs written to stdout are captured in a file and set the system property `log.file.path` to the file containing the log output when running the logs TCK. Configure the runtime with `otel.metrics.exporter=logging`/`OTEL_METRICS_EXPORTER=LOGGING` and `otel.sdk.disabled=false`/`OTEL_SDK_DISABLED=FALSE` as a system property or environment variable. | ||
The metric export interval `otel.metric.export.interval`/`OTEL_METRIC_EXPORT_INTERVAL` should be configured as well and it is recommended to be set to a value of `3000` (i.e., 3 seconds). | ||
Note: it is recommended to set `otel.traces.exporter` / `OTEL_TRACES_EXPORTER` and `otel.logs.exporter` / `OTEL_LOGS_EXPORTER` to `none` for the execution of the metric tests. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd suggest combining these, since they all must be configured with system property or env var...
The JVM metrics tests require runtime configuration to enable metric reading at a runtime level. The metrics must be sent to stdout in the tests. Ensure logs written to stdout are captured in a file and set the system property log.file.path
to the file containing the log output when running the logs TCK. Configure the runtime with the following as system properties / environment variables:
otel.sdk.disabled=false
/OTEL_SDK_DISABLED=FALSE
otel.metrics.exporter=logging
/OTEL_METRICS_EXPORTER=LOGGING
otel.traces.exporter=none
/OTEL_TRACES_EXPORTER=none
otel.logs.exporter=none
/OTEL_LOGS_EXPORTER=none
otel.metric.export.interval=3000
/OTEL_METRIC_EXPORT_INTERVAL=3000