From 4de538776e6b707af05a677140245b44850c10f0 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 7 Nov 2022 23:05:13 +0100 Subject: [PATCH] [Removal] Remove deprecated experimental semantic conventions (#1741) --- .../opentelemetry/common/string_util.h | 14 -- .../trace/experimental_semantic_conventions.h | 197 ------------------ .../experimental_semantic_conventions.h | 143 ------------- 3 files changed, 354 deletions(-) delete mode 100644 api/include/opentelemetry/trace/experimental_semantic_conventions.h delete mode 100644 sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h diff --git a/api/include/opentelemetry/common/string_util.h b/api/include/opentelemetry/common/string_util.h index ffee86c96b..5496f8579e 100644 --- a/api/include/opentelemetry/common/string_util.h +++ b/api/include/opentelemetry/common/string_util.h @@ -5,20 +5,6 @@ #include "opentelemetry/nostd/string_view.h" -/** DJB2 hash function below is near-perfect hash used by several systems. - * Ref. http://www.cse.yorku.ca/~oz/hash.html - * - * String to hash - * Initial offset - * 32 bit code - */ -constexpr uint32_t hashCode(const char *str, uint32_t h = 0) -{ - return (uint32_t)(!str[h] ? 5381 : ((uint32_t)hashCode(str, h + 1) * (uint32_t)33) ^ str[h]); -} -#define OTEL_CPP_CONST_UINT32_T(x) std::integral_constant::value -#define OTEL_CPP_CONST_HASHCODE(name) OTEL_CPP_CONST_UINT32_T(hashCode(#name)) - OPENTELEMETRY_BEGIN_NAMESPACE namespace common { diff --git a/api/include/opentelemetry/trace/experimental_semantic_conventions.h b/api/include/opentelemetry/trace/experimental_semantic_conventions.h deleted file mode 100644 index a3eed553f2..0000000000 --- a/api/include/opentelemetry/trace/experimental_semantic_conventions.h +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// NOTE: -// This implementation is based on the experimental specs for trace semantic convention as defined -// here: -// https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/trace/semantic_conventions -// and MAY will change in future. - -// "This file is deprecated. Use opentelemetry/trace/semantic_conventions.h" - -#pragma once - -#include "opentelemetry/common/string_util.h" -#include "opentelemetry/version.h" - -#define OTEL_GET_TRACE_ATTR(name) opentelemetry::trace::attr(OTEL_CPP_CONST_HASHCODE(name)) - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace trace -{ - -/** - * Stores the Constants for semantic kAttribute names outlined by the OpenTelemetry specifications. - * . - */ -static const struct -{ - uint32_t attribute_id; - const char *attribute_key; -} attribute_ids[] = { - // The set of constants matches the specification as of this commit. - // https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/trace/semantic_conventions - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md - - // General network connection attributes - {OTEL_CPP_CONST_HASHCODE(AttrNetTransport), "net.transport"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetPeerIp), "net.peer.ip"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetPeerPort), "net.peer.port"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetPeerName), "net.peer.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetHostIp), "net.host.ip"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetHostPort), "net.host.port"}, - {OTEL_CPP_CONST_HASHCODE(AttrNetHostName), "net.host.name"}, - - // General identity attributes - {OTEL_CPP_CONST_HASHCODE(AttrEnduserId), "enduser.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrEnduserRole), "enduser.role"}, - {OTEL_CPP_CONST_HASHCODE(AttrEnduserScope), "enduser.scope"}, - - // General remote service attributes - {OTEL_CPP_CONST_HASHCODE(AttrPeerService), "peer.service"}, - - // General thread attributes - {OTEL_CPP_CONST_HASHCODE(AttrThreadId), "thread.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrThreadName), "thread.name"}, - - // Source Code Attributes - {OTEL_CPP_CONST_HASHCODE(AttrCodeFunction), "code.function"}, - {OTEL_CPP_CONST_HASHCODE(AttrCodeNamespace), "code.namespace"}, - {OTEL_CPP_CONST_HASHCODE(AttrCodeFilepath), "code.filepath"}, - {OTEL_CPP_CONST_HASHCODE(AttrCodeLineno), "code.lineno"}, - - // Http Span Common Attributes - {OTEL_CPP_CONST_HASHCODE(AttrHttpMethod), "http.method"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpUrl), "http.url"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpTarget), "http.target"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpHost), "http.host"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpScheme), "http.scheme"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpStatusCode), "http.status_code"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpFlavor), "http.flavor"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpUserAgent), "http.user_agent"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpRequestContentLength), "http.request_content_length"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpRequestContentLengthUncompressed), - "http.request_content_length_uncompressed"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpResponseContentLength), "http.response_content_length"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpResponseContentLengthUncompressed), - "http.response_content_length_uncompressed"}, - - // HTTP Span Client Attributes - // One of the following combinations: - // - http.url - // - http.scheme, http.host, http.target - // - http.scheme, net.peer.name, net.peer.port, http.target - // - http.scheme, net.peer.ip, net.peer.port, http.target - - // HTTP Span Server Attributes - // One of the following combinations: - // -http.scheme, http.host, http.target - // -http.scheme, http.server_name, net.host.port, http.target - // -http.scheme, net.host.name, net.host.port, http.target - // -http.url - {OTEL_CPP_CONST_HASHCODE(AttrHttpServerName), "http.server_name"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpRoute), "http.route"}, - {OTEL_CPP_CONST_HASHCODE(AttrHttpClientIp), "http.client_ip"}, - - // DB: Connection-level attributes - {OTEL_CPP_CONST_HASHCODE(AttrDbSystem), "db.system"}, // other_sql, mssql, mysql... - {OTEL_CPP_CONST_HASHCODE(AttrDbConnectionString), "db.connection_string"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbUser), "db.user"}, - // DB: Connection-level attributes for specific technologies - {OTEL_CPP_CONST_HASHCODE(AttrDbMssqlInstanceName), "db.mssql.instance_name"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbJdbcDriverClassname), "db.jdbc.driver_classname"}, - // DB: Call-level attributes - {OTEL_CPP_CONST_HASHCODE(AttrDbName), "db.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbStatement), "db.statement"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbOperation), "db.operation"}, - // DB: Call-level attributes for specific technologies - {OTEL_CPP_CONST_HASHCODE(AttrDbHbaseNamespace), "db.hbase.namespace"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbRedisDatabaseIndex), "db.redis.database_index"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbMongodbCollection), "db.mongodb.collection"}, - - // // DB: Call-level attributes for Cassandra for clarity - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraKeyspace), "db.cassandra.keyspace"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraPageSize), "db.cassandra.page_size"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraConsistencyLevel), "db.cassandra.consistency_level"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraTable), "db.cassandra.table"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraIdempotence), "db.cassandra.idempotence"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraSpeculativeExecutionCount), - "db.cassandra.speculative_execution_count"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraCoordinatorId), "db.cassandra.coordinator.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrDbCassandraCoordinatorDC), "db.cassandra.coordinator.dc"}, - - // Common RPC attributes - {OTEL_CPP_CONST_HASHCODE(AttrRpcSystem), "rpc.system"}, - {OTEL_CPP_CONST_HASHCODE(AttrRpcService), "rpc.service"}, - {OTEL_CPP_CONST_HASHCODE(AttrRpcMethod), "rpc.method"}, - // gRPC attributes - {OTEL_CPP_CONST_HASHCODE(AttrRpcGrpcStatusCode), "rpc.grpc.status_code"}, - // JSON-RPC attributes - {OTEL_CPP_CONST_HASHCODE(AttrRpcJsonrpcVersion), "rpc.jsonrpc.version"}, - {OTEL_CPP_CONST_HASHCODE(AttrRpcJsonrpcRequestId), "rpc.jsonrpc.request_id"}, - {OTEL_CPP_CONST_HASHCODE(AttrRpcJsonrpcErrorCode), "rpc.jsonrpc.error_code"}, - {OTEL_CPP_CONST_HASHCODE(AttrRpcJsonrpcErrorMessage), "rpc.jsonrpc.error_message"}, - - // faas: General Attributes - {OTEL_CPP_CONST_HASHCODE(AttrFaasTrigger), "faas.trigger"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasExecution), "faas.execution"}, - // faas: incoming invocations - {OTEL_CPP_CONST_HASHCODE(AttrFaasColdStart), "faas.coldstart"}, - // faas: outgoing invocations - {OTEL_CPP_CONST_HASHCODE(AttrFaasInvokedName), "faas.invoked_name"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasInvokedProvider), "faas.invoked_provider"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasInvokedRegion), "faas.invoked_region"}, - // faas: datastore trigger - {OTEL_CPP_CONST_HASHCODE(AttrFaasDocumentCollection), "faas.document.collection"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasDocumentOperation), "faas.document.operation"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasDocumentTime), "faas.document.time"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasDocumentName), "faas.document.name"}, - // faas: timer trigger - {OTEL_CPP_CONST_HASHCODE(AttrFaasTime), "faas.time"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasCron), "faas.cron"}, - - // messaging attributes - {OTEL_CPP_CONST_HASHCODE(AttrMessagingSystem), "messaging.system"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingDestination), "messaging.destination"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingDestinationKind), "messaging.destination_kind"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingTempDestination), "messaging.temp_destination"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingProtocol), "messaging.protocol"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingProtocolVersion), "messaging.protocol_version"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingUrl), "messaging.url"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingMessageId), "messaging.message_id"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingConversationId), "messaging.conversation_id"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingPayloadSize), "messaging.message_payload_size_bytes"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingPayloadCompressedSize), - "messaging.message_payload_compressed_size_bytes"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingOperation), "messaging.operation"}, - // messaging attributes specific to messaging systems - {OTEL_CPP_CONST_HASHCODE(AttrMessagingRabbitMQRoutingKey), "messaging.rabbitmq.routing_key"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingKafkaMessageKey), "messaging.kafka.message_key"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingKafkaConsumerGroup), "messaging.kafka.consumer_group"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingKafkaClientId), "messaging.kafka.client_id"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingKafkaPartition), "messaging.kafka.partition"}, - {OTEL_CPP_CONST_HASHCODE(AttrMessagingKafkaTombstone), "messaging.kafka.tombstone"}, - - // Exceptions attributes - {OTEL_CPP_CONST_HASHCODE(AttrExceptionType), "exception.type"}, - {OTEL_CPP_CONST_HASHCODE(AttrExceptionMessage), "exception.message"}, - {OTEL_CPP_CONST_HASHCODE(AttrExceptionStacktrace), "exception.stacktrace"}, - {OTEL_CPP_CONST_HASHCODE(AttrExceptionEscapted), "exception.escaped"}, -}; -// function to generate hash code for semantic conventions attributes. - -#define OTEL_CPP_TRACE_ATTRIBUTES_MAX (sizeof(attribute_ids) / sizeof(attribute_ids[0])) - -inline const char *attr(uint32_t attr) -{ - for (size_t i = 0; i < OTEL_CPP_TRACE_ATTRIBUTES_MAX; i++) - { - if (attribute_ids[i].attribute_id == attr) - return attribute_ids[i].attribute_key; - } - return ""; -} - -} // namespace trace -OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h deleted file mode 100644 index 93f0f4e384..0000000000 --- a/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// NOTE: -// This implementation is based on the experimental specs for resource semantic convention as -// defined here: -// https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/resource/semantic_conventions -// and MAY will change in future. - -// "This file is deprecated. Use opentelemetry/sdk/resource/semantic_conventions.h" - -#pragma once - -#include -#include - -#include "opentelemetry/common/string_util.h" -#include "opentelemetry/version.h" - -#define OTEL_GET_RESOURCE_ATTR(name) \ - opentelemetry::sdk::resource::attr(OTEL_CPP_CONST_HASHCODE(name)) - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace sdk -{ -namespace resource -{ - -static const std::unordered_map attribute_ids = { - {OTEL_CPP_CONST_HASHCODE(AttrServiceName), "service.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrServiceNamespace), "service.namespace"}, - {OTEL_CPP_CONST_HASHCODE(AttrServiceInstance), "service.instance.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrServiceVersion), "service.version"}, - - // telemetry attributes - {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkName), "telemetry.sdk.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkLanguage), "telemetry.sdk.language"}, - {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkVersion), "telemetry.sdk.version"}, - {OTEL_CPP_CONST_HASHCODE(AttrTelemetryAutoVersion), "telemetry.auto.version"}, - - // compute unit: container attributes - {OTEL_CPP_CONST_HASHCODE(AttrContainerName), "container.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrContainerId), "container.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrContainerRuntime), "container.runtime"}, - {OTEL_CPP_CONST_HASHCODE(AttrContainerImageName), "container.image.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrContainerImageTag), "container.image.tag"}, - - // compute unit: faas attributes - {OTEL_CPP_CONST_HASHCODE(AttrFaasName), "faas.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasId), "faas.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasVersion), "faas.version"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasInstance), "faas.instance"}, - {OTEL_CPP_CONST_HASHCODE(AttrFaasMaxMemory), "faas.max_memory"}, - - // compute unit : process attributes - {OTEL_CPP_CONST_HASHCODE(AttrProcessId), "process.pid"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessExecutableName), "process.executable.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessExecutablePath), "process.executable.path"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessCommand), "process.command"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessCommandLine), "process.command_line"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessCommandArgs), "process.command_args"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessOwner), "process.owner"}, - - // compute : process runtimes - {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeName), "process.runtime.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeVersion), "process.runtime.version"}, - {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeDescription), "process.runtime.description"}, - - // compute unit : WebEngine - {OTEL_CPP_CONST_HASHCODE(AttrWebEngineName), "webengine.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrWebEngineVersion), "webengine.version"}, - {OTEL_CPP_CONST_HASHCODE(AttrWebEngineDescription), "webengine.description"}, - - // compute instance : host - {OTEL_CPP_CONST_HASHCODE(AttrHostId), "host.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostName), "host.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostType), "host.type"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostArch), "host.arch"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostImageName), "host.image.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostImageId), "host.image.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrHostImageVersion), "host.image.version"}, - - // env os attributes - {OTEL_CPP_CONST_HASHCODE(AttrOsType), "os.type"}, - {OTEL_CPP_CONST_HASHCODE(AttrOsDescription), "os.description"}, - {OTEL_CPP_CONST_HASHCODE(AttrOsName), "os.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrOsVersion), "os.version"}, - - // env device attributes - {OTEL_CPP_CONST_HASHCODE(AttrDeviceId), "device.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrDeviceModelIdentifier), "device.model.identifier"}, - {OTEL_CPP_CONST_HASHCODE(AttrDeviceModelName), "device.model.name"}, - - // env cloud - {OTEL_CPP_CONST_HASHCODE(AttrCloudProvider), "cloud.provider"}, - {OTEL_CPP_CONST_HASHCODE(AttrCloudAccountId), "cloud.account.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrCloudRegion), "cloud.region"}, - {OTEL_CPP_CONST_HASHCODE(AttrCloudAvailabilityZone), "cloud.availability_zone"}, - {OTEL_CPP_CONST_HASHCODE(AttrCloudPlatform), "cloud.platform"}, - - // env deployment - {OTEL_CPP_CONST_HASHCODE(AttrDeploymentEnvironment), "deployment.environment"}, - - // env kubernetes - // - cluster - {OTEL_CPP_CONST_HASHCODE(AttrK8sClusterName), "k8s.cluster.name"}, - // - node - {OTEL_CPP_CONST_HASHCODE(AttrK8sNodeName), "k8s.node.name"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sNodeUid), "k8s.node.uid"}, - // - namespace - {OTEL_CPP_CONST_HASHCODE(AttrK8sNamespaceName), "k8s.namespace.name"}, - // - pod - {OTEL_CPP_CONST_HASHCODE(AttrK8sPodUid), "k8s.pod.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sPodName), "k8s.pod.name"}, - // - container - {OTEL_CPP_CONST_HASHCODE(AttrK8sContainerName), "k8s.container.name"}, - // - replicaset - {OTEL_CPP_CONST_HASHCODE(AttrK8sReplicaSetUid), "k8s.replicaset.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sReplicaSetName), "k8s.replicaset.name"}, - // - deployment - {OTEL_CPP_CONST_HASHCODE(AttrK8sDeploymentUid), "k8s.deployment.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sDeploymentName), "k8s.deployment.name"}, - // - stateful-set - {OTEL_CPP_CONST_HASHCODE(AttrK8sStatefulSetUid), "k8s.statefulset.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sStatefulSetName), "k8s.statefulset.name"}, - // - daemon set - {OTEL_CPP_CONST_HASHCODE(AttrK8sDaemonSetUid), "k8s.daemonset.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sDaemonSetName), "k8s.daemonset.name"}, - // - job - {OTEL_CPP_CONST_HASHCODE(AttrK8sJobUid), "k8s.job.uid"}, - {OTEL_CPP_CONST_HASHCODE(AttrK8sJobName), "k8s.job.name"}, - // - cronjob - {OTEL_CPP_CONST_HASHCODE(AttrCronjobUid), "k8s.cronjob.id"}, - {OTEL_CPP_CONST_HASHCODE(AttrCronjobName), "k8s.cronjob.name"}}; - -// function to generate hash code for semantic conventions attributes. -inline const char *attr(uint32_t attr) -{ - return (attribute_ids.find(attr) != attribute_ids.end()) ? attribute_ids.at(attr) : ""; -} -} // namespace resource -} // namespace sdk -OPENTELEMETRY_END_NAMESPACE