Package io.sentry.metrics
Class MetricsHelper
java.lang.Object
io.sentry.metrics.MetricsHelper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
convertNanosTo
(MeasurementUnit.Duration unit, long durationNanos) static void
encodeMetrics
(long timestamp, @NotNull Collection<Metric> metrics, @NotNull StringBuilder writer) Encodes the metricsstatic long
getCutoffTimestampMs
(long nowMs) static @NotNull String
getExportKey
(@NotNull MetricType type, @NotNull String key, @Nullable MeasurementUnit unit) Provides an export key for identifying the metric without its tags.static @NotNull String
getMetricBucketKey
(@NotNull MetricType type, @NotNull String metricKey, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) static long
getTimeBucketKey
(long timestampMs) static @NotNull String
sanitizeName
(@NotNull String input) static @NotNull String
sanitizeTagKey
(@NotNull String input) static @NotNull String
sanitizeTagValue
(@NotNull String input) static @NotNull String
sanitizeUnit
(@NotNull String unit) static void
setFlushShiftMs
(long flushShiftMs)
-
Field Details
-
FLUSHER_SLEEP_TIME_MS
public static final long FLUSHER_SLEEP_TIME_MS- See Also:
-
MAX_TOTAL_WEIGHT
public static final int MAX_TOTAL_WEIGHT- See Also:
-
-
Constructor Details
-
MetricsHelper
public MetricsHelper()
-
-
Method Details
-
getTimeBucketKey
public static long getTimeBucketKey(long timestampMs) -
getCutoffTimestampMs
public static long getCutoffTimestampMs(long nowMs) -
sanitizeUnit
-
sanitizeName
-
sanitizeTagKey
-
sanitizeTagValue
-
getMetricBucketKey
@NotNull public static @NotNull String getMetricBucketKey(@NotNull @NotNull MetricType type, @NotNull @NotNull String metricKey, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) -
getExportKey
@NotNull public static @NotNull String getExportKey(@NotNull @NotNull MetricType type, @NotNull @NotNull String key, @Nullable @Nullable MeasurementUnit unit) Provides an export key for identifying the metric without its tags. Suitable for span level metric summaries- Parameters:
type
- the metric typekey
- the metric keyunit
- the metric unit- Returns:
- the export key
-
convertNanosTo
-
encodeMetrics
public static void encodeMetrics(long timestamp, @NotNull @NotNull Collection<Metric> metrics, @NotNull @NotNull StringBuilder writer) Encodes the metricsSee github.com/statsd/statsd#usage and getsentry.github.io/relay/relay_metrics/index.html for more details about the format.
- Parameters:
timestamp
- The bucket time the metrics belong to, in second resolutionmetrics
- The metrics to encodewriter
- The writer to encode the metrics into
-
mergeTags
-
setFlushShiftMs
@TestOnly public static void setFlushShiftMs(long flushShiftMs)
-