Skip to content

Commit 6709017

Browse files
brettmcjack-berg
andauthored
adding instrumentation configuration (#91)
* adding instrumentation configuration * organise general instrumentation config by semconv * update peer service mapping example * Apply suggestions from code review Co-authored-by: jack-berg <[email protected]> * adding comments, sections for all languages * expand logback example config, comments * Add all surface area, docs to kitchen-sink.yaml, use consistent case for property keys, remove db semconv options. * Fix typo --------- Co-authored-by: jack-berg <[email protected]> Co-authored-by: Jack Berg <[email protected]>
1 parent 9c6803a commit 6709017

File tree

4 files changed

+243
-0
lines changed

4 files changed

+243
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
* Adding initial instrumentation configuration schema
6+
57
## [v0.2.0] - 2024-05-08
68

79
* Document time value units in kitchen-sink example. [#51](https://github.com/open-telemetry/opentelemetry-configuration/pull/51)

examples/kitchen-sink.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,107 @@ resource:
434434
- process.command_args
435435
# Configure the resource schema URL.
436436
schema_url: https://opentelemetry.io/schemas/1.16.0
437+
438+
# Configure instrumentation.
439+
instrumentation:
440+
# Configure general SemConv options that may apply to multiple languages and instrumentations.
441+
#
442+
# Instrumenation may merge general config options with the language specific configuration at .instrumentation.<language>.
443+
general:
444+
# Configure instrumentations following the peer semantic conventions.
445+
#
446+
# See peer semantic conventions: https://opentelemetry.io/docs/specs/semconv/attributes-registry/peer/
447+
peer:
448+
# Configure the service mapping for instrumentations following peer.service semantic conventions.
449+
#
450+
# Each entry is a key value pair where "peer" defines the IP address and "service" defines the corresponding logical name of the service.
451+
#
452+
# See peer.service semantic conventions: https://opentelemetry.io/docs/specs/semconv/general/attributes/#general-remote-service-attributes
453+
service_mapping:
454+
- peer: 1.2.3.4
455+
service: FooService
456+
- peer: 2.3.4.5
457+
service: BarService
458+
# Configure instrumentations following the http semantic conventions.
459+
#
460+
# See http semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/
461+
http:
462+
# Configure instrumentations following the http client semantic conventions.
463+
client:
464+
# Configure headers to capture for outbound http requests.
465+
request_captured_headers:
466+
- Content-Type
467+
- Accept
468+
# Configure headers to capture for outbound http responses.
469+
response_captured_headers:
470+
- Content-Type
471+
- Content-Encoding
472+
# Configure instrumentations following the http server semantic conventions.
473+
server:
474+
# Configure headers to capture for inbound http requests.
475+
request_captured_headers:
476+
- Content-Type
477+
- Accept
478+
# Configure headers to capture for outbound http responses.
479+
response_captured_headers:
480+
- Content-Type
481+
- Content-Encoding
482+
# Configure language-specific instrumentation libraries.
483+
#
484+
# Keys may refer to instrumentation libraries or collections of related configuration. Because there is no central schema defining the keys or their contents, instrumentation must carefully document their schema and avoid key collisions with other instrumentations.
485+
#
486+
# Configure C++ language-specific instrumentation libraries.
487+
cpp:
488+
# Configure the instrumentation corresponding to key "example".
489+
example:
490+
property: "value"
491+
# Configure .NET language-specific instrumentation libraries.
492+
dotnet:
493+
# Configure the instrumentation corresponding to key "example".
494+
example:
495+
property: "value"
496+
# Configure Erlang language-specific instrumentation libraries.
497+
erlang:
498+
# Configure the instrumentation corresponding to key "example".
499+
example:
500+
property: "value"
501+
# Configure Go language-specific instrumentation libraries.
502+
go:
503+
# Configure the instrumentation corresponding to key "example".
504+
example:
505+
property: "value"
506+
# Configure Java language-specific instrumentation libraries.
507+
java:
508+
# Configure the instrumentation corresponding to key "example".
509+
example:
510+
property: "value"
511+
# Configure JavaScript language-specific instrumentation libraries.
512+
js:
513+
# Configure the instrumentation corresponding to key "example".
514+
example:
515+
property: "value"
516+
# Configure PHP language-specific instrumentation libraries.
517+
php:
518+
# Configure the instrumentation corresponding to key "example".
519+
example:
520+
property: "value"
521+
# Configure Python language-specific instrumentation libraries.
522+
python:
523+
# Configure the instrumentation corresponding to key "example".
524+
example:
525+
property: "value"
526+
# Configure Ruby language-specific instrumentation libraries.
527+
ruby:
528+
# Configure the instrumentation corresponding to key "example".
529+
example:
530+
property: "value"
531+
# Configure Rust language-specific instrumentation libraries.
532+
rust:
533+
# Configure the instrumentation corresponding to key "example".
534+
example:
535+
property: "value"
536+
# Configure Swift language-specific instrumentation libraries.
537+
swift:
538+
# Configure the instrumentation corresponding to key "example".
539+
example:
540+
property: "value"

schema/instrumentation.json

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"$id": "https://opentelemetry.io/otelconfig/instrumentation.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"title": "Instrumentation",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"properties": {
8+
"general": {
9+
"$ref": "#/$defs/GeneralInstrumentation"
10+
},
11+
"cpp": {
12+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
13+
},
14+
"dotnet": {
15+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
16+
},
17+
"erlang": {
18+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
19+
},
20+
"go": {
21+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
22+
},
23+
"java": {
24+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
25+
},
26+
"js": {
27+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
28+
},
29+
"php": {
30+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
31+
},
32+
"python": {
33+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
34+
},
35+
"ruby": {
36+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
37+
},
38+
"rust": {
39+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
40+
},
41+
"swift": {
42+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
43+
}
44+
},
45+
"patternProperties": {
46+
".*": {
47+
"$ref": "#/$defs/LanguageSpecificInstrumentation"
48+
}
49+
},
50+
"$defs": {
51+
"GeneralInstrumentation": {
52+
"type": "object",
53+
"additionalProperties": false,
54+
"properties": {
55+
"peer": {
56+
"type": "object",
57+
"additionalProperties": false,
58+
"properties": {
59+
"service_mapping": {
60+
"type": "array",
61+
"items": {
62+
"type": "object",
63+
"additionalProperties": false,
64+
"properties": {
65+
"peer": {
66+
"type": "string"
67+
},
68+
"service": {
69+
"type": "string"
70+
}
71+
},
72+
"required": [
73+
"peer",
74+
"service"
75+
]
76+
}
77+
}
78+
}
79+
},
80+
"http": {
81+
"type": "object",
82+
"additionalProperties": false,
83+
"properties": {
84+
"client": {
85+
"type": "object",
86+
"additionalProperties": false,
87+
"properties": {
88+
"request_captured_headers": {
89+
"type": "array",
90+
"items": {
91+
"type": "string"
92+
}
93+
},
94+
"response_captured_headers": {
95+
"type": "array",
96+
"items": {
97+
"type": "string"
98+
}
99+
}
100+
}
101+
},
102+
"server": {
103+
"type": "object",
104+
"additionalProperties": false,
105+
"properties": {
106+
"request_captured_headers": {
107+
"type": "array",
108+
"items": {
109+
"type": "string"
110+
}
111+
},
112+
"response_captured_headers": {
113+
"type": "array",
114+
"items": {
115+
"type": "string"
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}
122+
}
123+
},
124+
"LanguageSpecificInstrumentation": {
125+
"type": "object",
126+
"additionalProperties": true,
127+
"patternProperties": {
128+
".*": {
129+
"type": "object"
130+
}
131+
}
132+
}
133+
}
134+
}

schema/opentelemetry_configuration.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
},
2929
"resource": {
3030
"$ref": "resource.json"
31+
},
32+
"instrumentation": {
33+
"$ref": "instrumentation.json"
3134
}
3235
},
3336
"required": [

0 commit comments

Comments
 (0)