Skip to content

Commit

Permalink
fix timer.percentiles in code and added to yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-landiak committed Dec 13, 2024
1 parent 014827f commit f7eb898
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.concurrent.atomic.AtomicLong;

public interface StatsManager {

TbQueueCallback wrapTbQueueCallback(TbQueueCallback queueCallback, MessagesStats stats);

MessagesStats createMsgDispatcherPublishStats();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@Service
@ConditionalOnProperty(prefix = "stats", value = "enabled", havingValue = "false", matchIfMissing = true)
public class StatsManagerStub implements StatsManager, ActorStatsManager, ProducerStatsManager, ConsumerStatsManager {

private static final StubTimerStats timerStats = new StubTimerStats();

@Override
Expand Down
3 changes: 3 additions & 0 deletions application/src/main/resources/thingsboard-mqtt-broker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,9 @@ stats:
enabled: "${STATS_ENABLED:true}"
# Period in milliseconds to print stats. Default value corresponds to 1 minute
print-interval-ms: "${STATS_PRINT_INTERVAL_MS:60000}"
timer:
# Metrics percentiles returned by actuator for timer metrics. List of comma-separated (,) double values
percentiles: "${STATS_TIMER_PERCENTILES:0.3}"
application-processor:
# Enable/disable specific Application clients stats
enabled: "${APPLICATION_PROCESSOR_STATS_ENABLED:true}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class DefaultStatsFactory implements StatsFactory {

private final MeterRegistry meterRegistry;

@Value("${metrics.timer.percentiles:0.5}")
@Value("${stats.timer.percentiles:0.5}")
private String timerPercentilesStr;

private double[] timerPercentiles;
Expand All @@ -55,7 +55,6 @@ public void init() {
}
}


@Override
public StatsCounter createStatsCounter(String key, String statsName, String... tags) {
String[] updatedTags = new String[tags.length + 2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.thingsboard.mqtt.broker.common.stats;

public class StatsConstantNames {

public static final String TOTAL_MSGS = "totalMsgs";
public static final String SUCCESSFUL_MSGS = "successfulMsgs";
public static final String FAILED_MSGS = "failedMsgs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import java.util.function.ToDoubleFunction;

// TODO move this to some separate library (or use ThingsBoard stats library)
public interface StatsFactory {

StatsCounter createStatsCounter(String key, String statsName, String... tags);

DefaultCounter createDefaultCounter(String key, String... tags);
Expand Down

0 comments on commit f7eb898

Please sign in to comment.