You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36
Original file line number
Diff line number
Diff line change
@@ -409,6 +409,42 @@ Thread-safety for the second use case is achieved by using a ReentrantReadWriteL
409
409
With all the internal synchronization measures, however, there're still certain multi-threading use cases that are not covered by this library, which might require external synchronizations or other protection measures.
410
410
This is due to the fact that the execution order of APIs are not determined in async contexts. For example, if user needs to associate a given set of properties with a metric in each thread, the results are not guaranteed since the execution order of `putProperty()` is not determined across threads. In such cases, we recommend using a different MetricsLogger instance for different threads, so that no resources are shared and no thread-safety problem would ever happen. Note that this can often be simplified by using a ThreadLocal variable.
411
411
412
+
## Aggregation
413
+
414
+
### Built in Aggregation
415
+
416
+
There are 3 types of aggregation implemented in this library: List, Statistic Sets, and Histograms.
417
+
418
+
- List reports all values added to a metrics as a list of values.
419
+
- Statistic Sets only reports the maximum, minimum, sum, and count of values added to a metric.
420
+
- Histograms use the Sparse Exponential Histogram Algorithm (SEH) to place each value added to a metric into a bin which keeps track of how many values have been added it. A histogram will report the bin values, the count of values in each bin, and a statistic set about the provided values. Note: SEH only accepts values greater than 0
421
+
422
+
There are several ways to set the aggregation type of a metric:
423
+
1. Use the `AggregationType` parameter when calling `putMetric` on `MetricsLogger`
2. By default, `MetricsLogger` will set all metrics that are added using `putMetric` without specificying an aggregation type to use List aggregation. This default behaviour can be changed to any of the other aggregation types by using a setter (it is recommended that this be done before any metrics are added to the logger because trying to change the aggregation type of an exist log with throw an error):
Custom histograms can also be created if the sparse exponential histogram algorithm is not the best for the given data. To do this use the `HistogramMetric` class.
0 commit comments