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
{{ message }}
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: gdi/opentelemetry/components/metrics-generation-processor.rst
+77-11Lines changed: 77 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,19 @@ Metrics generation processor
7
7
.. meta::
8
8
:description: Creates new metrics using existing metrics following a given rule.
9
9
10
-
The Splunk Distribution of the OpenTelemetry Collector uses the Metrics transform processor to creates new metrics using existing metrics following a given rule.
10
+
The Splunk Distribution of the OpenTelemetry Collector uses the Metrics Generation processor to create new metrics using existing metrics following a given rule.
11
11
12
+
This processor currently supports the following two rule types for creating a new metric:
12
13
14
+
* ``calculate``. Creates a new metric from two existing metrics by applying one of the following arithmetic operations: ``add``, ``subtract``, ``multiply``, ``divide``, or ``percent``.
13
15
16
+
* For example, use it to calculate the ``pod.memory.utilization`` metric with the equation ``pod.memory.utilization`` = (``pod.memory.usage.bytes`` / ``node.memory.limit``.
17
+
18
+
* Learn more at :ref:`metrics-generation-processor-calculate`.
19
+
20
+
* ``scale``. Creates a new metric by scaling the value of an existing metric with a given constant number.
21
+
22
+
* For example, use it to convert ``pod.memory.usage`` metric values from Megabytes to Bytes by multiplying the existing metric's value by 1,048,576.
14
23
15
24
Get started
16
25
======================
@@ -29,14 +38,31 @@ Follow these steps to configure and activate the component:
29
38
Sample configuration
30
39
--------------------------------------------
31
40
32
-
To activate the resource processor, add ``metricsgeneration`` to the ``processors`` section of your configuration file.
33
-
34
-
For example:
41
+
To activate the resource processor, add ``metricsgeneration`` to the ``processors`` section of your configuration file. Specify the configuration using a list of generation rules. Generation rules find the metrics which match the given metric names and apply the specified operation to those metrics. For example:
35
42
36
43
.. code-block:: yaml
37
44
38
45
processors:
39
46
metricsgeneration:
47
+
# specify the metric generation rules
48
+
rules:
49
+
# Name of the new metric. This is a required field.
50
+
- name: <new_metric_name>
51
+
52
+
# Unit for the new metric being generated.
53
+
unit: <new_metric_unit>
54
+
55
+
# type describes how the new metric will be generated. It can be one of `calculate` or `scale`. calculate generates a metric applying the given operation on two operand metrics. scale operates only on operand1 metric to generate the new metric.
56
+
type: {calculate, scale}
57
+
58
+
# This is a required field. This must be a gauge or sum metric.
59
+
metric1: <first_operand_metric>
60
+
61
+
# This field is required only if the type is "calculate". When required, this must be a gauge or sum metric.
62
+
metric2: <second_operand_metric>
63
+
64
+
# Operation specifies which arithmetic operation to apply. It must be one of the five supported operations.
This example creates the new metric ``pod.memory.usage.bytes`` from the metric ``pod.memory.usage.megabytes``.
98
+
99
+
.. code-block:: yaml
100
+
101
+
rules:
102
+
- name: pod.memory.usage.bytes
103
+
unit: Bytes
104
+
type: scale
105
+
metric1: pod.memory.usage.megabytes
106
+
operation: multiply
107
+
scale_by: 1048576
108
+
109
+
.. _metrics-generation-processor-calculate:
110
+
111
+
Using the ``calculate`` rule
112
+
============================================
113
+
114
+
Keep in mind the following specific behaviors of the ``calculate`` metric generation rule:
115
+
116
+
* The created metric has the same type as the metric configured as the first metric.
117
+
118
+
* If the metric being created doesn't have any valid data points it will not be created. This ensures the processor doesn't emit empty new metrics.
119
+
120
+
* If you want to have metric calculations done on data points whose overlapping attributes match, enable the feature gate ``metricsgeneration.MatchAttributes``. This feature gate is disabled by default, meaning the value used for the second metric during the calculations is simply the first data point's value.
121
+
122
+
* To learn how to enable and disable feature gates, see :new-page:`Collector Feature Gates <https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md>` in GitHub.
55
123
56
124
.. _metrics-generation-processor-settings:
57
125
58
126
Settings
59
127
======================
60
128
61
-
The following table shows the configuration options for the ``metricstransform`` processor:
129
+
The following table shows the configuration options for the ``metricsgeneration`` processor:
0 commit comments