@@ -96,6 +96,22 @@ configurations:
9696 description : Enables statement sanitization for database queries.
9797 type : boolean
9898 default : true
99+ override_telemetry : false
100+ additional_telemetry :
101+ - when : " default"
102+ metrics :
103+ - name : " metric.name"
104+ description : " Metric description"
105+ type : " COUNTER"
106+ unit : " 1"
107+ attributes :
108+ - name : " attribute.name"
109+ type : " STRING"
110+ spans :
111+ - span_kind : " CLIENT"
112+ attributes :
113+ - name : " span.attribute"
114+ type : " STRING"
99115` ` `
100116
101117### Description (required)
@@ -205,6 +221,82 @@ If an instrumentation is disabled by default, set `disabled_by_default: true`. T
205221the instrumentation will not be active unless explicitly enabled by the user. If this field is omitted,
206222it defaults to `false`, meaning the instrumentation is enabled by default.
207223
224+ # ## Manual Telemetry Documentation (optional)
225+
226+ You can manually document telemetry metadata (metrics and spans) directly in the `metadata.yaml` file
227+ using the `additional_telemetry` field. This is useful for :
228+
229+ - Documenting telemetry that may not be captured during automated test runs
230+ - Adding telemetry documentation when `.telemetry` files are not available
231+ - Providing additional context or details about emitted telemetry
232+
233+ # ### additional_telemetry
234+
235+ The `additional_telemetry` field allows you to specify telemetry metadata organized by configuration
236+ conditions (`when` field) :
237+
238+ ` ` ` yaml
239+ additional_telemetry:
240+ - when: "default" # Telemetry emitted by default
241+ metrics:
242+ - name: "http.server.request.duration"
243+ description: "Duration of HTTP server requests"
244+ type: "HISTOGRAM"
245+ unit: "ms"
246+ attributes:
247+ - name: "http.method"
248+ type: "STRING"
249+ - name: "http.status_code"
250+ type: "LONG"
251+ spans:
252+ - span_kind: "SERVER"
253+ attributes:
254+ - name: "http.method"
255+ type: "STRING"
256+ - name: "http.url"
257+ type: "STRING"
258+ - when: "otel.instrumentation.example.experimental-metrics.enabled" # Telemetry enabled by configuration
259+ metrics:
260+ - name: "example.experimental.metric"
261+ description: "Experimental metric enabled by configuration"
262+ type: "COUNTER"
263+ unit: "1"
264+ ` ` `
265+
266+ Each telemetry entry includes :
267+
268+ - `when` : The configuration condition under which this telemetry is emitted. Use `"default"` for telemetry
269+ emitted by default, or specify the configuration option name for conditional telemetry.
270+ - `metrics` : List of metrics with their name, description, type, unit, and attributes
271+ - `spans` : List of span configurations with their span_kind and attributes
272+
273+ For metrics, supported `type` values include : ` COUNTER` , `GAUGE`, `HISTOGRAM`, `EXPONENTIAL_HISTOGRAM`.
274+
275+ For spans, supported `span_kind` values include : ` CLIENT` , `SERVER`, `PRODUCER`, `CONSUMER`, `INTERNAL`.
276+
277+ For attributes, supported `type` values include : ` STRING` , `LONG`, `DOUBLE`, `BOOLEAN`.
278+
279+ # ### override_telemetry
280+
281+ Set `override_telemetry : true` to completely replace any auto-generated telemetry data from `.telemetry`
282+ files. When this is enabled, only the manually documented telemetry in `additional_telemetry` will be
283+ used, and any `.telemetry` files will be ignored.
284+
285+ ` ` ` yaml
286+ override_telemetry: true
287+ additional_telemetry:
288+ - when: "default"
289+ metrics:
290+ - name: "manually.documented.metric"
291+ description: "This completely replaces auto-generated telemetry"
292+ type: "GAUGE"
293+ unit: "bytes"
294+ ` ` `
295+
296+ If `override_telemetry` is `false` or omitted (default behavior), manual telemetry will be merged with
297+ auto-generated telemetry, with manual entries taking precedence in case of conflicts (same metric name
298+ or span kind within the same `when` condition).
299+
208300# # Instrumentation List (docs/instrumentation-list.md)
209301
210302The contents of the `metadata.yaml` files are combined with other information about the instrumentation
0 commit comments