MCPcopy Index your code
hub / github.com/questdb/questdb / Metrics

Class Metrics

core/src/main/java/io/questdb/Metrics.java:49–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47import org.jetbrains.annotations.NotNull;
48
49public class Metrics implements Target, Mutable {
50 public static final Metrics DISABLED = new Metrics(false, new NullMetricsRegistry());
51 public static final Metrics ENABLED = new Metrics(true, new MetricsRegistryImpl());
52 private final GCMetrics gcMetrics;
53 private final HealthMetricsImpl healthCheck;
54 private final HttpMetrics httpMetrics;
55 private final JsonQueryMetrics jsonQueryMetrics;
56 private final LineMetrics lineMetrics;
57 private final MetricsRegistry metricsRegistry;
58 private final PGMetrics pgMetrics;
59 private final QwpEgressMetrics qwpEgressMetrics;
60 private final Runtime runtime = Runtime.getRuntime();
61 private final VirtualLongGauge.StatProvider jvmFreeMemRef = runtime::freeMemory;
62 private final VirtualLongGauge.StatProvider jvmMaxMemRef = runtime::maxMemory;
63 private final VirtualLongGauge.StatProvider jvmTotalMemRef = runtime::totalMemory;
64 private final TableWriterMetrics tableWriterMetrics;
65 private final WalMetrics walMetrics;
66 private final WorkerMetrics workerMetrics;
67 private boolean enabled;
68
69 public Metrics(boolean enabled, MetricsRegistry metricsRegistry) {
70 this.enabled = enabled;
71 this.gcMetrics = new GCMetrics();
72 this.jsonQueryMetrics = new JsonQueryMetrics(metricsRegistry);
73 this.httpMetrics = new HttpMetrics(metricsRegistry);
74 this.pgMetrics = new PGMetrics(metricsRegistry);
75 this.qwpEgressMetrics = new QwpEgressMetrics(metricsRegistry);
76 this.lineMetrics = new LineMetrics(metricsRegistry);
77 this.healthCheck = new HealthMetricsImpl(metricsRegistry);
78 this.tableWriterMetrics = new TableWriterMetrics(metricsRegistry);
79 this.walMetrics = new WalMetrics(metricsRegistry);
80 createMemoryGauges(metricsRegistry);
81 this.metricsRegistry = metricsRegistry;
82 this.workerMetrics = new WorkerMetrics(metricsRegistry);
83 }
84
85 @Override
86 public void clear() {
87 gcMetrics.clear();
88 jsonQueryMetrics.clear();
89 pgMetrics.clear();
90 qwpEgressMetrics.clear();
91 lineMetrics.clear();
92 healthCheck.clear();
93 tableWriterMetrics.clear();
94 walMetrics.clear();
95 workerMetrics.clear();
96 httpMetrics.clear();
97 enabled = true;
98 }
99
100 public void disable() {
101 enabled = false;
102 }
103
104 public MetricsRegistry getRegistry() {
105 return metricsRegistry;
106 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…