LongCounter does not accumulate #7767
-
|
I'm playing around with the @Startup
@Stateless
public class MyScheduler {
private static final LongCounter meter = GlobalOpenTelemetry.getMeter("schedule.meter")
.counterBuilder("scheduled.task.counter")
.setDescription("Counter testing in a schedule")
.build();
@Schedule(hour = "*", minute = "*/1", persistent = false, info = "MySchedule running every 1 minute")
public void mySchedule() throws InterruptedException {
Thread.sleep(2000);
System.out.println("My Schedule running... with meter: " + meter.hashCode());
meter.add(1, Attributes.of(AttributeKey.stringKey("schedule.name"), "mySchedule"));
}
}However, when I look into my index (using elastic observabiliy) I find that all my counter values are Example result: {"@timestamp": "Oct 17, 2025 @ 13:50:00.262", "scheduled.task.counter": 1, "service.framework.name": "schdule.meter", "labels.schedule_name": "mySchedule" }
{"@timestamp": "Oct 17, 2025 @ 13:51:00.262", "scheduled.task.counter": 1, "service.framework.name": "schdule.meter", "labels.schedule_name": "mySchedule" }
{"@timestamp": "Oct 17, 2025 @ 13:52:00.262", "scheduled.task.counter": 1, "service.framework.name": "schdule.meter", "labels.schedule_name": "mySchedule" }
{"@timestamp": "Oct 17, 2025 @ 13:53:00.262", "scheduled.task.counter": 1, "service.framework.name": "schdule.meter", "labels.schedule_name": "mySchedule" }
{"@timestamp": "Oct 17, 2025 @ 13:54:00.262", "scheduled.task.counter": 1, "service.framework.name": "schdule.meter", "labels.schedule_name": "mySchedule" }I was expecting that for every execution the I'm very new to OpenTelemetry and the Stuff I have tried |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
hi @canilsenlogiq, my first guess is that you're seeing DELTA metrics instead of CUMULATIVE metrics. you could try updating multiple times per minute to confirm this (default export is once per minute) |
Beta Was this translation helpful? Give feedback.
hi @canilsenlogiq, my first guess is that you're seeing DELTA metrics instead of CUMULATIVE metrics. you could try updating multiple times per minute to confirm this (default export is once per minute)