Sample for a test verifying published metrics in unit tests
@tsurdilo is already working on this.
Since May 9, 2022.
Assessment
This issue has not been assessed yet.
Description
Temporal should provide a sample for users on how they may check the metrics in unit tests.
I propose to wire MetricsScope with our standard MicrometerClientStatsReporter initialized with SimpleMeterRegistry micrometer.
A little bit like micrometer does in one of their tests:
https://www.programcreek.com/java-api-examples/?code=micrometer-metrics%2Fmicrometer%2Fmicrometer-master%2Fmicrometer-test%2Fsrc%2Fmain%2Fjava%2Fio%2Fmicrometer%2Fcore%2Ftck%2FTimerTest.java
MeterRegistry registry = new SimpleMeterRegistry();
try (Timer.ResourceSample sample = Timer.resource(registry, "requests")
.description("This is an operation")
.publishPercentileHistogram()) {
try {
if (outcome.equals("error")) {
throw new IllegalArgumentException("boom");
}
sample.tag("outcome", "success");
} catch (Throwable t) {
sample.tag("outcome", "error");
}
}
assertThat(registry.get("requests").tag("outcome", outcome).timer().count())
.isEqualTo(1);
- Dominant language
- Java
- Stars
- 258
- Forks
- 189
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from temporalio/samples-java
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
temporalio/samples-java#770 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
temporalio/samples-java#749 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
temporalio/samples-java#687 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
temporalio/samples-java#635 · 1 comment ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
temporalio/samples-java#606 · 4 reactions ·
All issues in temporalio/samples-java
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo-graphs#74 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100