Skip to content

Commit

Permalink
Define semantic conventions yaml for non-otlp conventions
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Sep 30, 2022
1 parent 28d02cc commit e51293d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 13 deletions.
30 changes: 30 additions & 0 deletions semantic_conventions/scope/exporter/exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
groups:
- id: otel.scope
prefix: otel.scope
type: resource
brief: Span attributes used by non OTLP exporters to represent OpenTelemetry Scope's concepts.
attributes:
- id: name
type: string
brief: The name of the instrumentation scope - `InstrumentationScope.Name`.
examples: ['io.opentelemetry.contrib.mongodb']
- id: version
type: string
brief: The version of the instrumentation scope - `InstrumentationScope.Version`.
examples: ['1.0.0']
- id: otel.library
prefix: otel.library
type: resource
brief: >
Span attributes used by non OTLP exporters to represent OpenTelemetry Scope's concepts.
attributes:
- id: name
type: string
stability: "deprecated"
brief: Use `otel.scope.name` attribute.
examples: ['io.opentelemetry.contrib.mongodb']
- id: version
type: string
stability: "deprecated"
brief: Use `otel.scope.version` attribute.
examples: ['1.0.0']
21 changes: 21 additions & 0 deletions semantic_conventions/trace/exporter/exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
groups:
- id: otel
prefix: otel
type: span
brief: Span attributes used by non OTLP exporters to represent OpenTelemetry Span's concepts.
attributes:
- id: status_code
type:
allow_custom_values: true
members:
- id: ok
value: ok
brief: 'The operation has been validated by an Application developer or Operator to have completed successfully.'
- id: error
value: error
brief: 'The operation contains an error.'
brief: Name of the code, either OK or ERROR. MUST NOT be set if the status code is UNSET.
- id: status_message
type: string
brief: Description of the Status if it has a value otherwise not set.
examples: ['resource not found']
39 changes: 26 additions & 13 deletions specification/common/mapping-to-non-otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,44 @@ in this document.
OpenTelemetry `InstrumentationScope`'s fields MUST be reported as key-value
pairs associated with the Span, Metric Data Point or LogRecord using the following mapping:

| OpenTelemetry InstrumentationScope Field | non-OTLP Key | Notes |
| ------------------- | --- | --- |
| `InstrumentationScope.name`|`otel.scope.name`|since 1.10.0|
| `InstrumentationScope.version`|`otel.scope.version`|since 1.10.0|
<!-- semconv otel.scope -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `otel.scope.name` | string | The name of the instrumentation scope - `InstrumentationScope.Name`. | `io.opentelemetry.contrib.mongodb` | Recommended |
| `otel.scope.version` | string | The version of the instrumentation scope - `InstrumentationScope.Version`. | `1.0.0` | Recommended |
<!-- endsemconv -->

The following deprecated aliases MUST also be reported with exact same values for
backward compatibility reasons:

| non-OTLP Key | Alias for | Notes |
| --- | --- | --- |
|`otel.library.name`|`otel.scope.name`|deprecated since 1.10.0|
|`otel.library.version`|`otel.scope.version`|deprecated since 1.10.0|
<!-- semconv otel.library -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `otel.library.name` | string | Use `otel.scope.name` attribute. | `io.opentelemetry.contrib.mongodb` | Recommended |
| `otel.library.version` | string | Use `otel.scope.version` attribute. | `1.0.0` | Recommended |
<!-- endsemconv -->

### Span Status
### Spans

Span `Status` MUST be reported as key-value pairs associated with the Span,
unless the `Status` is `UNSET`. In the latter case it MUST NOT be reported.

The following table defines the OpenTelemetry `Status`'s mapping to Span's
key-value pairs:

|OpenTelemetry Status Field|non-OTLP Key|non-OTLP Value|
|--|--|--|
|Code | `otel.status_code` | Name of the code, either `OK` or `ERROR`. MUST NOT be set if the code is `UNSET`. |
|Description | `otel.status_description` | Description of the `Status` if it has a value otherwise not set. |
<!-- semconv otel -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `otel.status_code` | string | Name of the code, either OK or ERROR. MUST NOT be set if the status code is UNSET. | `ok` | Recommended |
| `otel.status_message` | string | Description of the Status if it has a value otherwise not set. | `resource not found` | Recommended |

`otel.status_code` has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

| Value | Description |
|---|---|
| `ok` | The operation has been validated by an Application developer or Operator to have completed successfully. |
| `error` | The operation contains an error. |
<!-- endsemconv -->

### Dropped Attributes Count

Expand Down

0 comments on commit e51293d

Please sign in to comment.