Skip to content

io microsphere metrics prometheus client sentinel SentinelCollector

github-actions[bot] edited this page Jul 17, 2026 · 2 revisions

SentinelCollector

Type: Class | Module: microsphere-observability-prometheus-metrics | Package: io.microsphere.metrics.prometheus.client.sentinel | Since: 1.0.0

Source: microsphere-observability-prometheus-metrics/src/main/java/io/microsphere/metrics/prometheus/client/sentinel/SentinelCollector.java

Overview

Prometheus Collector based on Sentinel Metrics

Declaration

public class SentinelCollector extends Collector implements ProcessorSlotEntryCallback<DefaultNode>

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.0-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-observability-prometheus-metrics</artifactId>
    <version>${microsphere-observability.version}</version>
</dependency>

Tip: Use the BOM (microsphere-observability-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.metrics.prometheus.client.sentinel.SentinelCollector;

API Reference

Public Methods

Method Description
commonLabel The prefix : "sentinel_"
collect

Method Details

commonLabel

public SentinelCollector commonLabel(String labelName, String labelValue)

The prefix : "sentinel_" / public static final String PREFIX = "sentinel_";

/** The Label name of the metrics origin : "origin" / public static final String ORIGIN_LABEL_NAME = "origin";

/** The Label name for Sentinel Resource / public static final String RESOURCE_LABEL_NAME = PREFIX + "resource";

/** The Label name for Sentinel Context / public static final String CONTEXT_LABEL_NAME = PREFIX + "context";

/** The Label name for Sentinel Resource Type / public static final String TYPE_LABEL_NAME = PREFIX + "resource_type";

/** The Label name for Sentinel Version / public static final String VERSION_LABEL_NAME = PREFIX + "version";

/** The interval time of metrics collection in milliseconds. / private final long interval;

private final List commonLabelNames;

private final List commonLabelValues;

private final ConcurrentMap resourceToContextMapping = new ConcurrentHashMap<>();

private volatile MetricSearcher metricSearcher;

public SentinelCollector(long interval) { this(interval, emptyMap()); }

public SentinelCollector(long interval, Map commonLabels) { this.interval = interval; this.commonLabelNames = initCommonLabelNames(commonLabels); this.commonLabelValues = initCommonLabelValues(commonLabels); }

See Also

  • Collector
  • ClusterBuilderSlot
  • ClusterNode
  • MetricTimerListener
  • io.microsphere.metrics.micrometer.instrument.binder.sentinel.SentinelMetrics

This documentation was auto-generated from the source code of microsphere-observability.

Clone this wiki locally