public void segmentCount(int count) { DYNAMIC_LOGGER.reportGaugeValue(this.activeSegmentCount, count); } }
void ledgerCount(int count) { DYNAMIC_LOGGER.reportGaugeValue(this.ledgerCount, count); }
@Override public <T extends Number> void reportGaugeValue(String name, T value) { this.instance.get().reportGaugeValue(name, value); }
/** * Reports the number of active segments for a Stream. * * @param scope Scope. * @param streamName Name of the Stream. * @param numSegments Number of active segments in this Stream. */ public static void reportActiveSegments(String scope, String streamName, int numSegments) { DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(SEGMENTS_COUNT, scope, streamName), numSegments); }
/** * This method reports the current number of open Transactions for a Stream. * * @param scope Scope. * @param streamName Name of the Stream. * @param ongoingTransactions Number of open Transactions in the Stream. */ public static void reportOpenTransactions(String scope, String streamName, int ongoingTransactions) { DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(OPEN_TRANSACTIONS, scope, streamName), ongoingTransactions); }
public void report(long totalBytes, int generationSpread) { DYNAMIC_LOGGER.reportGaugeValue(MetricsNames.CACHE_TOTAL_SIZE_BYTES, totalBytes); this.generationSpread.reportSuccessValue(generationSpread); }
private void reportContainerCountPerHost(Host host, Set<Integer> containerIds) { DYNAMIC_LOGGER.reportGaugeValue(nameFromHost(SEGMENT_STORE_HOST_CONTAINER_COUNT, host.toString()), containerIds.size()); }
DYNAMIC_LOGGER.reportGaugeValue(SEGMENT_STORE_HOST_NUMBER, newMapping.keySet().size());
/** * This method increments the global and Stream-specific counters of seal Stream operations, set the number of open * Transactions to 0, and reports the latency of the operation. * * @param scope Scope. * @param streamName Name of the Stream. * @param latency Latency of the sealStream operation. */ public void sealStream(String scope, String streamName, Duration latency) { DYNAMIC_LOGGER.incCounterValue(SEAL_STREAM, 1); DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(OPEN_TRANSACTIONS, scope, streamName), 0); sealStreamLatency.reportSuccessValue(latency.toMillis()); }
/** * This method increments the global and Stream-specific counters of Stream creations, initializes other * stream-specific metrics and reports the latency of the operation. * * @param scope Scope. * @param streamName Name of the Stream. * @param minNumSegments Initial number of segments for the Stream. * @param latency Latency of the createStream operation. */ public void createStream(String scope, String streamName, int minNumSegments, Duration latency) { DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM, 1); DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(OPEN_TRANSACTIONS, scope, streamName), 0); DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(SEGMENTS_COUNT, scope, streamName), minNumSegments); DYNAMIC_LOGGER.incCounterValue(nameFromStream(SEGMENTS_SPLITS, scope, streamName), 0); DYNAMIC_LOGGER.incCounterValue(nameFromStream(SEGMENTS_MERGES, scope, streamName), 0); createStreamLatency.reportSuccessValue(latency.toMillis()); }
private CompletableFuture<Void> processTruncate(String scope, String stream, VersionedMetadata<StreamTruncationRecord> versionedTruncationRecord, VersionedMetadata<State> versionedState, OperationContext context, long requestId) { String delegationToken = this.streamMetadataTasks.retrieveDelegationToken(); StreamTruncationRecord truncationRecord = versionedTruncationRecord.getObject(); log.info(requestId, "Truncating stream {}/{} at stream cut: {}", scope, stream, truncationRecord.getStreamCut()); return Futures.toVoid(streamMetadataStore.updateVersionedState(scope, stream, State.TRUNCATING, versionedState, context, executor) .thenCompose(update -> notifyTruncateSegments(scope, stream, truncationRecord.getStreamCut(), delegationToken, requestId) .thenCompose(x -> notifyDeleteSegments(scope, stream, truncationRecord.getToDelete(), delegationToken, requestId)) .thenAccept(x -> DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(TRUNCATED_SIZE, scope, stream), versionedTruncationRecord.getObject().getSizeTill())) .thenCompose(deleted -> streamMetadataStore.completeTruncation(scope, stream, versionedTruncationRecord, context, executor)) .thenCompose(x -> streamMetadataStore.updateVersionedState(scope, stream, State.ACTIVE, update, context, executor)))); }
private void reportHostFailures(Host failedHost) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(SEGMENT_STORE_HOST_FAILURES), 1); DYNAMIC_LOGGER.incCounterValue(nameFromHost(SEGMENT_STORE_HOST_FAILURES, failedHost.toString()), 1); // Set to 0 the number of containers for the failed host. DYNAMIC_LOGGER.reportGaugeValue(nameFromHost(SEGMENT_STORE_HOST_CONTAINER_COUNT, failedHost.toString()), 0); }
/** * Test gauge registered and worked well with StatsLogger. */ @Test public void testGauge() { AtomicInteger value = new AtomicInteger(1); statsLogger.registerGauge("testGauge", value::get); value.set(2); assertEquals(value.get(), MetricRegistryUtils.getGauge("pravega.testStatsLogger.testGauge").getValue()); for (int i = 1; i < 10; i++) { dynamicLogger.reportGaugeValue("dynamicGauge", i); assertEquals(i, MetricRegistryUtils.getGauge("pravega.dynamicGauge.Gauge").getValue()); } dynamicLogger.freezeGaugeValue("dynamicGauge"); assertEquals(null, MetricRegistryUtils.getGauge("pravega.dynamicGauge.Gauge")); }