Skip to content

Migrate "runtime-metrics" test from groovy to java#8928

Merged
mateuszrzeszutek merged 6 commits into
open-telemetry:mainfrom
breedx-splk:jmx_test_to_java
Jul 18, 2023
Merged

Migrate "runtime-metrics" test from groovy to java#8928
mateuszrzeszutek merged 6 commits into
open-telemetry:mainfrom
breedx-splk:jmx_test_to_java

Conversation

@breedx-splk

Copy link
Copy Markdown
Contributor

Related to #7195

@breedx-splk breedx-splk requested a review from a team July 11, 2023 21:07
@jeanbisutti

Copy link
Copy Markdown
Member

Great! It could help to test JVM metrics with a GraalVM native executable.

…aagent/src/test/java/io/opentelemetry/instrumentation/javaagent/runtimemetrics/java17/JmxRuntimeMetricsTest.java

Co-authored-by: Jean Bisutti <jean.bisutti@gmail.com>
}

/** Returns a list of metrics, filtered by instrumentation name */
public List<MetricData> instrumentationMetrics(String instrumentationName) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have analogous methods for any other signal; and it's only used in this class. WDYT about making it private?

Suggested change
public List<MetricData> instrumentationMetrics(String instrumentationName) {
private List<MetricData> instrumentationMetrics(String instrumentationName) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended it to be a public helper, analogous to metrics() but filtered to a specific instrumentation. It's only used internally now, but I could see it being useful elsewhere. If you think it's too much YAGNI then I will make it private.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it private -- there's just one use case for that now; and I think all 3 signals should have very similar API, so if we're introducing some new thing here we should do similar thing everywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I relent. :) I think you have a higher standard for test code than I do.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, I'm just thinking that YAGNI (probably) when it comes to making that method public

@mateuszrzeszutek mateuszrzeszutek merged commit 23acd5b into open-telemetry:main Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants