Skip to content

Commit

Permalink
Define semantic conventions yaml for non-otlp conventions (#2850)
Browse files Browse the repository at this point in the history
* Define semantic conventions yaml for non-otlp conventions

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update semantic_conventions/trace/exporter/exporter.yaml

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>

* Update semantic_conventions/scope/exporter/exporter.yaml

Co-authored-by: Joao Grassi <joao@joaograssi.com>

* Rename otel to otel_span

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
Co-authored-by: Joao Grassi <joao@joaograssi.com>
  • Loading branch information
3 people committed Oct 25, 2022
1 parent 6d3fbe1 commit ec31d29
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 12 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: 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` in OTLP).
examples: ['io.opentelemetry.contrib.mongodb']
- id: version
type: string
brief: The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP).
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: Deprecated, use the `otel.scope.name` attribute.
examples: ['io.opentelemetry.contrib.mongodb']
- id: version
type: string
stability: "deprecated"
brief: Deprecated, use the `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_span
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: false
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_description
type: string
brief: Description of the Status if it has a value, otherwise not set.
examples: ['resource not found']
37 changes: 25 additions & 12 deletions specification/common/mapping-to-non-otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ 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` in OTLP). | `io.opentelemetry.contrib.mongodb` | Recommended |
| `otel.scope.version` | string | The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). | `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 | Deprecated, use the `otel.scope.name` attribute. | `io.opentelemetry.contrib.mongodb` | Recommended |
| `otel.library.version` | string | Deprecated, use the `otel.scope.version` attribute. | `1.0.0` | Recommended |
<!-- endsemconv -->

### Span Status

Expand All @@ -48,10 +52,19 @@ 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_span -->
| 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_description` | string | Description of the Status if it has a value, otherwise not set. | `resource not found` | Recommended |

`otel.status_code` MUST be one of the following:

| 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 ec31d29

Please sign in to comment.