@Override public void emitMetrics(Metric metric) { int numStaleContainers; synchronized (monitor) { numStaleContainers = this.numStaleContainers; } metric.set(TOTAL_DEACTIVATED_CONTAINERS, numStaleContainers, null); }
public void contentSize(int size) { metric.set(Metrics.CONTENT_SIZE, size, context); } }
public void successfulRead(int bytes_received) { metric.set(JettyHttpServer.Metrics.NUM_BYTES_RECEIVED, bytes_received, context); }
public void uriLength(int length) { metric.set(Metrics.URI_LENGTH, length, context); }
private void updateMaintenanceMetrics() { metric.set("hostedVespa.pendingRedeployments", pendingRedeploymentsSupplier.get(), null); }
private void flushPeakQps(long now) { double ms = (double) (now - prevMaxQPSTime); final double value = ((double)queriesForQPS) / (ms / 1000.0); peakQPS.put(value); metric.set(PEAK_QPS_METRIC, value, metricContext); prevMaxQPSTime = now; queriesForQPS = 0; } void countQuery() {
private void setServerMetrics(HttpResponseStatisticsCollector statisticsCollector) { long timeSinceStarted = System.currentTimeMillis() - timeStarted; metric.set(Metrics.STARTED_MILLIS, timeSinceStarted, null); addResponseMetrics(statisticsCollector); }
private void addLatency(long latency, Metric.Context metricContext) { //myStats.addLatency(latency); queryLatency.put(latency); metric.set(QUERY_LATENCY_METRIC, latency, metricContext); metric.set(MEAN_QUERY_LATENCY_METRIC, latency, metricContext); maxQueryLatency.put(latency); metric.set(MAX_QUERY_LATENCY_METRIC, latency, metricContext); queryLatencyBuckets.put(latency); }
private void setTimeToFirstByteFirstTime() { boolean isFirstWrite = firstSetOfTimeToFirstByte.getAndSet(false); if (isFirstWrite) { long timeToFirstByte = getRequestLatency(); metric.set(Metrics.TIME_TO_FIRST_BYTE, timeToFirstByte, context); } }
void reportMetrics() { try { Instant expirationTime = getExpirationTime(credentials); Duration remainingLifetime = Duration.between(clock.instant(), expirationTime); metric.set(CERTIFICATE_EXPIRY_METRIC_NAME, remainingLifetime.getSeconds(), null); } catch (Throwable t) { log.log(LogLevel.WARNING, "Failed to update metrics: " + t.getMessage(), t); } } }
private ExecutorServiceWrapper(WorkerCompletionTimingThreadPoolExecutor wrapped, Metric metric, ProcessTerminator processTerminator, long maxThreadExecutionTimeMillis) { this.wrapped = wrapped; this.metric = metric; this.processTerminator = processTerminator; this.maxThreadExecutionTimeMillis = maxThreadExecutionTimeMillis; metric.set(MetricNames.THREAD_POOL_SIZE, wrapped.getPoolSize(), null); metric.set(MetricNames.ACTIVE_THREADS, wrapped.getActiveCount(), null); metric.add(MetricNames.REJECTED_REQUEST, 0, null); metricReporter = new Thread(this::reportMetrics); metricReporter.setDaemon(true); metricReporter.start(); }
private void updateStateMetrics(List<Node> nodes) { Map<Node.State, List<Node>> nodesByState = nodes.stream() .collect(Collectors.groupingBy(Node::state)); // Metrics pr state for (Node.State state : Node.State.values()) { List<Node> nodesInState = nodesByState.getOrDefault(state, new ArrayList<>()); long size = nodesInState.stream().filter(node -> node.type() == NodeType.tenant).count(); metric.set("hostedVespa." + state.name() + "Hosts", size, null); } }
public void emitMetrics(Metric metric) { Instant now = clock.instant(); collectGcStatistics(now); cleanStatistics(now); for (Map.Entry<String, LinkedList<GcStats>> item : gcStatistics.entrySet()) { GcStats reference = item.getValue().getFirst(); GcStats latest = item.getValue().getLast(); Map<String, String> contextData = new HashMap<>(); contextData.put(DIMENSION_KEY, item.getKey()); Metric.Context gcContext = metric.createContext(contextData); metric.set(GC_COUNT, latest.count - reference.count, gcContext); metric.set(GC_TIME, latest.totalRuntime.minus(reference.totalRuntime).toMillis(), gcContext); } }
public void successfulWrite(int numBytes) { setTimeToFirstByteFirstTime(); metric.add(Metrics.NUM_SUCCESSFUL_WRITES, 1, context); metric.set(Metrics.NUM_BYTES_SENT, numBytes, context); }
private void setConnectorMetrics(JDiscServerConnector connector) { ServerConnectionStatistics statistics = connector.getStatistics(); metric.set(Metrics.NUM_CONNECTIONS, statistics.getConnectionsTotal(), connector.getConnectorMetricContext()); metric.set(Metrics.NUM_OPEN_CONNECTIONS, statistics.getConnections(), connector.getConnectorMetricContext()); metric.set(Metrics.NUM_CONNECTIONS_OPEN_MAX, statistics.getConnectionsMax(), connector.getConnectorMetricContext()); metric.set(Metrics.CONNECTION_DURATION_MAX, statistics.getConnectionDurationMax(), connector.getConnectorMetricContext()); metric.set(Metrics.CONNECTION_DURATION_MEAN, statistics.getConnectionDurationMean(), connector.getConnectorMetricContext()); metric.set(Metrics.CONNECTION_DURATION_STD_DEV, statistics.getConnectionDurationStdDev(), connector.getConnectorMetricContext()); }
public void failedResponse() { setTimeToFirstByteFirstTime(); metric.set(Metrics.TOTAL_FAILED_LATENCY, getRequestLatency(), context); metric.add(Metrics.NUM_FAILED_RESPONSES, 1, context); }
public void successfulResponse() { setTimeToFirstByteFirstTime(); long requestLatency = getRequestLatency(); metric.set(Metrics.TOTAL_SUCCESSFUL_LATENCY, requestLatency, context); metric.add(Metrics.NUM_SUCCESSFUL_RESPONSES, 1, context); }
@Override public ContentChannel handleResponse(Response response) { if ( tryHasResponded()) throw new IllegalStateException("Response already handled"); ContentChannel cc = responseHandler.handleResponse(response); long millis = request.timeElapsed(TimeUnit.MILLISECONDS); metric.set("handled.latency", millis, contextFor(request.getBindingMatch())); return cc; }