@@ -589,6 +589,8 @@ Internal sinks are simple and built in as part of the metrics4j library.
589
589
590
590
591
591
##### Slf4JMetricSink
592
+ * _ log-level:_ (INFO, DEBUG, WARN, ERROR, TRACE), log level to use when reporting metrics
593
+
592
594
Reports metrics to an Slf4j logger. The log-level attribute controls the log level (DEBUG, WARN, INFO, etc).
593
595
``` hocon
594
596
sinks: {
@@ -599,9 +601,14 @@ sinks: {
599
601
}
600
602
```
601
603
602
- * _ log-level:_ (INFO, DEBUG, WARN, ERROR, TRACE), log level to use when reporting metrics
603
604
604
605
##### TelnetSink
606
+ * _ host:_ Host to connect to
607
+ * _ port:_ Port to use
608
+ * _ protocol:_ (UDP/** TCP** ) Protocol to use
609
+ * _ max-udp-packet-size:_ (** 1024** ) Max packet size when using UDP
610
+ * _ resolution:_ (SECONDS/** MILLISECONDS** ) If set to SECONDS this sink will use the 'put' command
611
+ if set to MILLISECONDS the sink will use the 'putm' command
605
612
606
613
Sends data using the telnet protocol supported by OpenTSDB and KairosDB.
607
614
@@ -619,15 +626,13 @@ sinks: {
619
626
The resolution attribute can be either SECONDS or MILLISECONDS sending either a put or putm
620
627
respectively
621
628
629
+
630
+ ##### GraphitePlaintextSink
631
+ * _ include-tags:_ includes tags for newer graphite version
622
632
* _ host:_ Host to connect to
623
633
* _ port:_ Port to use
624
634
* _ protocol:_ (UDP/** TCP** ) Protocol to use
625
635
* _ max-udp-packet-size:_ (** 1024** ) Max packet size when using UDP
626
- * _ resolution:_ (SECONDS/** MILLISECONDS** ) If set to SECONDS this sink will use the 'put' command
627
- if set to MILLISECONDS the sink will use the 'putm' command
628
-
629
-
630
- ##### GraphitePlaintextSink
631
636
632
637
Sends data using the plaintext protocol. It takes three attributes for host, port
633
638
and whether to include tags.
@@ -643,21 +648,16 @@ sinks: {
643
648
}
644
649
```
645
650
646
- * _ include-tags:_ includes tags for newer graphite version
651
+
652
+ ##### StatsDTCPSink
647
653
* _ host:_ Host to connect to
648
654
* _ port:_ Port to use
649
655
* _ protocol:_ (UDP/** TCP** ) Protocol to use
650
656
* _ max-udp-packet-size:_ (** 1024** ) Max packet size when using UDP
651
657
652
- ##### StatsDTCPSink
653
-
654
658
Sends metrics to a StatsD instance. You can also set the source property _ statsd_type_ to specify
655
659
the type of metric, it defaults to 'g'
656
660
657
- * _ host:_ Host to connect to
658
- * _ port:_ Port to use
659
- * _ protocol:_ (UDP/** TCP** ) Protocol to use
660
- * _ max-udp-packet-size:_ (** 1024** ) Max packet size when using UDP
661
661
662
662
#### External
663
663
External sinks are provided as plugins that have their own dependencies. These
@@ -668,6 +668,7 @@ The folder path is the location of the sink jar and all of its dependencies. A
668
668
class loader is used for the sink so the dependencies will not interfere with the application.
669
669
670
670
##### InfluxSink
671
+ * _ host-url:_ url endpoint for influx
671
672
672
673
External sink for sending data to InfluxDB. Because both version 1 and 2 support the same
673
674
line protocol you can switch between them by changing the host-url metrics are sent to.
@@ -682,9 +683,9 @@ sinks: {
682
683
}
683
684
```
684
685
685
- * _ host-url:_ url endpoint for influx
686
686
687
687
##### PrometheusSink
688
+ * _ listen-port:_ Port on which to listen for prometheus scrap requests
688
689
689
690
External sink that opens a port for a prometheus server to scrape the metrics from.
690
691
@@ -710,9 +711,12 @@ triggers: {
710
711
}
711
712
```
712
713
713
- * _ listen-port:_ Port on which to listen for prometheus scrap requests
714
714
715
715
##### KairosSink
716
+ * _ host-url:_ (** http://localhost ** ) Url endpoint for sending http metrics to kairosdb
717
+ * _ telnet-host:_ (** null** ) Telnet host to send metrics to kairosdb
718
+ * _ telnet-port:_ (** 4242** ) Telnet port
719
+ * _ ttl:_ (** 0s** ) Optional ttl. Can be specified like so "60s" or "24h", this can also be set as a prop in the source for specific metrics
716
720
717
721
External sink for sending data to KairosDB. Metrics can be sent either via http or telnet
718
722
by specifying the appropriate configurations.
@@ -730,12 +734,10 @@ kairos: {
730
734
Depending on which properties are set the sink will send either http or telnet using
731
735
the kairosdb client.
732
736
733
- * _ host-url:_ (** http://localhost ** ) Url endpoint for sending http metrics to kairosdb
734
- * _ telnet-host:_ (** null** ) Telnet host to send metrics to kairosdb
735
- * _ telnet-port:_ (** 4242** ) Telnet port
736
- * _ ttl:_ (** 0s** ) Optional ttl. Can be specified like so "60s" or "24h", this can also be set as a prop in the source for specific metrics
737
737
738
738
##### OtelSink
739
+ * _ endpoint:_ (** http://localhost:4317 ** ) Url for the grpc endpoint of the otlp collector.
740
+ * _ name:_ (** metrics4j** ) Service name passed as part of the instrumentation scope info.
739
741
740
742
External Open Telemetry sink for sending metrics via OTLP using grpc protocol.
741
743
@@ -750,8 +752,6 @@ sinks: {
750
752
}
751
753
```
752
754
753
- * _ endpoint:_ (** http://localhost:4317 ** ) Url for the grpc endpoint of the otlp collector.
754
- * _ name:_ (** metrics4j** ) Service name passed as part of the instrumentation scope info.
755
755
756
756
##### TimescaleDBSink
757
757
@@ -781,15 +781,19 @@ metrics4j {
781
781
```
782
782
783
783
#### BagCollector
784
+ * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
785
+ the units values are reported in. This only applies to Duration values. Can be set as a source property.
786
+ * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
787
+
784
788
This collector does not do any aggregation. Whatever value was put into the collector
785
789
is reported using the time of the put or the Instant if one was provided.
786
790
BagCollector can collect Long, Double, Duration and String values.
787
791
788
- * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
789
- the units values are reported in. This only applies to Duration values. Can be set as a source property.
790
- * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
791
792
792
793
#### Chained Collectors
794
+ * _ collectors:_ List of collectors to chain together
795
+ * _ prefixes:_ Prefix to add to each collector respectively
796
+
793
797
There is a chain collector for each type of data: ChainedDoubleCollector,
794
798
ChainedDurationCollector, ChainedLongCollector, ChainedStringCollector, ChainedTimeCollector
795
799
@@ -823,75 +827,81 @@ metric being reported was `myMetric.value`, the chain collector would report two
823
827
values ` myMetric.count.value ` and ` myMetric.max.value ` . The prefix is applied
824
828
to the last part of the metric.
825
829
826
- * _ collectors:_ List of collectors to chain together
827
- * _ prefixes:_ Prefix to add to each collector respectively
828
830
829
831
#### DoubleCounter
832
+ * _ reset:_ (true/false), when true the counter resets after reporting
833
+ * _ report-zero:_ (true/false), when set to false will not report zero values
834
+
830
835
Counts up double values to be reported. The counter can be reset when values are reported
831
836
by setting reset: true in the conf
832
837
833
- * _ reset:_ (true/false), when true the counter resets after reporting
834
- * _ report-zero:_ (true/false), when set to false will not report zero values
835
838
836
839
#### DoubleGauge
840
+ * _ reset:_ (true/false), when true the gauge sets to zero after reporting
841
+
837
842
Simple gauge that reports the most recently received value.
838
843
839
- * _ reset:_ (true/false), when true the gauge sets to zero after reporting
840
844
841
845
#### LastTime
846
+ * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
847
+ the unites values are reported in. Can be set as a source property.
848
+ * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
849
+
842
850
LastTime collects Duration metrics and when reporting it simply reports the last
843
851
Duration it received. The Duration is cleared once it is reported so it is
844
852
only reported once.
845
853
846
- * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
847
- the unites values are reported in. Can be set as a source property.
848
- * * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
849
854
850
855
#### LongCounter
856
+ * _ reset:_ (true/false), when true the counter resets after reporting
857
+ * _ report-zero:_ (true/false), when set to false will not report zero values
858
+
851
859
Counts up long values to be reported. The counter can be reset when values are reported
852
860
by setting reset: true in the conf
853
861
854
- * _ reset:_ (true/false), when true the counter resets after reporting
855
- * _ report-zero:_ (true/false), when set to false will not report zero values
856
862
857
863
#### LongGauge
864
+ * _ reset:_ (true/false), when true the gauge sets to zero after reporting
865
+
858
866
Simple gauge that reports the most recently received value.
859
867
860
- * _ reset:_ (true/false), when true the gauge sets to zero after reporting
861
868
862
869
#### MaxLongGauge
870
+ * _ reset:_ (true/false), when true the gauge sets to zero after reporting
871
+
863
872
Extends LongGauge and only stores and reports the max value over the reporting period.
864
873
865
- * _ reset:_ (true/false), when true the gauge sets to zero after reporting
866
874
867
875
#### NullCollector
868
876
If you are familiar with /dev/null, this is the same concept. A way of turning
869
877
off certain metrics.
870
878
871
879
#### PutCounter
880
+ * _ reset:_ (true/false), when true the counter resets after reporting
881
+ * _ report-zero:_ (true/false), when set to false will not report zero values
882
+
872
883
Counts the number of times the put method is called on a collector. Can be used
873
884
with any data type.
874
885
875
- * _ reset:_ (true/false), when true the counter resets after reporting
876
- * _ report-zero:_ (true/false), when set to false will not report zero values
877
886
878
887
#### SimpleStats
888
+ * _ report-zero:_ (true/false), when set to false will not report zero values
889
+
879
890
This reports the min, max, sum, count and avg for the set of values received since
880
891
last reporting.
881
892
882
- * _ report-zero:_ (true/false), when set to false will not report zero values
883
893
884
894
#### SimpleTimerMetric
895
+ * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
896
+ the units values are reported in. Can be set as a source property.
897
+ * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
898
+ * _ report-zero:_ (true/false), when set to false will not report zero values
899
+
885
900
Used for reporting measured durations. The collector reports min, max, total,
886
901
count and avg for the measurements received during the last reporting period.
887
902
Values are reported as milliseconds by default but maybe changed using the
888
903
report-unit attribute. The report-unit and report-format can also be passed as a prop in the sources.
889
904
890
- * _ report-unit:_ (NANOS, MICROS, ** MILLIS** , SECONDS, MINUTES, HOURS, DAYS), set
891
- the units values are reported in. Can be set as a source property.
892
- * _ report-format:_ (DOUBLE, ** LONG** ), set the format. Double is truncated at 3 decimals. Can be set as a source property.
893
- * _ report-zero:_ (true/false), when set to false will not report zero values
894
-
895
905
#### StringReporter
896
906
No aggregation is done in this collector. All strings are reported with the time
897
907
they were received.
@@ -903,6 +913,9 @@ provided. The deltas are recorded as a SimpleTimerMetric
903
913
Takes the same parameters as SimpleTimerMetric
904
914
905
915
#### TimestampCounter
916
+ * _ increment-frequency:_ (20000) How often in milliseconds to increment the reporting timestamp. Default 20sec.
917
+ * _ bucket-size:_ (60000) Size of timestamp counting bucket. Default 1 min.
918
+
906
919
This collector records a count of timestamps during a configurable bucket of time.
907
920
The initial use of this collector was to count events going in and out of an event
908
921
system where each event had a timestamp set when it went in.
@@ -920,8 +933,6 @@ previous counts.
920
933
For a detail description of how this works see:
921
934
https://github.com/kairosdb/metrics4j/wiki/TimestampCounter
922
935
923
- * _ increment-frequency:_ (20000) How often in milliseconds to increment the reporting timestamp. Default 20sec.
924
- * _ bucket-size:_ (60000) Size of timestamp counting bucket. Default 1 min.
925
936
926
937
### Formatters
927
938
A formatter can change the name to your liking ie. underscore vs period
@@ -930,8 +941,21 @@ in the name.
930
941
#### TemplateFormatter
931
942
class = org.kairosdb.metrics4j.formatters.TemplateFormatter
932
943
933
- Pass a template attribute where you can placeholders for className, methodName,
934
- field and specific tags.
944
+ * _ template:_ template to use when formatting metric names, see below.
945
+
946
+ TemplateFormatter lets you specify the resulting metric name using a template. Template
947
+ variables are specified using ` %{var} ` syntax.
948
+
949
+ ##### Template Variables
950
+ * _ className_ - Full class name from where the metric originated ie ` com.project.MyStats `
951
+ * _ simpleClassName_ - Just the class name ie ` MyStats `
952
+ * _ methodName_ - Name of the method called ie ` uploadTime `
953
+ * _ field_ - The field from the collector ie ` max ` or ` count `
954
+ * _ metricName_ - User specified field that is declared in the configuration. The value is
955
+ specified in configuration using ` _metric-name `
956
+ * _ tag._ - Provides a way to use a tag as part of the metric name ie ` tag.host `
957
+
958
+ Sample template configuration:
935
959
936
960
``` hocon
937
961
formatters: {
@@ -942,8 +966,8 @@ formatters: {
942
966
}
943
967
```
944
968
945
- You can also use metricName which can be specified within the source. This gives
946
- you the option to explicitly name a metrics
969
+ Sample using user defined metricName:
970
+
947
971
``` hocon
948
972
formatters.CustomFormatter: {
949
973
_class: "org.kairosdb.metrics4j.formatters.TemplateFormatter"
@@ -956,17 +980,19 @@ sources.com.kairosdb.CrazyClassNamePath: {
956
980
```
957
981
958
982
** Note** The template formatter uses ` %{} ` so as to not be confused with ` ${} ` used
959
- by hocon substitution - and so you can use both in a template. like so
983
+ by hocon substitution - you can use both in a template. like so
960
984
` template: ${metric-prefix}".%{className}.%{methodName}.%{tag.status}.%{field}" `
961
985
You only quote the template replace portion.
962
986
963
- * _ template:_ template to use when formatting metric names, see above.
964
987
965
988
### Triggers
966
989
The trigger tells metrics4j when to gather the metrics from the collectors and
967
990
report to the sinks.
968
991
969
992
#### IntervalTrigger
993
+
994
+ * _ interval:_ Set the trigger interval to gather metrics.
995
+
970
996
The IntervalTrigger lets you set a time for how often metrics are reported. The
971
997
following reports metrics every 5 seconds. The interval property is a hocon duration.
972
998
https://github.com/lightbend/config/blob/master/HOCON.md#duration-format
@@ -979,9 +1005,6 @@ triggers: {
979
1005
}
980
1006
```
981
1007
982
- * _ interval:_ Set the trigger interval to gather metrics.
983
-
984
-
985
1008
### Plugins
986
1009
987
1010
#### JMXReporter
0 commit comments