Skip to content

Commit

Permalink
adding instrumentation configuration (#91)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Jun 17, 2024
1 parent 9c6803a commit 6709017
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Adding initial instrumentation configuration schema

## [v0.2.0] - 2024-05-08

* Document time value units in kitchen-sink example. [#51](https://github.com/open-telemetry/opentelemetry-configuration/pull/51)
Expand Down
104 changes: 104 additions & 0 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,107 @@ resource:
- process.command_args
# Configure the resource schema URL.
schema_url: https://opentelemetry.io/schemas/1.16.0

# Configure instrumentation.
instrumentation:
# Configure general SemConv options that may apply to multiple languages and instrumentations.
#
# Instrumenation may merge general config options with the language specific configuration at .instrumentation.<language>.
general:
# Configure instrumentations following the peer semantic conventions.
#
# See peer semantic conventions: https://opentelemetry.io/docs/specs/semconv/attributes-registry/peer/
peer:
# Configure the service mapping for instrumentations following peer.service semantic conventions.
#
# Each entry is a key value pair where "peer" defines the IP address and "service" defines the corresponding logical name of the service.
#
# See peer.service semantic conventions: https://opentelemetry.io/docs/specs/semconv/general/attributes/#general-remote-service-attributes
service_mapping:
- peer: 1.2.3.4
service: FooService
- peer: 2.3.4.5
service: BarService
# Configure instrumentations following the http semantic conventions.
#
# See http semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/
http:
# Configure instrumentations following the http client semantic conventions.
client:
# Configure headers to capture for outbound http requests.
request_captured_headers:
- Content-Type
- Accept
# Configure headers to capture for outbound http responses.
response_captured_headers:
- Content-Type
- Content-Encoding
# Configure instrumentations following the http server semantic conventions.
server:
# Configure headers to capture for inbound http requests.
request_captured_headers:
- Content-Type
- Accept
# Configure headers to capture for outbound http responses.
response_captured_headers:
- Content-Type
- Content-Encoding
# Configure language-specific instrumentation libraries.
#
# 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.
#
# Configure C++ language-specific instrumentation libraries.
cpp:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure .NET language-specific instrumentation libraries.
dotnet:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Erlang language-specific instrumentation libraries.
erlang:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Go language-specific instrumentation libraries.
go:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Java language-specific instrumentation libraries.
java:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure JavaScript language-specific instrumentation libraries.
js:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure PHP language-specific instrumentation libraries.
php:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Python language-specific instrumentation libraries.
python:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Ruby language-specific instrumentation libraries.
ruby:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Rust language-specific instrumentation libraries.
rust:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
# Configure Swift language-specific instrumentation libraries.
swift:
# Configure the instrumentation corresponding to key "example".
example:
property: "value"
134 changes: 134 additions & 0 deletions schema/instrumentation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"$id": "https://opentelemetry.io/otelconfig/instrumentation.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Instrumentation",
"type": "object",
"additionalProperties": false,
"properties": {
"general": {
"$ref": "#/$defs/GeneralInstrumentation"
},
"cpp": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"dotnet": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"erlang": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"go": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"java": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"js": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"php": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"python": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"ruby": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"rust": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
},
"swift": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
}
},
"patternProperties": {
".*": {
"$ref": "#/$defs/LanguageSpecificInstrumentation"
}
},
"$defs": {
"GeneralInstrumentation": {
"type": "object",
"additionalProperties": false,
"properties": {
"peer": {
"type": "object",
"additionalProperties": false,
"properties": {
"service_mapping": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"peer": {
"type": "string"
},
"service": {
"type": "string"
}
},
"required": [
"peer",
"service"
]
}
}
}
},
"http": {
"type": "object",
"additionalProperties": false,
"properties": {
"client": {
"type": "object",
"additionalProperties": false,
"properties": {
"request_captured_headers": {
"type": "array",
"items": {
"type": "string"
}
},
"response_captured_headers": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"server": {
"type": "object",
"additionalProperties": false,
"properties": {
"request_captured_headers": {
"type": "array",
"items": {
"type": "string"
}
},
"response_captured_headers": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"LanguageSpecificInstrumentation": {
"type": "object",
"additionalProperties": true,
"patternProperties": {
".*": {
"type": "object"
}
}
}
}
}
3 changes: 3 additions & 0 deletions schema/opentelemetry_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
},
"resource": {
"$ref": "resource.json"
},
"instrumentation": {
"$ref": "instrumentation.json"
}
},
"required": [
Expand Down

0 comments on commit 6709017

Please sign in to comment.