-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement different metric types, add API and aggregator * Fix typos, make executorService volatile * Move from Calendar to long timestamps, add hooks for testing * Rename to metrics, have Sentry.metrics() as entry point * Add more tests, use cr32 for hashing strings * Enrich tags, add more tests * Cleanup tests and timing API, remove uneeded threadlocal * Update changelog * Move default tag generation to IMetricsHub, improve dx * Cleanup * Cleanup * Fix remove duplicate metricAggregator.close call * Address PR feedback * Move test into metrics helper * Rename getValues to serialize to match API spec * Add support for force-flushing metrics when weight is too high * Update Changelog * Revert "Add support for force-flushing metrics when weight is too high" This reverts commit 6a3be45. * Fix .api * Fix tests * Fix remove test code * Replace tag values with empty string * Address PR feedback * Format & API * Fix tests * Force flush metrics when aggregator exceeds max weight (#3220) * Update Changelog * Revert "Revert "Add support for force-flushing metrics when weight is too high"" This reverts commit 07fc4e5. * Fix changelog * Address PR feedback * Fix tests * Fix remove test code * Address PR feedback * Update Changelog
- Loading branch information
Showing
42 changed files
with
3,251 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package io.sentry; | ||
|
||
import java.io.Closeable; | ||
import java.util.Map; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface IMetricsAggregator extends Closeable { | ||
|
||
/** | ||
* Emits a Counter metric | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param value The value to be added | ||
* @param unit An optional unit, see {@link MeasurementUnit} | ||
* @param tags Optional Tags to associate with the metric | ||
* @param timestampMs The time when the metric was emitted. Defaults to the time at which the | ||
* metric is emitted, if no value is provided. | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void increment( | ||
final @NotNull String key, | ||
final double value, | ||
final @Nullable MeasurementUnit unit, | ||
final @Nullable Map<String, String> tags, | ||
final long timestampMs, | ||
final int stackLevel); | ||
|
||
/** | ||
* Emits a Gauge metric | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param value The value to be added | ||
* @param unit An optional unit, see {@link MeasurementUnit} | ||
* @param tags Optional Tags to associate with the metric | ||
* @param timestampMs The time when the metric was emitted. Defaults to the time at which the | ||
* metric is emitted, if no value is provided. | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void gauge( | ||
final @NotNull String key, | ||
final double value, | ||
final @Nullable MeasurementUnit unit, | ||
final @Nullable Map<String, String> tags, | ||
final long timestampMs, | ||
final int stackLevel); | ||
|
||
/** | ||
* Emits a Distribution metric | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param value The value to be added | ||
* @param unit An optional unit, see {@link MeasurementUnit} | ||
* @param tags Optional Tags to associate with the metric | ||
* @param timestampMs The time when the metric was emitted. Defaults to the time at which the | ||
* metric is emitted, if no value is provided. | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void distribution( | ||
final @NotNull String key, | ||
final double value, | ||
final @Nullable MeasurementUnit unit, | ||
final @Nullable Map<String, String> tags, | ||
final long timestampMs, | ||
final int stackLevel); | ||
|
||
/** | ||
* Emits a Set metric | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param value The value to be added | ||
* @param unit An optional unit, see {@link MeasurementUnit} | ||
* @param tags Optional Tags to associate with the metric | ||
* @param timestampMs The time when the metric was emitted. Defaults to the time at which the | ||
* metric is emitted, if no value is provided. | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void set( | ||
final @NotNull String key, | ||
final int value, | ||
final @Nullable MeasurementUnit unit, | ||
final @Nullable Map<String, String> tags, | ||
final long timestampMs, | ||
final int stackLevel); | ||
|
||
/** | ||
* Emits a Set metric | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param value The value to be added | ||
* @param unit An optional unit, see {@link MeasurementUnit} | ||
* @param tags Optional Tags to associate with the metric | ||
* @param timestampMs The time when the metric was emitted. Defaults to the time at which the | ||
* metric is emitted, if no value is provided. | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void set( | ||
final @NotNull String key, | ||
final @NotNull String value, | ||
final @Nullable MeasurementUnit unit, | ||
final @Nullable Map<String, String> tags, | ||
final long timestampMs, | ||
final int stackLevel); | ||
|
||
/** | ||
* Emits a distribution with the time it takes to run a given code block. | ||
* | ||
* @param key A unique key identifying the metric | ||
* @param callback The code block to measure | ||
* @param unit An optional unit, see {@link MeasurementUnit.Duration}, defaults to seconds | ||
* @param tags Optional Tags to associate with the metric | ||
* @param stackLevel Optional number of stacks levels to ignore when determining the code location | ||
*/ | ||
void timing( | ||
final @NotNull String key, | ||
final @NotNull Runnable callback, | ||
final @NotNull MeasurementUnit.Duration unit, | ||
final @Nullable Map<String, String> tags, | ||
final int stackLevel); | ||
|
||
void flush(boolean force); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.