@@ -83,7 +83,6 @@ benefits of context inference while providing granular control over statement
83
83
configurations, such as ` error_mode` and `conditions`. For example, consider the
84
84
following configuration :
85
85
86
- <!-- prettier-ignore-start -->
87
86
` ` ` yaml
88
87
metric_statements:
89
88
- context: datapoint
@@ -92,35 +91,31 @@ metric_statements:
92
91
statements:
93
92
- set(metric.description, "counter") where attributes["my.attr"] == "some"
94
93
` ` `
95
- <!-- prettier-ignore-end -->
96
94
97
95
The above can now be written as :
98
96
99
- <!-- prettier-ignore-start -->
97
+ <!-- prettier-ignore -->
100
98
` ` ` yaml
101
99
metric_statements:
102
100
- conditions:
103
101
- resource.attributes["service.name"] == "my.service"
104
102
statements:
105
103
- set(metric.description, "counter") where datapoint.attributes["my.attr"] == "some"
106
104
` ` `
107
- <!-- prettier-ignore-end -->
108
105
109
106
In this example, the `context` value is omitted and is automatically inferred to
110
107
` datapoint` , as it is the only OTTL context present in the statements that
111
108
supports parsing both `datapoint` and `metric` data.
112
109
113
110
If we update the above configuration removing the `datapoint` usage :
114
111
115
- <!-- prettier-ignore-start -->
116
112
` ` ` yaml
117
113
metric_statements:
118
114
- conditions:
119
115
- resource.attributes["service.name"] == "my.service"
120
116
statements:
121
117
- set(metric.description, "counter")
122
118
` ` `
123
- <!-- prettier-ignore-end -->
124
119
125
120
The context inferrer would select the `metric` OTTL context instead, since no
126
121
data points are accessed. Although it would be possible to run the statements
0 commit comments