temporalio / temporalio/samples-java
Sample for a test verifying published metrics in unit tests
Đang mở
@tsurdilo đang làm issue này rồi.
Từ ngày 9/5/2022.
enhancement
- Ngôn ngữ chính
- Java
- Star
- 258
- Fork
- 189
- Merge trung bình
- 6 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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);
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.