diff --git a/CHANGELOG.md b/CHANGELOG.md index 38602b4362d..c95fd82ccc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Rename `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/trace/zipkin` package. (#1985) - Rename `NewExporter` to `New` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) - Rename `NewUnstartedExporter` to `NewUnstarted` in the `go.opentelemetry.io/otel/exporters/otlp` package. (#1985) +- The `go.opentelemetry.io/otel/semconv` package has been moved to `go.opentelemetry.io/otel/semconv/v1.4.0` to allow for multiple [telemetry schema](https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md) versions to be used concurrently. (#1987) ### Deprecated diff --git a/RELEASING.md b/RELEASING.md index 63e177026cf..215e5c872bd 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -20,6 +20,19 @@ go run generator.go -i /path/to/specification/repo/semantic_conventions/trace Using default values for all options other than `input` will result in using the `template.j2` template to generate `resource.go` and `trace.go` in `/path/to/otelgo/repo/semconv/`. +There are several ancillary files that are not generated and should be copied into the new package from the +prior package, with updates made as appropriate to canonical import path statements and constant values. +These files include: + +* doc.go +* exception.go +* http(_test)?.go +* schema.go + +Uses of the previous schema version in this repository should be updated to use the newly generated version. +No tooling for this exists at present, so use find/replace in your editor of choice or craft a `grep | sed` +pipeline if you like living on the edge. + ## Pre-Release Update go.mod for submodules to depend on the new release which will happen in the next step. diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index abbe823b733..27e00c637e6 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/bridge/opentracing/migration" diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 1c9e5917cf6..97e4bacf70b 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/trace/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 932a96ec63b..9998f3adc49 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -37,7 +37,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/selector/simple" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 720e37652f5..badec69d0e7 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/trace/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/stdout/example_test.go b/exporters/stdout/example_test.go index c9151d3162b..d9a7c59de56 100644 --- a/exporters/stdout/example_test.go +++ b/exporters/stdout/example_test.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/selector/simple" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/trace/jaeger/jaeger.go b/exporters/trace/jaeger/jaeger.go index 70485f11651..b7a388b39fd 100644 --- a/exporters/trace/jaeger/jaeger.go +++ b/exporters/trace/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/trace/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/trace/jaeger/jaeger_test.go b/exporters/trace/jaeger/jaeger_test.go index 948c90f8860..5034c8d00a6 100644 --- a/exporters/trace/jaeger/jaeger_test.go +++ b/exporters/trace/jaeger/jaeger_test.go @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/trace/zipkin/model.go b/exporters/trace/zipkin/model.go index bdd48d4f89b..f8d4a357472 100644 --- a/exporters/trace/zipkin/model.go +++ b/exporters/trace/zipkin/model.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" zkmodel "github.com/openzipkin/zipkin-go/model" diff --git a/exporters/trace/zipkin/model_test.go b/exporters/trace/zipkin/model_test.go index 2d95211fa98..970040a0a1d 100644 --- a/exporters/trace/zipkin/model_test.go +++ b/exporters/trace/zipkin/model_test.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/trace/zipkin/zipkin_test.go b/exporters/trace/zipkin/zipkin_test.go index 7d1b5ec2fb9..bac8cdc2950 100644 --- a/exporters/trace/zipkin/zipkin_test.go +++ b/exporters/trace/zipkin/zipkin_test.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/oteltest/span.go b/oteltest/span.go index d243e9f8c68..e00225b4f1f 100644 --- a/oteltest/span.go +++ b/oteltest/span.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/oteltest/span_test.go b/oteltest/span_test.go index c997539a8ab..bf40f2f1dae 100644 --- a/oteltest/span_test.go +++ b/oteltest/span_test.go @@ -27,7 +27,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/internal/matchers" "go.opentelemetry.io/otel/oteltest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index a12dca40b12..7999b5c275d 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 06e2a5d4188..b3365ad3c4d 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) type ( diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 2641e903063..dd6d518bae0 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -21,7 +21,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 1eb1e6f2926..2a4cbc8df3f 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 699b0b58286..5d267231a7d 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -18,7 +18,7 @@ import ( "context" "strings" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) type osTypeDetector struct{} diff --git a/sdk/resource/process.go b/sdk/resource/process.go index 45539d1e2f5..171406ec581 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index fb8c838c44d..c9d8ac6d7ed 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index f40cf1afec2..3124f490d00 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/sdk/instrumentation" diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 89ec33fea16..b6348e89a1c 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/oteltest" - "go.opentelemetry.io/otel/semconv" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "go.opentelemetry.io/otel/trace" "github.com/google/go-cmp/cmp" diff --git a/semconv/doc.go b/semconv/v1.4.0/doc.go similarity index 82% rename from semconv/doc.go rename to semconv/v1.4.0/doc.go index 9a729fdecb1..4451ab22389 100644 --- a/semconv/doc.go +++ b/semconv/v1.4.0/doc.go @@ -19,6 +19,6 @@ // the evolving OpenTelemetry specification and user feedback. // // OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package aims to be the -// centralized place to interact with these conventions. -package semconv // import "go.opentelemetry.io/otel/semconv" +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.4.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" diff --git a/semconv/exception.go b/semconv/v1.4.0/exception.go similarity index 100% rename from semconv/exception.go rename to semconv/v1.4.0/exception.go diff --git a/semconv/http.go b/semconv/v1.4.0/http.go similarity index 99% rename from semconv/http.go rename to semconv/v1.4.0/http.go index 65cc25343b5..569e3c6450d 100644 --- a/semconv/http.go +++ b/semconv/v1.4.0/http.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package semconv // import "go.opentelemetry.io/otel/semconv" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" import ( "fmt" diff --git a/semconv/http_test.go b/semconv/v1.4.0/http_test.go similarity index 100% rename from semconv/http_test.go rename to semconv/v1.4.0/http_test.go diff --git a/semconv/resource.go b/semconv/v1.4.0/resource.go similarity index 91% rename from semconv/resource.go rename to semconv/v1.4.0/resource.go index d1edb3af400..d774ed07c30 100644 --- a/semconv/resource.go +++ b/semconv/v1.4.0/resource.go @@ -14,7 +14,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" import "go.opentelemetry.io/otel/attribute" @@ -255,6 +255,44 @@ const ( DeploymentEnvironmentKey = attribute.Key("deployment.environment") ) +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + // A serverless instance. const ( // The name of the function being executed. @@ -537,6 +575,19 @@ const ( // Required: No // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") ) var ( diff --git a/semconv/schema.go b/semconv/v1.4.0/schema.go similarity index 67% rename from semconv/schema.go rename to semconv/v1.4.0/schema.go index 32d8511b382..41079980eca 100644 --- a/semconv/schema.go +++ b/semconv/v1.4.0/schema.go @@ -15,8 +15,6 @@ package semconv // SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. This package defines semantic conventions for spec -// v1.3.0 which was released before the concept of schemas was introduce, thus the -// schema URL is empty. Semconv packages starting from v1.4.0 must declare non-empty -// schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "" +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/v1.4.0" diff --git a/semconv/trace.go b/semconv/v1.4.0/trace.go similarity index 96% rename from semconv/trace.go rename to semconv/v1.4.0/trace.go index 45e9280523c..378282e08dd 100644 --- a/semconv/trace.go +++ b/semconv/v1.4.0/trace.go @@ -14,7 +14,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" import "go.opentelemetry.io/otel/attribute" @@ -173,6 +173,10 @@ var ( DBSystemGeode = DBSystemKey.String("geode") // Elasticsearch DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") ) // Connection-level attributes for Microsoft SQL Server @@ -1215,3 +1219,43 @@ var ( // UNAUTHENTICATED RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) ) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `method` property from request. Unlike `rpc.method`, this may not relate to the + // actual method being called. Useful for client-side traces since client does not + // know what will be called on the server. + // + // Type: string + // Required: Always + // Examples: 'users.create', 'get_users' + RPCJsonrpcMethodKey = attribute.Key("rpc.jsonrpc.method") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) diff --git a/website_docs/instrumentation.md b/website_docs/instrumentation.md index 93532535c08..84919e41fe7 100644 --- a/website_docs/instrumentation.md +++ b/website_docs/instrumentation.md @@ -60,7 +60,7 @@ span.SetAttributes(myKey.String("a value")) ### Semantic Attributes -Semantic Attributes are attributes that are defined by the OpenTelemetry Specification in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv` package. +Semantic Attributes are attributes that are defined by the OpenTelemetry Specification in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.4.0` package. Tracing semantic conventions can be found [in this document](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/trace/semantic_conventions)