From ccd540cf838a59a9ac5bf40e1a628a0811673a4e Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Thu, 14 Mar 2019 11:22:52 -0700 Subject: [PATCH 1/8] Metrics: Add specs on Gauge APIs --- metrics/Gauge.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 metrics/Gauge.md diff --git a/metrics/Gauge.md b/metrics/Gauge.md new file mode 100644 index 0000000..175d88d --- /dev/null +++ b/metrics/Gauge.md @@ -0,0 +1,80 @@ +# Gauge API Overview +A `Gauge` is used to record already aggregated metrics, or metrics that can go up and down. Typical examples of gauges would be the number of jobs/entries in a queue or number of threads in a running state. + +The `Gauge` values can be negative. This document describes the key types and the overall bahavior of API. + +## Gauge API + +The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This API is useful when you want to manually increase and decrease values as per service requirements. + +The following general operations MUST be provided by the API: +* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to getOrcreate time series, remove time series and clear all time series. + * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. + * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". + * `unit`: a string describing the unit used for the metric. Follows the format described by +[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). + * `labelKeys`: the list of the label keys to track different types of metric. + * `constantLabels`: the map of label keys and label values. +* Add a new time series with label values, which returns a `Point` (which is part of the `TimeSeries`). Each point represents an instantaneous measurement of a varying gauge value. Each Gauge Metric has one or more time series for a single metric. + * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. +* The `Point` class should provide functionalities to manually increment/decrement values. Example: `add(long amt)`, `set(long value)`. +* Remove a single time series from the gauge metric, if it is present. + * `labelValues`: the list of label values. +* Clear all time series from the gauge metric i.e. References to all previous point objects are invalid (not part of the metric). +* Get a default time series for a gauge with all labels not set, or default labels. + +Example in Java: +```java +private static final MetricRegistry metricRegistry = Metrics.getMetricRegistry(); + +List labelKeys = Arrays.asList(LabelKey.create("key1", "description")); +List labelValues = Arrays.asList(LabelValue.create("queue1")); + +LongGauge gauge = metricRegistry.addLongGauge("queue_size", "The number of jobs", "1", labelKeys); +LongPoint point = gauge.getOrCreateTimeSeries(labelValues); + +void doSomeWork() { + point.set(15); +} +``` +It is recommended to keep a reference of a point for manual operations instead of always calling `getOrCreateTimeSeries` method. + +## Derived Gauge API + +The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The implementation should keep a `WeakReference` to the object and it is the user's responsibility to manage the lifetime of the object. + +The following general operations MUST be provided by the API: +* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. + * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. + * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". + * `unit`: a string describing the unit used for the metric. Follows the format described by +[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). + * `labelKeys`: the list of the label keys to track different types of metric. + * `constantLabels`: the map of label keys and label values. +* Add a new time series with label values, an `object` and a `callback function`. The number of label values must be the same to that of the label keys. + * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. + * `obj`: the state object from which the function derives a measurement. + * `function`: the callback function to be called. +* Remove a single time series from the gauge metric, if it is present. + * `labelValues`: the list of label values. +* Clear all time series from the gauge metric i.e. References to all previous point objects are invalid (not part of the metric). + +Example in Java: +```java +private static final MetricRegistry metricRegistry = Metrics.getMetricRegistry(); + +List labelKeys = Arrays.asList(LabelKey.create("key1", "description")); +List labelValues = Arrays.asList(LabelValue.create("value1")); + +DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge( + "vm_cpu_cycles", "Virtual cycles executed on VM", "1", labelKeys); +CpuInfo cpuInfo = new CpuInfo(); + +gauge.createTimeSeries(labelValues, cpuInfo, + new ToDoubleFunction() { + {@literal @}Override + public double applyAsDouble(CpuInfo cpuInfo) { + return cpuInfo.cycles(); + } + }); +``` From 1280e1ffce72ecc16e1a165f0e2844e8bb129199 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Thu, 14 Mar 2019 13:35:43 -0700 Subject: [PATCH 2/8] Fix review comment --- metrics/Gauge.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index 175d88d..26deb2f 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -1,5 +1,5 @@ -# Gauge API Overview -A `Gauge` is used to record already aggregated metrics, or metrics that can go up and down. Typical examples of gauges would be the number of jobs/entries in a queue or number of threads in a running state. +# Gauge Overview +A `Gauge` is used to record aggregated metrics that can go up and down. Typical examples of gauges would be the number of jobs/entries in a queue, number of threads in a running state or current memory usage etc. The `Gauge` values can be negative. This document describes the key types and the overall bahavior of API. @@ -8,7 +8,7 @@ The `Gauge` values can be negative. This document describes the key types and th The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This API is useful when you want to manually increase and decrease values as per service requirements. The following general operations MUST be provided by the API: -* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to getOrcreate time series, remove time series and clear all time series. +* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". * `unit`: a string describing the unit used for the metric. Follows the format described by From 44b06b74e55bd1ce003f0e9600c1f19ed998d419 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Fri, 15 Mar 2019 12:37:01 -0700 Subject: [PATCH 3/8] Add Resource, constantLabels and builder for java example --- metrics/Gauge.md | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index 26deb2f..df07256 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -8,13 +8,14 @@ The `Gauge` values can be negative. This document describes the key types and th The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This API is useful when you want to manually increase and decrease values as per service requirements. The following general operations MUST be provided by the API: -* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. +* Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". - * `unit`: a string describing the unit used for the metric. Follows the format described by + * `unit`: a string describing the unit used for the metric (default set to "1"). Follows the format described by [Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). * `labelKeys`: the list of the label keys to track different types of metric. - * `constantLabels`: the map of label keys and label values. + * `constantLabels`: the map of label keys and label values. The keys in `labelKeys` must not be present in this map. + * `resource`: the optional associated monitored resource information. * Add a new time series with label values, which returns a `Point` (which is part of the `TimeSeries`). Each point represents an instantaneous measurement of a varying gauge value. Each Gauge Metric has one or more time series for a single metric. * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. * The `Point` class should provide functionalities to manually increment/decrement values. Example: `add(long amt)`, `set(long value)`. @@ -29,8 +30,14 @@ private static final MetricRegistry metricRegistry = Metrics.getMetricRegistry() List labelKeys = Arrays.asList(LabelKey.create("key1", "description")); List labelValues = Arrays.asList(LabelValue.create("queue1")); +LabelKey constantLabelKey = LabelKey.create("hostname", "hostname"); +LabelValue constantLabelValue = LabelValue.create("localhost"); -LongGauge gauge = metricRegistry.addLongGauge("queue_size", "The number of jobs", "1", labelKeys); +Map constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue); + +LongGauge gauge = metricRegistry.addLongGauge().toBuilder() + .setName("queue_size").setDescription("The number of jobs") + .setLabelKeys(labelKeys).setConstantLabels(constantLabels).build(); LongPoint point = gauge.getOrCreateTimeSeries(labelValues); void doSomeWork() { @@ -44,16 +51,17 @@ It is recommended to keep a reference of a point for manual operations instead o The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The implementation should keep a `WeakReference` to the object and it is the user's responsibility to manage the lifetime of the object. The following general operations MUST be provided by the API: -* Defining a `name`, `description`, `unit`, `labelKeys` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. +* Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". - * `unit`: a string describing the unit used for the metric. Follows the format described by + * `unit`: a string describing the unit used for the metric (default set to "1"). Follows the format described by [Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). * `labelKeys`: the list of the label keys to track different types of metric. - * `constantLabels`: the map of label keys and label values. + * `constantLabels`: the map of label keys and label values. The keys in `labelKeys` must not be present in this map. + * `resource`: the optional associated monitored resource information. * Add a new time series with label values, an `object` and a `callback function`. The number of label values must be the same to that of the label keys. * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. - * `obj`: the state object from which the function derives a measurement. + * `object`: the state object from which the function derives a measurement. * `function`: the callback function to be called. * Remove a single time series from the gauge metric, if it is present. * `labelValues`: the list of label values. @@ -65,10 +73,14 @@ private static final MetricRegistry metricRegistry = Metrics.getMetricRegistry() List labelKeys = Arrays.asList(LabelKey.create("key1", "description")); List labelValues = Arrays.asList(LabelValue.create("value1")); +LabelKey constantLabelKey = LabelKey.create("hostname", "hostname"); +LabelValue constantLabelValue = LabelValue.create("localhost"); + +Map constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue); -DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge( - "vm_cpu_cycles", "Virtual cycles executed on VM", "1", labelKeys); -CpuInfo cpuInfo = new CpuInfo(); +DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge().toBuilder() + .setName("vm_cpu_cycles").setDescription("Virtual cycles executed on VM") + .setLabelKeys(labelKeys).setConstantLabels(constantLabels).build(); gauge.createTimeSeries(labelValues, cpuInfo, new ToDoubleFunction() { From 9574aa855a3b6fac96de1d51f6bfc34ed5bf6633 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Mon, 18 Mar 2019 17:08:58 -0700 Subject: [PATCH 4/8] each on new a separate line --- metrics/Gauge.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index df07256..9dc2c48 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -35,9 +35,13 @@ LabelValue constantLabelValue = LabelValue.create("localhost"); Map constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue); -LongGauge gauge = metricRegistry.addLongGauge().toBuilder() - .setName("queue_size").setDescription("The number of jobs") - .setLabelKeys(labelKeys).setConstantLabels(constantLabels).build(); +LongGauge gauge = metricRegistry.longGaugeBuilder() + .setName("queue_size") + .setDescription("The number of jobs") + .setLabelKeys(labelKeys) + .setConstantLabels(constantLabels) + .build(); + LongPoint point = gauge.getOrCreateTimeSeries(labelValues); void doSomeWork() { @@ -78,9 +82,12 @@ LabelValue constantLabelValue = LabelValue.create("localhost"); Map constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue); -DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge().toBuilder() - .setName("vm_cpu_cycles").setDescription("Virtual cycles executed on VM") - .setLabelKeys(labelKeys).setConstantLabels(constantLabels).build(); +DerivedDoubleGauge gauge = metricRegistry.derivedDoubleGaugeBuilder() + .setName("vm_cpu_cycles") + .setDescription("Virtual cycles executed on VM") + .setLabelKeys(labelKeys) + .setConstantLabels(constantLabels) + .build(); gauge.createTimeSeries(labelValues, cpuInfo, new ToDoubleFunction() { From 1c7ff7a51e4065f93ab0e2a69d95e2a322759707 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Tue, 19 Mar 2019 14:39:44 -0700 Subject: [PATCH 5/8] fix typo --- metrics/Gauge.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index 9dc2c48..25231bb 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -1,7 +1,7 @@ # Gauge Overview A `Gauge` is used to record aggregated metrics that can go up and down. Typical examples of gauges would be the number of jobs/entries in a queue, number of threads in a running state or current memory usage etc. -The `Gauge` values can be negative. This document describes the key types and the overall bahavior of API. +The `Gauge` values can be negative. This document describes the key types and the overall behavior of API. ## Gauge API From d5ef933f5a61da0ad1609b4f373ab584d2cb5afb Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Tue, 19 Mar 2019 15:07:02 -0700 Subject: [PATCH 6/8] Remove Java specific details --- metrics/Gauge.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index 25231bb..520058f 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -52,7 +52,7 @@ It is recommended to keep a reference of a point for manual operations instead o ## Derived Gauge API -The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The implementation should keep a `WeakReference` to the object and it is the user's responsibility to manage the lifetime of the object. +The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The following general operations MUST be provided by the API: * Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. From 4af1cdb260452cf7068deb37c14c03a85cd0ea68 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Wed, 27 Mar 2019 17:54:12 -0700 Subject: [PATCH 7/8] add optional params --- metrics/Gauge.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index 520058f..bbf2493 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -10,12 +10,12 @@ The value that is published for gauges is an instantaneous measurement of an `in The following general operations MUST be provided by the API: * Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. - * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". - * `unit`: a string describing the unit used for the metric (default set to "1"). Follows the format described by -[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). - * `labelKeys`: the list of the label keys to track different types of metric. - * `constantLabels`: the map of label keys and label values. The keys in `labelKeys` must not be present in this map. - * `resource`: the optional associated monitored resource information. + * `description`: an optional string describing the metric, e.g."Virtual cycles executed on VM". The default is set to "". + * `unit`: an optional string describing the unit used for the metric. Follows the format described by +[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). The default set to "1". + * `labelKeys`: an optional list of the label keys to track different types of metric. The default is set to empty list. + * `constantLabels`: an optional map of label keys and label values. The default is set to empty map. + * `resource`: an optional associated monitored resource information. * Add a new time series with label values, which returns a `Point` (which is part of the `TimeSeries`). Each point represents an instantaneous measurement of a varying gauge value. Each Gauge Metric has one or more time series for a single metric. * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. * The `Point` class should provide functionalities to manually increment/decrement values. Example: `add(long amt)`, `set(long value)`. @@ -48,7 +48,7 @@ void doSomeWork() { point.set(15); } ``` -It is recommended to keep a reference of a point for manual operations instead of always calling `getOrCreateTimeSeries` method. +It is recommended to keep a reference of a point for manual operations instead of always calling `getOrCreateTimeSeries` method. The keys in `labelKeys` must not be present in `constantLabels` map. Also, `constantLabels` will be added to all the timeseries for the Metric. ## Derived Gauge API @@ -57,12 +57,12 @@ The value that is published for gauges is an instantaneous measurement of an `in The following general operations MUST be provided by the API: * Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. - * `description`: a string describing the metric, e.g."Virtual cycles executed on VM". - * `unit`: a string describing the unit used for the metric (default set to "1"). Follows the format described by -[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). - * `labelKeys`: the list of the label keys to track different types of metric. - * `constantLabels`: the map of label keys and label values. The keys in `labelKeys` must not be present in this map. - * `resource`: the optional associated monitored resource information. + * `description`: an optional string describing the metric, e.g."Virtual cycles executed on VM". The default is set to "". + * `unit`: an optional string describing the unit used for the metric. Follows the format described by +[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). The default set to "1". + * `labelKeys`: an optional list of the label keys to track different types of metric. The default is set to empty list. + * `constantLabels`: an optional map of label keys and label values. The default is set to empty map. + * `resource`: an optional associated monitored resource information. * Add a new time series with label values, an `object` and a `callback function`. The number of label values must be the same to that of the label keys. * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. * `object`: the state object from which the function derives a measurement. From a936c9fc8ca6d93ce978dc4476106c1a1f29a43a Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Mon, 1 Apr 2019 13:37:10 -0700 Subject: [PATCH 8/8] Fix review comments --- metrics/Gauge.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/metrics/Gauge.md b/metrics/Gauge.md index bbf2493..816176d 100644 --- a/metrics/Gauge.md +++ b/metrics/Gauge.md @@ -8,6 +8,7 @@ The `Gauge` values can be negative. This document describes the key types and th The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This API is useful when you want to manually increase and decrease values as per service requirements. The following general operations MUST be provided by the API: + * Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. * `description`: an optional string describing the metric, e.g."Virtual cycles executed on VM". The default is set to "". @@ -43,7 +44,7 @@ LongGauge gauge = metricRegistry.longGaugeBuilder() .build(); LongPoint point = gauge.getOrCreateTimeSeries(labelValues); - + void doSomeWork() { point.set(15); } @@ -55,14 +56,14 @@ It is recommended to keep a reference of a point for manual operations instead o The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The following general operations MUST be provided by the API: + * Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back gauge object to add new time series, remove time series and clear all time series. - * `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. - * `description`: an optional string describing the metric, e.g."Virtual cycles executed on VM". The default is set to "". - * `unit`: an optional string describing the unit used for the metric. Follows the format described by -[Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html). The default set to "1". - * `labelKeys`: an optional list of the label keys to track different types of metric. The default is set to empty list. - * `constantLabels`: an optional map of label keys and label values. The default is set to empty map. - * `resource`: an optional associated monitored resource information. + * `name`: same as above name. + * `description`: same as above description. + * `unit`: same as above unit. + * `labelKeys`: same as above labelKeys. + * `constantLabels`: same as above constantLabels. + * `resource`: same as above resource. * Add a new time series with label values, an `object` and a `callback function`. The number of label values must be the same to that of the label keys. * `labelValues`: the list of label values. The number of label values must be the same to that of the label keys. * `object`: the state object from which the function derives a measurement.