diff --git a/api/include/opentelemetry/semconv/client_attributes.h b/api/include/opentelemetry/semconv/client_attributes.h new file mode 100644 index 0000000000..ec984cc406 --- /dev/null +++ b/api/include/opentelemetry/semconv/client_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace client +{ + +/** + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or + * Unix domain socket name.

When observed from the server side, and when communicating through + * an intermediary, @code client.address @endcode SHOULD represent the client address behind any + * intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kClientAddress = "client.address"; + +/** + * Client port number. + *

+ * When observed from the server side, and when communicating through an intermediary, @code + * client.port @endcode SHOULD represent the client port behind any intermediaries, for example + * proxies, if it's available. + */ +static constexpr const char *kClientPort = "client.port"; + +} // namespace client +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/error_attributes.h b/api/include/opentelemetry/semconv/error_attributes.h new file mode 100644 index 0000000000..1b711ff112 --- /dev/null +++ b/api/include/opentelemetry/semconv/error_attributes.h @@ -0,0 +1,57 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace error +{ + +/** + * Describes a class of error the operation ended with. + *

+ * The @code error.type @endcode SHOULD be predictable, and SHOULD have low cardinality. + *

+ * When @code error.type @endcode is set to a type (e.g., an exception type), its + * canonical class name identifying the type within the artifact SHOULD be used. + *

+ * Instrumentations SHOULD document the list of errors they report. + *

+ * The cardinality of @code error.type @endcode within one instrumentation library SHOULD be low. + * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications + * should be prepared for @code error.type @endcode to have high cardinality at query time when no + * additional filters are applied. + *

+ * If the operation has completed successfully, instrumentations SHOULD NOT set @code error.type + * @endcode.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC + * status codes), it's RECOMMENDED to:

+ */ +static constexpr const char *kErrorType = "error.type"; + +namespace ErrorTypeValues +{ +/** + * A fallback error value to be used when the instrumentation doesn't define a custom value. + */ +static constexpr const char *kOther = "_OTHER"; + +} // namespace ErrorTypeValues + +} // namespace error +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/exception_attributes.h b/api/include/opentelemetry/semconv/exception_attributes.h new file mode 100644 index 0000000000..fdc19ac6d0 --- /dev/null +++ b/api/include/opentelemetry/semconv/exception_attributes.h @@ -0,0 +1,59 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace exception +{ + +/** + * SHOULD be set to true if the exception event is recorded at a point where it is known that the + * exception is escaping the scope of the span.

An exception is considered to have escaped (or + * left) the scope of a span, if that span is ended while the exception is still logically "in + * flight". This may be actually "in flight" in some languages (e.g. if the exception is passed to a + * Context manager's @code __exit__ @endcode method in Python) but will usually be caught at the + * point of recording the exception in most languages.

It is usually not possible to determine + * at the point where an exception is thrown whether it will escape the scope of a span. However, it + * is trivial to know that an exception will escape, if one checks for an active exception just + * before ending the span, as done in the example + * for recording span exceptions.

It follows that an exception may still escape the scope of + * the span even if the @code exception.escaped @endcode attribute was not set or set to false, + * since the event might have been recorded at a time where it was not + * clear whether the exception will escape. + */ +static constexpr const char *kExceptionEscaped = "exception.escaped"; + +/** + * The exception message. + */ +static constexpr const char *kExceptionMessage = "exception.message"; + +/** + * A stacktrace as a string in the natural representation for the language runtime. The + * representation is to be determined and documented by each language SIG. + */ +static constexpr const char *kExceptionStacktrace = "exception.stacktrace"; + +/** + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of + * the exception should be preferred over the static type in languages that support it. + */ +static constexpr const char *kExceptionType = "exception.type"; + +} // namespace exception +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/http_attributes.h b/api/include/opentelemetry/semconv/http_attributes.h new file mode 100644 index 0000000000..6011674e84 --- /dev/null +++ b/api/include/opentelemetry/semconv/http_attributes.h @@ -0,0 +1,153 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace http +{ + +/** + * HTTP request headers, @code @endcode being the normalized HTTP Header name (lowercase), the + * value being the header values.

Instrumentations SHOULD require an explicit configuration of + * which headers are to be captured. Including all request headers can be a security risk - explicit + * configuration helps avoid leaking sensitive information. The @code User-Agent @endcode header is + * already captured in the @code user_agent.original @endcode attribute. Users MAY explicitly + * configure instrumentations to capture them even though it is not recommended. The attribute value + * MUST consist of either multiple header values as an array of strings or a single-item array + * containing a possibly comma-concatenated string, depending on the way the HTTP library provides + * access to headers. + */ +static constexpr const char *kHttpRequestHeader = "http.request.header"; + +/** + * HTTP request method. + *

+ * HTTP request method value SHOULD be "known" to the instrumentation. + * By default, this convention defines "known" methods as the ones listed in RFC9110 and the PATCH method + * defined in RFC5789.

If the HTTP + * request method is not known to instrumentation, it MUST set the @code http.request.method + * @endcode attribute to @code _OTHER @endcode.

If the HTTP instrumentation could end up + * converting valid HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to + * override the list of known HTTP methods. If this override is done via environment variable, then + * the environment variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a + * comma-separated list of case-sensitive known HTTP methods (this list MUST be a full override of + * the default known method, it is not a list of known methods in addition to the defaults).

+ * HTTP method names are case-sensitive and @code http.request.method @endcode attribute value MUST + * match a known HTTP method name exactly. Instrumentations for specific web frameworks that + * consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. Tracing + * instrumentations that do so, MUST also set @code http.request.method_original @endcode to the + * original value. + */ +static constexpr const char *kHttpRequestMethod = "http.request.method"; + +/** + * Original HTTP method sent by the client in the request line. + */ +static constexpr const char *kHttpRequestMethodOriginal = "http.request.method_original"; + +/** + * The ordinal number of request resending attempt (for any reason, including redirects). + *

+ * The resend count SHOULD be updated each time an HTTP request gets resent by the client, + * regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 + * Server Unavailable, network issues, or any other). + */ +static constexpr const char *kHttpRequestResendCount = "http.request.resend_count"; + +/** + * HTTP response headers, @code @endcode being the normalized HTTP Header name (lowercase), + * the value being the header values.

Instrumentations SHOULD require an explicit configuration + * of which headers are to be captured. Including all response headers can be a security risk - + * explicit configuration helps avoid leaking sensitive information. Users MAY explicitly configure + * instrumentations to capture them even though it is not recommended. The attribute value MUST + * consist of either multiple header values as an array of strings or a single-item array containing + * a possibly comma-concatenated string, depending on the way the HTTP library provides access to + * headers. + */ +static constexpr const char *kHttpResponseHeader = "http.response.header"; + +/** + * HTTP response status code. + */ +static constexpr const char *kHttpResponseStatusCode = "http.response.status_code"; + +/** + * The matched route, that is, the path template in the format used by the respective server + * framework.

MUST NOT be populated when this is not supported by the HTTP server framework as + * the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD + * include the application root if + * there is one. + */ +static constexpr const char *kHttpRoute = "http.route"; + +namespace HttpRequestMethodValues +{ +/** + * CONNECT method. + */ +static constexpr const char *kConnect = "CONNECT"; + +/** + * DELETE method. + */ +static constexpr const char *kDelete = "DELETE"; + +/** + * GET method. + */ +static constexpr const char *kGet = "GET"; + +/** + * HEAD method. + */ +static constexpr const char *kHead = "HEAD"; + +/** + * OPTIONS method. + */ +static constexpr const char *kOptions = "OPTIONS"; + +/** + * PATCH method. + */ +static constexpr const char *kPatch = "PATCH"; + +/** + * POST method. + */ +static constexpr const char *kPost = "POST"; + +/** + * PUT method. + */ +static constexpr const char *kPut = "PUT"; + +/** + * TRACE method. + */ +static constexpr const char *kTrace = "TRACE"; + +/** + * Any HTTP method that the instrumentation has no prior knowledge of. + */ +static constexpr const char *kOther = "_OTHER"; + +} // namespace HttpRequestMethodValues + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/http_metrics.h b/api/include/opentelemetry/semconv/http_metrics.h new file mode 100644 index 0000000000..ab698d3984 --- /dev/null +++ b/api/include/opentelemetry/semconv/http_metrics.h @@ -0,0 +1,78 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace http +{ + +/** + * Duration of HTTP client requests. + *

+ * histogram + */ +static constexpr const char *kMetricHttpClientRequestDuration = + "metric.http.client.request.duration"; +static constexpr const char *descrMetricHttpClientRequestDuration = + "Duration of HTTP client requests."; +static constexpr const char *unitMetricHttpClientRequestDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +/** + * Duration of HTTP server requests. + *

+ * histogram + */ +static constexpr const char *kMetricHttpServerRequestDuration = + "metric.http.server.request.duration"; +static constexpr const char *descrMetricHttpServerRequestDuration = + "Duration of HTTP server requests."; +static constexpr const char *unitMetricHttpServerRequestDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricHttpServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +static nostd::shared_ptr CreateAsyncMetricHttpServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/artifact_attributes.h b/api/include/opentelemetry/semconv/incubating/artifact_attributes.h new file mode 100644 index 0000000000..d3bb99f6e5 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/artifact_attributes.h @@ -0,0 +1,81 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace artifact +{ + +/** + * The provenance filename of the built attestation which directly relates to the build artifact + * filename. This filename SHOULD accompany the artifact at publish time. See the SLSA + * Relationship specification for more information. + */ +static constexpr const char *kArtifactAttestationFilename = "artifact.attestation.filename"; + +/** + * The full hash value (see + * glossary), of the built attestation. Some envelopes in the software attestation space also + * refer to this as the digest. + */ +static constexpr const char *kArtifactAttestationHash = "artifact.attestation.hash"; + +/** + * The id of the build software attestation. + */ +static constexpr const char *kArtifactAttestationId = "artifact.attestation.id"; + +/** + * The human readable file name of the artifact, typically generated during build and release + * processes. Often includes the package name and version in the file name.

This file name can + * also act as the Package Name + * in cases where the package ecosystem maps accordingly. + * Additionally, the artifact can be published for + * others, but that is not a guarantee. + */ +static constexpr const char *kArtifactFilename = "artifact.filename"; + +/** + * The full hash value (see + * glossary), often found in checksum.txt on a release of the artifact and used to verify + * package integrity.

The specific algorithm used to create the cryptographic hash value is not + * defined. In situations where an artifact has multiple cryptographic hashes, it is up to the + * implementer to choose which hash value to set here; this should be the most secure hash algorithm + * that is suitable for the situation and consistent with the + * corresponding attestation. The implementer can then provide the other + * hash values through an additional set of attribute extensions as they + * deem necessary. + */ +static constexpr const char *kArtifactHash = "artifact.hash"; + +/** + * The Package URL of the package artifact provides a + * standard way to identify and locate the packaged artifact. + */ +static constexpr const char *kArtifactPurl = "artifact.purl"; + +/** + * The version of the artifact. + */ +static constexpr const char *kArtifactVersion = "artifact.version"; + +} // namespace artifact +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/aws_attributes.h b/api/include/opentelemetry/semconv/incubating/aws_attributes.h new file mode 100644 index 0000000000..d0eaa6d08a --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/aws_attributes.h @@ -0,0 +1,356 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace aws +{ + +/** + * The JSON-serialized value of each item in the @code AttributeDefinitions @endcode request field. + */ +static constexpr const char *kAwsDynamodbAttributeDefinitions = + "aws.dynamodb.attribute_definitions"; + +/** + * The value of the @code AttributesToGet @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbAttributesToGet = "aws.dynamodb.attributes_to_get"; + +/** + * The value of the @code ConsistentRead @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbConsistentRead = "aws.dynamodb.consistent_read"; + +/** + * The JSON-serialized value of each item in the @code ConsumedCapacity @endcode response field. + */ +static constexpr const char *kAwsDynamodbConsumedCapacity = "aws.dynamodb.consumed_capacity"; + +/** + * The value of the @code Count @endcode response parameter. + */ +static constexpr const char *kAwsDynamodbCount = "aws.dynamodb.count"; + +/** + * The value of the @code ExclusiveStartTableName @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbExclusiveStartTable = "aws.dynamodb.exclusive_start_table"; + +/** + * The JSON-serialized value of each item in the @code GlobalSecondaryIndexUpdates @endcode request + * field. + */ +static constexpr const char *kAwsDynamodbGlobalSecondaryIndexUpdates = + "aws.dynamodb.global_secondary_index_updates"; + +/** + * The JSON-serialized value of each item of the @code GlobalSecondaryIndexes @endcode request field + */ +static constexpr const char *kAwsDynamodbGlobalSecondaryIndexes = + "aws.dynamodb.global_secondary_indexes"; + +/** + * The value of the @code IndexName @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbIndexName = "aws.dynamodb.index_name"; + +/** + * The JSON-serialized value of the @code ItemCollectionMetrics @endcode response field. + */ +static constexpr const char *kAwsDynamodbItemCollectionMetrics = + "aws.dynamodb.item_collection_metrics"; + +/** + * The value of the @code Limit @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbLimit = "aws.dynamodb.limit"; + +/** + * The JSON-serialized value of each item of the @code LocalSecondaryIndexes @endcode request field. + */ +static constexpr const char *kAwsDynamodbLocalSecondaryIndexes = + "aws.dynamodb.local_secondary_indexes"; + +/** + * The value of the @code ProjectionExpression @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbProjection = "aws.dynamodb.projection"; + +/** + * The value of the @code ProvisionedThroughput.ReadCapacityUnits @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbProvisionedReadCapacity = + "aws.dynamodb.provisioned_read_capacity"; + +/** + * The value of the @code ProvisionedThroughput.WriteCapacityUnits @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbProvisionedWriteCapacity = + "aws.dynamodb.provisioned_write_capacity"; + +/** + * The value of the @code ScanIndexForward @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbScanForward = "aws.dynamodb.scan_forward"; + +/** + * The value of the @code ScannedCount @endcode response parameter. + */ +static constexpr const char *kAwsDynamodbScannedCount = "aws.dynamodb.scanned_count"; + +/** + * The value of the @code Segment @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbSegment = "aws.dynamodb.segment"; + +/** + * The value of the @code Select @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbSelect = "aws.dynamodb.select"; + +/** + * The number of items in the @code TableNames @endcode response parameter. + */ +static constexpr const char *kAwsDynamodbTableCount = "aws.dynamodb.table_count"; + +/** + * The keys in the @code RequestItems @endcode object field. + */ +static constexpr const char *kAwsDynamodbTableNames = "aws.dynamodb.table_names"; + +/** + * The value of the @code TotalSegments @endcode request parameter. + */ +static constexpr const char *kAwsDynamodbTotalSegments = "aws.dynamodb.total_segments"; + +/** + * The ARN of an ECS cluster. + */ +static constexpr const char *kAwsEcsClusterArn = "aws.ecs.cluster.arn"; + +/** + * The Amazon Resource Name (ARN) of an ECS + * container instance. + */ +static constexpr const char *kAwsEcsContainerArn = "aws.ecs.container.arn"; + +/** + * The launch + * type for an ECS task. + */ +static constexpr const char *kAwsEcsLaunchtype = "aws.ecs.launchtype"; + +/** + * The ARN of a running ECS + * task. + */ +static constexpr const char *kAwsEcsTaskArn = "aws.ecs.task.arn"; + +/** + * The family name of the ECS task + * definition used to create the ECS task. + */ +static constexpr const char *kAwsEcsTaskFamily = "aws.ecs.task.family"; + +/** + * The ID of a running ECS task. The ID MUST be extracted from @code task.arn @endcode. + */ +static constexpr const char *kAwsEcsTaskId = "aws.ecs.task.id"; + +/** + * The revision for the task definition used to create the ECS task. + */ +static constexpr const char *kAwsEcsTaskRevision = "aws.ecs.task.revision"; + +/** + * The ARN of an EKS cluster. + */ +static constexpr const char *kAwsEksClusterArn = "aws.eks.cluster.arn"; + +/** + * The full invoked ARN as provided on the @code Context @endcode passed to the function (@code + * Lambda-Runtime-Invoked-Function-Arn @endcode header on the @code /runtime/invocation/next + * @endcode applicable).

This may be different from @code cloud.resource_id @endcode if an alias + * is involved. + */ +static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn"; + +/** + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + *

+ * See the log + * group ARN format documentation. + */ +static constexpr const char *kAwsLogGroupArns = "aws.log.group.arns"; + +/** + * The name(s) of the AWS log group(s) an application is writing to. + *

+ * Multiple log groups must be supported for cases like multi-container applications, where a single + * application has sidecar containers, and each write to their own log group. + */ +static constexpr const char *kAwsLogGroupNames = "aws.log.group.names"; + +/** + * The ARN(s) of the AWS log stream(s). + *

+ * See the log + * stream ARN format documentation. One log group can contain several log streams, so these ARNs + * necessarily identify both a log group and a log stream. + */ +static constexpr const char *kAwsLogStreamArns = "aws.log.stream.arns"; + +/** + * The name(s) of the AWS log stream(s) an application is writing to. + */ +static constexpr const char *kAwsLogStreamNames = "aws.log.stream.names"; + +/** + * The AWS request ID as returned in the response headers @code x-amz-request-id @endcode or @code + * x-amz-requestid @endcode. + */ +static constexpr const char *kAwsRequestId = "aws.request_id"; + +/** + * The S3 bucket name the request refers to. Corresponds to the @code --bucket @endcode parameter of + * the S3 API + * operations.

The @code bucket @endcode attribute is applicable to all S3 operations that + * reference a bucket, i.e. that require the bucket name as a mandatory parameter. This applies to + * almost all S3 operations except @code list-buckets @endcode. + */ +static constexpr const char *kAwsS3Bucket = "aws.s3.bucket"; + +/** + * The source object (in the form @code bucket @endcode/@code key @endcode) for the copy operation. + *

+ * The @code copy_source @endcode attribute applies to S3 copy operations and corresponds to the + * @code --copy-source @endcode parameter of the copy-object + * operation within the S3 API. This applies in particular to the following operations:

+ */ +static constexpr const char *kAwsS3CopySource = "aws.s3.copy_source"; + +/** + * The delete request container that specifies the objects to be deleted. + *

+ * The @code delete @endcode attribute is only applicable to the delete-object + * operation. The @code delete @endcode attribute corresponds to the @code --delete @endcode + * parameter of the delete-objects + * operation within the S3 API. + */ +static constexpr const char *kAwsS3Delete = "aws.s3.delete"; + +/** + * The S3 object key the request refers to. Corresponds to the @code --key @endcode parameter of the + * S3 API + * operations.

The @code key @endcode attribute is applicable to all object-related S3 + * operations, i.e. that require the object key as a mandatory parameter. This applies in particular + * to the following operations:

+ */ +static constexpr const char *kAwsS3Key = "aws.s3.key"; + +/** + * The part number of the part being uploaded in a multipart-upload operation. This is a positive + * integer between 1 and 10,000.

The @code part_number @endcode attribute is only applicable to + * the upload-part + * and upload-part-copy + * operations. The @code part_number @endcode attribute corresponds to the @code --part-number + * @endcode parameter of the upload-part + * operation within the S3 API. + */ +static constexpr const char *kAwsS3PartNumber = "aws.s3.part_number"; + +/** + * Upload ID that identifies the multipart upload. + *

+ * The @code upload_id @endcode attribute applies to S3 multipart-upload operations and corresponds + * to the @code --upload-id @endcode parameter of the S3 API multipart + * operations. This applies in particular to the following operations:

+ */ +static constexpr const char *kAwsS3UploadId = "aws.s3.upload_id"; + +namespace AwsEcsLaunchtypeValues +{ +/** + * none + */ +static constexpr const char *kEc2 = "ec2"; + +/** + * none + */ +static constexpr const char *kFargate = "fargate"; + +} // namespace AwsEcsLaunchtypeValues + +} // namespace aws +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/az_attributes.h b/api/include/opentelemetry/semconv/incubating/az_attributes.h new file mode 100644 index 0000000000..5e12c82f7b --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/az_attributes.h @@ -0,0 +1,30 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace az +{ + +/** + * The unique identifier of the service request. It's generated by the Azure service and returned + * with the response. + */ +static constexpr const char *kAzServiceRequestId = "az.service_request_id"; + +} // namespace az +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/browser_attributes.h b/api/include/opentelemetry/semconv/incubating/browser_attributes.h new file mode 100644 index 0000000000..5ddb61eae5 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/browser_attributes.h @@ -0,0 +1,65 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace browser +{ + +/** + * Array of brand name and version separated by a space + *

+ * This value is intended to be taken from the UA client hints API (@code + * navigator.userAgentData.brands @endcode). + */ +static constexpr const char *kBrowserBrands = "browser.brands"; + +/** + * Preferred language of the user using the browser + *

+ * This value is intended to be taken from the Navigator API @code navigator.language @endcode. + */ +static constexpr const char *kBrowserLanguage = "browser.language"; + +/** + * A boolean that is true if the browser is running on a mobile device + *

+ * This value is intended to be taken from the UA client hints API (@code + * navigator.userAgentData.mobile @endcode). If unavailable, this attribute SHOULD be left unset. + */ +static constexpr const char *kBrowserMobile = "browser.mobile"; + +/** + * The platform on which the browser is running + *

+ * This value is intended to be taken from the UA client hints API (@code + * navigator.userAgentData.platform @endcode). If unavailable, the legacy @code navigator.platform + * @endcode API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the + * values to be consistent. The list of possible values is defined in the W3C User-Agent Client Hints + * specification. Note that some (but not all) of these values can overlap with values in the @code os.type @endcode and @code os.name @endcode attributes. However, for + * consistency, the values in the @code browser.platform @endcode attribute should capture the exact + * value that the user agent provides. + */ +static constexpr const char *kBrowserPlatform = "browser.platform"; + +} // namespace browser +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cicd_attributes.h b/api/include/opentelemetry/semconv/incubating/cicd_attributes.h new file mode 100644 index 0000000000..246563a8e8 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cicd_attributes.h @@ -0,0 +1,76 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cicd +{ + +/** + * The human readable name of the pipeline within a CI/CD system. + */ +static constexpr const char *kCicdPipelineName = "cicd.pipeline.name"; + +/** + * The unique identifier of a pipeline run within a CI/CD system. + */ +static constexpr const char *kCicdPipelineRunId = "cicd.pipeline.run.id"; + +/** + * The human readable name of a task within a pipeline. Task here most closely aligns with a computing process in a pipeline. + * Other terms for tasks include commands, steps, and procedures. + */ +static constexpr const char *kCicdPipelineTaskName = "cicd.pipeline.task.name"; + +/** + * The unique identifier of a task run within a pipeline. + */ +static constexpr const char *kCicdPipelineTaskRunId = "cicd.pipeline.task.run.id"; + +/** + * The URL of the pipeline run providing the + * complete address in order to locate and identify the pipeline run. + */ +static constexpr const char *kCicdPipelineTaskRunUrlFull = "cicd.pipeline.task.run.url.full"; + +/** + * The type of the task within a pipeline. + */ +static constexpr const char *kCicdPipelineTaskType = "cicd.pipeline.task.type"; + +namespace CicdPipelineTaskTypeValues +{ +/** + * build + */ +static constexpr const char *kBuild = "build"; + +/** + * test + */ +static constexpr const char *kTest = "test"; + +/** + * deploy + */ +static constexpr const char *kDeploy = "deploy"; + +} // namespace CicdPipelineTaskTypeValues + +} // namespace cicd +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/client_attributes.h b/api/include/opentelemetry/semconv/incubating/client_attributes.h new file mode 100644 index 0000000000..ec984cc406 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/client_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace client +{ + +/** + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or + * Unix domain socket name.

When observed from the server side, and when communicating through + * an intermediary, @code client.address @endcode SHOULD represent the client address behind any + * intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kClientAddress = "client.address"; + +/** + * Client port number. + *

+ * When observed from the server side, and when communicating through an intermediary, @code + * client.port @endcode SHOULD represent the client port behind any intermediaries, for example + * proxies, if it's available. + */ +static constexpr const char *kClientPort = "client.port"; + +} // namespace client +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cloud_attributes.h b/api/include/opentelemetry/semconv/incubating/cloud_attributes.h new file mode 100644 index 0000000000..cd76489eba --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cloud_attributes.h @@ -0,0 +1,272 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cloud +{ + +/** + * The cloud account ID the resource is assigned to. + */ +static constexpr const char *kCloudAccountId = "cloud.account.id"; + +/** + * Cloud regions often have multiple, isolated locations known as zones to increase availability. + * Availability zone represents the zone where the resource is running.

Availability zones are + * called "zones" on Alibaba Cloud and Google Cloud. + */ +static constexpr const char *kCloudAvailabilityZone = "cloud.availability_zone"; + +/** + * The cloud platform in use. + *

+ * The prefix of the service SHOULD match the one specified in @code cloud.provider @endcode. + */ +static constexpr const char *kCloudPlatform = "cloud.platform"; + +/** + * Name of the cloud provider. + */ +static constexpr const char *kCloudProvider = "cloud.provider"; + +/** + * The geographical region the resource is running. + *

+ * Refer to your provider's docs to see the available regions, for example Alibaba Cloud regions, AWS regions, Azure regions, Google Cloud regions, or Tencent Cloud regions. + */ +static constexpr const char *kCloudRegion = "cloud.region"; + +/** + * Cloud provider-specific native identifier of the monitored cloud resource (e.g. an ARN on AWS, + * a fully qualified + * resource ID on Azure, a full resource + * name on GCP)

On some cloud providers, it may not be possible to determine the full ID at + * startup, so it may be necessary to set @code cloud.resource_id @endcode as a span attribute + * instead.

The exact value to use for @code cloud.resource_id @endcode depends on the cloud + * provider. The following well-known definitions MUST be used if you set this attribute and they + * apply:

+ */ +static constexpr const char *kCloudResourceId = "cloud.resource_id"; + +namespace CloudPlatformValues +{ +/** + * Alibaba Cloud Elastic Compute Service + */ +static constexpr const char *kAlibabaCloudEcs = "alibaba_cloud_ecs"; + +/** + * Alibaba Cloud Function Compute + */ +static constexpr const char *kAlibabaCloudFc = "alibaba_cloud_fc"; + +/** + * Red Hat OpenShift on Alibaba Cloud + */ +static constexpr const char *kAlibabaCloudOpenshift = "alibaba_cloud_openshift"; + +/** + * AWS Elastic Compute Cloud + */ +static constexpr const char *kAwsEc2 = "aws_ec2"; + +/** + * AWS Elastic Container Service + */ +static constexpr const char *kAwsEcs = "aws_ecs"; + +/** + * AWS Elastic Kubernetes Service + */ +static constexpr const char *kAwsEks = "aws_eks"; + +/** + * AWS Lambda + */ +static constexpr const char *kAwsLambda = "aws_lambda"; + +/** + * AWS Elastic Beanstalk + */ +static constexpr const char *kAwsElasticBeanstalk = "aws_elastic_beanstalk"; + +/** + * AWS App Runner + */ +static constexpr const char *kAwsAppRunner = "aws_app_runner"; + +/** + * Red Hat OpenShift on AWS (ROSA) + */ +static constexpr const char *kAwsOpenshift = "aws_openshift"; + +/** + * Azure Virtual Machines + */ +static constexpr const char *kAzureVm = "azure_vm"; + +/** + * Azure Container Apps + */ +static constexpr const char *kAzureContainerApps = "azure_container_apps"; + +/** + * Azure Container Instances + */ +static constexpr const char *kAzureContainerInstances = "azure_container_instances"; + +/** + * Azure Kubernetes Service + */ +static constexpr const char *kAzureAks = "azure_aks"; + +/** + * Azure Functions + */ +static constexpr const char *kAzureFunctions = "azure_functions"; + +/** + * Azure App Service + */ +static constexpr const char *kAzureAppService = "azure_app_service"; + +/** + * Azure Red Hat OpenShift + */ +static constexpr const char *kAzureOpenshift = "azure_openshift"; + +/** + * Google Bare Metal Solution (BMS) + */ +static constexpr const char *kGcpBareMetalSolution = "gcp_bare_metal_solution"; + +/** + * Google Cloud Compute Engine (GCE) + */ +static constexpr const char *kGcpComputeEngine = "gcp_compute_engine"; + +/** + * Google Cloud Run + */ +static constexpr const char *kGcpCloudRun = "gcp_cloud_run"; + +/** + * Google Cloud Kubernetes Engine (GKE) + */ +static constexpr const char *kGcpKubernetesEngine = "gcp_kubernetes_engine"; + +/** + * Google Cloud Functions (GCF) + */ +static constexpr const char *kGcpCloudFunctions = "gcp_cloud_functions"; + +/** + * Google Cloud App Engine (GAE) + */ +static constexpr const char *kGcpAppEngine = "gcp_app_engine"; + +/** + * Red Hat OpenShift on Google Cloud + */ +static constexpr const char *kGcpOpenshift = "gcp_openshift"; + +/** + * Red Hat OpenShift on IBM Cloud + */ +static constexpr const char *kIbmCloudOpenshift = "ibm_cloud_openshift"; + +/** + * Tencent Cloud Cloud Virtual Machine (CVM) + */ +static constexpr const char *kTencentCloudCvm = "tencent_cloud_cvm"; + +/** + * Tencent Cloud Elastic Kubernetes Service (EKS) + */ +static constexpr const char *kTencentCloudEks = "tencent_cloud_eks"; + +/** + * Tencent Cloud Serverless Cloud Function (SCF) + */ +static constexpr const char *kTencentCloudScf = "tencent_cloud_scf"; + +} // namespace CloudPlatformValues + +namespace CloudProviderValues +{ +/** + * Alibaba Cloud + */ +static constexpr const char *kAlibabaCloud = "alibaba_cloud"; + +/** + * Amazon Web Services + */ +static constexpr const char *kAws = "aws"; + +/** + * Microsoft Azure + */ +static constexpr const char *kAzure = "azure"; + +/** + * Google Cloud Platform + */ +static constexpr const char *kGcp = "gcp"; + +/** + * Heroku Platform as a Service + */ +static constexpr const char *kHeroku = "heroku"; + +/** + * IBM Cloud + */ +static constexpr const char *kIbmCloud = "ibm_cloud"; + +/** + * Tencent Cloud + */ +static constexpr const char *kTencentCloud = "tencent_cloud"; + +} // namespace CloudProviderValues + +} // namespace cloud +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h b/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h new file mode 100644 index 0000000000..363feed157 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h @@ -0,0 +1,58 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cloudevents +{ + +/** + * The event_id + * uniquely identifies the event. + */ +static constexpr const char *kCloudeventsEventId = "cloudevents.event_id"; + +/** + * The source + * identifies the context in which an event happened. + */ +static constexpr const char *kCloudeventsEventSource = "cloudevents.event_source"; + +/** + * The version of + * the CloudEvents specification which the event uses. + */ +static constexpr const char *kCloudeventsEventSpecVersion = "cloudevents.event_spec_version"; + +/** + * The subject of + * the event in the context of the event producer (identified by source). + */ +static constexpr const char *kCloudeventsEventSubject = "cloudevents.event_subject"; + +/** + * The event_type + * contains a value describing the type of event related to the originating occurrence. + */ +static constexpr const char *kCloudeventsEventType = "cloudevents.event_type"; + +} // namespace cloudevents +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/code_attributes.h b/api/include/opentelemetry/semconv/incubating/code_attributes.h new file mode 100644 index 0000000000..f2715e87b6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/code_attributes.h @@ -0,0 +1,60 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace code +{ + +/** + * The column number in @code code.filepath @endcode best representing the operation. It SHOULD + * point within the code unit named in @code code.function @endcode. + */ +static constexpr const char *kCodeColumn = "code.column"; + +/** + * The source code file name that identifies the code unit as uniquely as possible (preferably an + * absolute file path). + */ +static constexpr const char *kCodeFilepath = "code.filepath"; + +/** + * The method or function name, or equivalent (usually rightmost part of the code unit's name). + */ +static constexpr const char *kCodeFunction = "code.function"; + +/** + * The line number in @code code.filepath @endcode best representing the operation. It SHOULD point + * within the code unit named in @code code.function @endcode. + */ +static constexpr const char *kCodeLineno = "code.lineno"; + +/** + * The "namespace" within which @code code.function @endcode is defined. Usually the qualified class + * or module name, such that @code code.namespace @endcode + some separator + @code code.function + * @endcode form a unique identifier for the code unit. + */ +static constexpr const char *kCodeNamespace = "code.namespace"; + +/** + * A stacktrace as a string in the natural representation for the language runtime. The + * representation is to be determined and documented by each language SIG. + */ +static constexpr const char *kCodeStacktrace = "code.stacktrace"; + +} // namespace code +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/container_attributes.h b/api/include/opentelemetry/semconv/incubating/container_attributes.h new file mode 100644 index 0000000000..5bd1118c3b --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/container_attributes.h @@ -0,0 +1,141 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace container +{ + +/** + * The command used to run the container (i.e. the command name). + *

+ * If using embedded credentials or sensitive data, it is recommended to remove them to prevent + * potential leakage. + */ +static constexpr const char *kContainerCommand = "container.command"; + +/** + * All the command arguments (including the command/executable itself) run by the container. [2] + */ +static constexpr const char *kContainerCommandArgs = "container.command_args"; + +/** + * The full command run by the container as a single string representing the full command. [2] + */ +static constexpr const char *kContainerCommandLine = "container.command_line"; + +/** + * Deprecated, use @code cpu.mode @endcode instead. + *

+ * @deprecated + * Replaced by @code cpu.mode @endcode + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kContainerCpuState = "container.cpu.state"; + +/** + * Container ID. Usually a UUID, as for example used to identify Docker + * containers. The UUID might be abbreviated. + */ +static constexpr const char *kContainerId = "container.id"; + +/** + * Runtime specific image identifier. Usually a hash algorithm followed by a UUID. + *

+ * Docker defines a sha256 of the image id; @code container.image.id @endcode corresponds to the + * @code Image @endcode field from the Docker container inspect API + * endpoint. K8s defines a link to the container registry repository with digest @code "imageID": + * "registry.azurecr.io + * /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625" + * @endcode. The ID is assigned by the container runtime and can vary in different environments. + * Consider using @code oci.manifest.digest @endcode if it is important to identify the same image + * in different environments/runtimes. + */ +static constexpr const char *kContainerImageId = "container.image.id"; + +/** + * Name of the image the container was built on. + */ +static constexpr const char *kContainerImageName = "container.image.name"; + +/** + * Repo digests of the container image as provided by the container runtime. + *

+ * Docker + * and CRI + * report those under the @code RepoDigests @endcode field. + */ +static constexpr const char *kContainerImageRepoDigests = "container.image.repo_digests"; + +/** + * Container image tags. An example can be found in Docker Image + * Inspect. Should be only the @code @endcode section of the full name for example from + * @code registry.example.com/my-org/my-image: @endcode. + */ +static constexpr const char *kContainerImageTags = "container.image.tags"; + +/** + * Container labels, @code @endcode being the label name, the value being the label value. + */ +static constexpr const char *kContainerLabel = "container.label"; + +/** + * Deprecated, use @code container.label @endcode instead. + *

+ * @deprecated + * Replaced by @code container.label @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kContainerLabels = "container.labels"; + +/** + * Container name used by container runtime. + */ +static constexpr const char *kContainerName = "container.name"; + +/** + * The container runtime managing this container. + */ +static constexpr const char *kContainerRuntime = "container.runtime"; + +namespace ContainerCpuStateValues +{ +/** + * When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode + * (Windows). + */ +static constexpr const char *kUser = "user"; + +/** + * When CPU is used by the system (host OS) + */ +static constexpr const char *kSystem = "system"; + +/** + * When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel + * mode (Windows). + */ +static constexpr const char *kKernel = "kernel"; + +} // namespace ContainerCpuStateValues + +} // namespace container +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/container_metrics.h b/api/include/opentelemetry/semconv/incubating/container_metrics.h new file mode 100644 index 0000000000..450d334926 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/container_metrics.h @@ -0,0 +1,124 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace container +{ + +/** + * Total CPU time consumed + *

+ * Total CPU time consumed by the specific container on all available CPU cores + *

+ * counter + */ +static constexpr const char *kMetricContainerCpuTime = "metric.container.cpu.time"; +static constexpr const char *descrMetricContainerCpuTime = "Total CPU time consumed"; +static constexpr const char *unitMetricContainerCpuTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricContainerCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +static nostd::shared_ptr CreateAsyncMetricContainerCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +/** + * Disk bytes for the container. + *

+ * The total number of bytes read/written successfully (aggregated from all disks). + *

+ * counter + */ +static constexpr const char *kMetricContainerDiskIo = "metric.container.disk.io"; +static constexpr const char *descrMetricContainerDiskIo = "Disk bytes for the container."; +static constexpr const char *unitMetricContainerDiskIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricContainerDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerDiskIo, descrMetricContainerDiskIo, + unitMetricContainerDiskIo); +} + +static nostd::shared_ptr CreateAsyncMetricContainerDiskIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricContainerDiskIo, descrMetricContainerDiskIo, + unitMetricContainerDiskIo); +} + +/** + * Memory usage of the container. + *

+ * Memory usage of the container. + *

+ * counter + */ +static constexpr const char *kMetricContainerMemoryUsage = "metric.container.memory.usage"; +static constexpr const char *descrMetricContainerMemoryUsage = "Memory usage of the container."; +static constexpr const char *unitMetricContainerMemoryUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricContainerMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, + unitMetricContainerMemoryUsage); +} + +static nostd::shared_ptr CreateAsyncMetricContainerMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, unitMetricContainerMemoryUsage); +} + +/** + * Network bytes for the container. + *

+ * The number of bytes sent/received on all network interfaces by the container. + *

+ * counter + */ +static constexpr const char *kMetricContainerNetworkIo = "metric.container.network.io"; +static constexpr const char *descrMetricContainerNetworkIo = "Network bytes for the container."; +static constexpr const char *unitMetricContainerNetworkIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricContainerNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerNetworkIo, descrMetricContainerNetworkIo, + unitMetricContainerNetworkIo); +} + +static nostd::shared_ptr CreateAsyncMetricContainerNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricContainerNetworkIo, descrMetricContainerNetworkIo, unitMetricContainerNetworkIo); +} + +} // namespace container +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cpu_attributes.h b/api/include/opentelemetry/semconv/incubating/cpu_attributes.h new file mode 100644 index 0000000000..b5ca637e31 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cpu_attributes.h @@ -0,0 +1,73 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cpu +{ + +/** + * The mode of the CPU + */ +static constexpr const char *kCpuMode = "cpu.mode"; + +namespace CpuModeValues +{ +/** + * none + */ +static constexpr const char *kUser = "user"; + +/** + * none + */ +static constexpr const char *kSystem = "system"; + +/** + * none + */ +static constexpr const char *kNice = "nice"; + +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kIowait = "iowait"; + +/** + * none + */ +static constexpr const char *kInterrupt = "interrupt"; + +/** + * none + */ +static constexpr const char *kSteal = "steal"; + +/** + * none + */ +static constexpr const char *kKernel = "kernel"; + +} // namespace CpuModeValues + +} // namespace cpu +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/db_attributes.h b/api/include/opentelemetry/semconv/incubating/db_attributes.h new file mode 100644 index 0000000000..940f88b7da --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/db_attributes.h @@ -0,0 +1,820 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace db +{ + +/** + * The consistency level of the query. Based on consistency values from CQL. + */ +static constexpr const char *kDbCassandraConsistencyLevel = "db.cassandra.consistency_level"; + +/** + * The data center of the coordinating node for a query. + */ +static constexpr const char *kDbCassandraCoordinatorDc = "db.cassandra.coordinator.dc"; + +/** + * The ID of the coordinating node for a query. + */ +static constexpr const char *kDbCassandraCoordinatorId = "db.cassandra.coordinator.id"; + +/** + * Whether or not the query is idempotent. + */ +static constexpr const char *kDbCassandraIdempotence = "db.cassandra.idempotence"; + +/** + * The fetch size used for paging, i.e. how many rows will be returned at once. + */ +static constexpr const char *kDbCassandraPageSize = "db.cassandra.page_size"; + +/** + * The number of times a query was speculatively executed. Not set or @code 0 @endcode if the query + * was not executed speculatively. + */ +static constexpr const char *kDbCassandraSpeculativeExecutionCount = + "db.cassandra.speculative_execution_count"; + +/** + * Deprecated, use @code db.collection.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.collection.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbCassandraTable = "db.cassandra.table"; + +/** + * The name of the connection pool; unique within the instrumented application. In case the + * connection pool implementation doesn't provide a name, instrumentation SHOULD use a combination + * of parameters that would make the name unique, for example, combining attributes @code + * server.address @endcode, @code server.port @endcode, and @code db.namespace @endcode, formatted + * as @code server.address:server.port/db.namespace @endcode. Instrumentations that generate + * connection pool name following different patterns SHOULD document it. + */ +static constexpr const char *kDbClientConnectionPoolName = "db.client.connection.pool.name"; + +/** + * The state of a connection in the pool + */ +static constexpr const char *kDbClientConnectionState = "db.client.connection.state"; + +/** + * Deprecated, use @code db.client.connection.pool.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.pool.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsPoolName = "db.client.connections.pool.name"; + +/** + * Deprecated, use @code db.client.connection.state @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.state @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsState = "db.client.connections.state"; + +/** + * The name of a collection (table, container) within the database. + *

+ * It is RECOMMENDED to capture the value as provided by the application without attempting to do + * any case normalization. If the collection name is parsed from the query text, it SHOULD be the + * first collection name found in the query and it SHOULD match the value provided in the query text + * including any schema and database name prefix. For batch operations, if the individual operations + * are known to have the same collection name then that collection name SHOULD be used, otherwise + * @code db.collection.name @endcode SHOULD NOT be captured. + */ +static constexpr const char *kDbCollectionName = "db.collection.name"; + +/** + * Deprecated, use @code server.address @endcode, @code server.port @endcode attributes instead. + *

+ * @deprecated + * "Replaced by @code server.address @endcode and @code server.port @endcode." + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbConnectionString = "db.connection_string"; + +/** + * Unique Cosmos client instance id. + */ +static constexpr const char *kDbCosmosdbClientId = "db.cosmosdb.client_id"; + +/** + * Cosmos client connection mode. + */ +static constexpr const char *kDbCosmosdbConnectionMode = "db.cosmosdb.connection_mode"; + +/** + * Deprecated, use @code db.collection.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.collection.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; + +/** + * CosmosDB Operation Type. + */ +static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; + +/** + * RU consumed for that operation + */ +static constexpr const char *kDbCosmosdbRequestCharge = "db.cosmosdb.request_charge"; + +/** + * Request payload size in bytes + */ +static constexpr const char *kDbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length"; + +/** + * Cosmos DB status code. + */ +static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; + +/** + * Cosmos DB sub status code. + */ +static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; + +/** + * Deprecated, use @code db.namespace @endcode instead. + *

+ * @deprecated + * Replaced by @code db.namespace @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; + +/** + * Represents the human-readable identifier of the node/instance to which a request was routed. + */ +static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.name"; + +/** + * A dynamic value in the url path. + *

+ * Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in + * the format @code db.elasticsearch.path_parts. @endcode, where @code @endcode is the + * url path part name. The implementation SHOULD reference the elasticsearch + * schema in order to map the path part values to their names. + */ +static constexpr const char *kDbElasticsearchPathParts = "db.elasticsearch.path_parts"; + +/** + * Deprecated, no general replacement at this time. For Elasticsearch, use @code + * db.elasticsearch.node.name @endcode instead.

+ * @deprecated + * Deprecated, no general replacement at this time. For Elasticsearch, use @code + * db.elasticsearch.node.name @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbInstanceId = "db.instance.id"; + +/** + * Removed, no replacement at this time. + *

+ * @deprecated + * Removed as not used. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbJdbcDriverClassname = "db.jdbc.driver_classname"; + +/** + * Deprecated, use @code db.collection.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.collection.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbMongodbCollection = "db.mongodb.collection"; + +/** + * Deprecated, SQL Server instance is now populated as a part of @code db.namespace @endcode + * attribute.

+ * @deprecated + * Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbMssqlInstanceName = "db.mssql.instance_name"; + +/** + * Deprecated, use @code db.namespace @endcode instead. + *

+ * @deprecated + * Replaced by @code db.namespace @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbName = "db.name"; + +/** + * The name of the database, fully qualified within the server address and port. + *

+ * If a database system has multiple namespace components, they SHOULD be concatenated (potentially + * using database system specific conventions) from most general to most specific namespace + * component, and more specific namespaces SHOULD NOT be captured without the more general + * namespaces, to ensure that "startswith" queries for the more general namespaces will be valid. + * Semantic conventions for individual database systems SHOULD document what @code db.namespace + * @endcode means in the context of that system. It is RECOMMENDED to capture the value as provided + * by the application without attempting to do any case normalization. + */ +static constexpr const char *kDbNamespace = "db.namespace"; + +/** + * Deprecated, use @code db.operation.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.operation.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbOperation = "db.operation"; + +/** + * The number of queries included in a batch operation.

Operations are + * only considered batches when they contain two or more operations, and so @code + * db.operation.batch.size @endcode SHOULD never be @code 1 @endcode. + */ +static constexpr const char *kDbOperationBatchSize = "db.operation.batch.size"; + +/** + * The name of the operation or command being executed. + *

+ * It is RECOMMENDED to capture the value as provided by the application without attempting to do + * any case normalization. If the operation name is parsed from the query text, it SHOULD be the + * first operation name found in the query. For batch operations, if the individual operations are + * known to have the same operation name then that operation name SHOULD be used prepended by @code + * BATCH @endcode, otherwise @code db.operation.name @endcode SHOULD be @code BATCH @endcode or + * some other database system specific term if more applicable. + */ +static constexpr const char *kDbOperationName = "db.operation.name"; + +/** + * A query parameter used in @code db.query.text @endcode, with @code @endcode being the + * parameter name, and the attribute value being a string representation of the parameter value.

+ * Query parameters should only be captured when @code db.query.text @endcode is parameterized with + * placeholders. If a parameter has no name and instead is referenced only by index, then @code + * @endcode SHOULD be the 0-based index. + */ +static constexpr const char *kDbQueryParameter = "db.query.parameter"; + +/** + * The database query being executed. + *

+ * For sanitization see Sanitization of @code + * db.query.text @endcode. For batch operations, if the individual operations are known to have + * the same query text then that query text SHOULD be used, otherwise all of the individual query + * texts SHOULD be concatenated with separator @code ; @endcode or some other database system + * specific separator if more applicable. Even though parameterized query text can potentially have + * sensitive data, by using a parameterized query the user is giving a strong signal that any + * sensitive data will be passed as parameter values, and the benefit to observability of capturing + * the static part of the query text by default outweighs the risk. + */ +static constexpr const char *kDbQueryText = "db.query.text"; + +/** + * Deprecated, use @code db.namespace @endcode instead. + *

+ * @deprecated + * Replaced by @code db.namespace @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbRedisDatabaseIndex = "db.redis.database_index"; + +/** + * Deprecated, use @code db.collection.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.collection.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbSqlTable = "db.sql.table"; + +/** + * The database statement being executed. + *

+ * @deprecated + * Replaced by @code db.query.text @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbStatement = "db.statement"; + +/** + * The database management system (DBMS) product as identified by the client instrumentation. + *

+ * The actual DBMS may differ from the one identified by the client. For example, when using + * PostgreSQL client libraries to connect to a CockroachDB, the @code db.system @endcode is set to + * @code postgresql @endcode based on the instrumentation's best knowledge. + */ +static constexpr const char *kDbSystem = "db.system"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * No replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbUser = "db.user"; + +namespace DbCassandraConsistencyLevelValues +{ +/** + * none + */ +static constexpr const char *kAll = "all"; + +/** + * none + */ +static constexpr const char *kEachQuorum = "each_quorum"; + +/** + * none + */ +static constexpr const char *kQuorum = "quorum"; + +/** + * none + */ +static constexpr const char *kLocalQuorum = "local_quorum"; + +/** + * none + */ +static constexpr const char *kOne = "one"; + +/** + * none + */ +static constexpr const char *kTwo = "two"; + +/** + * none + */ +static constexpr const char *kThree = "three"; + +/** + * none + */ +static constexpr const char *kLocalOne = "local_one"; + +/** + * none + */ +static constexpr const char *kAny = "any"; + +/** + * none + */ +static constexpr const char *kSerial = "serial"; + +/** + * none + */ +static constexpr const char *kLocalSerial = "local_serial"; + +} // namespace DbCassandraConsistencyLevelValues + +namespace DbClientConnectionStateValues +{ +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kUsed = "used"; + +} // namespace DbClientConnectionStateValues + +namespace DbClientConnectionsStateValues +{ +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kUsed = "used"; + +} // namespace DbClientConnectionsStateValues + +namespace DbCosmosdbConnectionModeValues +{ +/** + * Gateway (HTTP) connections mode + */ +static constexpr const char *kGateway = "gateway"; + +/** + * Direct connection. + */ +static constexpr const char *kDirect = "direct"; + +} // namespace DbCosmosdbConnectionModeValues + +namespace DbCosmosdbOperationTypeValues +{ +/** + * none + */ +static constexpr const char *kInvalid = "Invalid"; + +/** + * none + */ +static constexpr const char *kCreate = "Create"; + +/** + * none + */ +static constexpr const char *kPatch = "Patch"; + +/** + * none + */ +static constexpr const char *kRead = "Read"; + +/** + * none + */ +static constexpr const char *kReadFeed = "ReadFeed"; + +/** + * none + */ +static constexpr const char *kDelete = "Delete"; + +/** + * none + */ +static constexpr const char *kReplace = "Replace"; + +/** + * none + */ +static constexpr const char *kExecute = "Execute"; + +/** + * none + */ +static constexpr const char *kQuery = "Query"; + +/** + * none + */ +static constexpr const char *kHead = "Head"; + +/** + * none + */ +static constexpr const char *kHeadFeed = "HeadFeed"; + +/** + * none + */ +static constexpr const char *kUpsert = "Upsert"; + +/** + * none + */ +static constexpr const char *kBatch = "Batch"; + +/** + * none + */ +static constexpr const char *kQueryPlan = "QueryPlan"; + +/** + * none + */ +static constexpr const char *kExecuteJavascript = "ExecuteJavaScript"; + +} // namespace DbCosmosdbOperationTypeValues + +namespace DbSystemValues +{ +/** + * Some other SQL database. Fallback only. See notes. + */ +static constexpr const char *kOtherSql = "other_sql"; + +/** + * Adabas (Adaptable Database System) + */ +static constexpr const char *kAdabas = "adabas"; + +/** + * Deprecated, use @code intersystems_cache @endcode instead. + *

+ * @deprecated + * Replaced by @code intersystems_cache @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kCache = "cache"; + +/** + * InterSystems Caché + */ +static constexpr const char *kIntersystemsCache = "intersystems_cache"; + +/** + * Apache Cassandra + */ +static constexpr const char *kCassandra = "cassandra"; + +/** + * ClickHouse + */ +static constexpr const char *kClickhouse = "clickhouse"; + +/** + * Deprecated, use @code other_sql @endcode instead. + *

+ * @deprecated + * Replaced by @code other_sql @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kCloudscape = "cloudscape"; + +/** + * CockroachDB + */ +static constexpr const char *kCockroachdb = "cockroachdb"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * Removed. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kColdfusion = "coldfusion"; + +/** + * Microsoft Azure Cosmos DB + */ +static constexpr const char *kCosmosdb = "cosmosdb"; + +/** + * Couchbase + */ +static constexpr const char *kCouchbase = "couchbase"; + +/** + * CouchDB + */ +static constexpr const char *kCouchdb = "couchdb"; + +/** + * IBM Db2 + */ +static constexpr const char *kDb2 = "db2"; + +/** + * Apache Derby + */ +static constexpr const char *kDerby = "derby"; + +/** + * Amazon DynamoDB + */ +static constexpr const char *kDynamodb = "dynamodb"; + +/** + * EnterpriseDB + */ +static constexpr const char *kEdb = "edb"; + +/** + * Elasticsearch + */ +static constexpr const char *kElasticsearch = "elasticsearch"; + +/** + * FileMaker + */ +static constexpr const char *kFilemaker = "filemaker"; + +/** + * Firebird + */ +static constexpr const char *kFirebird = "firebird"; + +/** + * Deprecated, use @code other_sql @endcode instead. + *

+ * @deprecated + * Replaced by @code other_sql @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kFirstsql = "firstsql"; + +/** + * Apache Geode + */ +static constexpr const char *kGeode = "geode"; + +/** + * H2 + */ +static constexpr const char *kH2 = "h2"; + +/** + * SAP HANA + */ +static constexpr const char *kHanadb = "hanadb"; + +/** + * Apache HBase + */ +static constexpr const char *kHbase = "hbase"; + +/** + * Apache Hive + */ +static constexpr const char *kHive = "hive"; + +/** + * HyperSQL DataBase + */ +static constexpr const char *kHsqldb = "hsqldb"; + +/** + * InfluxDB + */ +static constexpr const char *kInfluxdb = "influxdb"; + +/** + * Informix + */ +static constexpr const char *kInformix = "informix"; + +/** + * Ingres + */ +static constexpr const char *kIngres = "ingres"; + +/** + * InstantDB + */ +static constexpr const char *kInstantdb = "instantdb"; + +/** + * InterBase + */ +static constexpr const char *kInterbase = "interbase"; + +/** + * MariaDB + */ +static constexpr const char *kMariadb = "mariadb"; + +/** + * SAP MaxDB + */ +static constexpr const char *kMaxdb = "maxdb"; + +/** + * Memcached + */ +static constexpr const char *kMemcached = "memcached"; + +/** + * MongoDB + */ +static constexpr const char *kMongodb = "mongodb"; + +/** + * Microsoft SQL Server + */ +static constexpr const char *kMssql = "mssql"; + +/** + * Deprecated, Microsoft SQL Server Compact is discontinued. + *

+ * @deprecated + * Removed, use @code other_sql @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMssqlcompact = "mssqlcompact"; + +/** + * MySQL + */ +static constexpr const char *kMysql = "mysql"; + +/** + * Neo4j + */ +static constexpr const char *kNeo4j = "neo4j"; + +/** + * Netezza + */ +static constexpr const char *kNetezza = "netezza"; + +/** + * OpenSearch + */ +static constexpr const char *kOpensearch = "opensearch"; + +/** + * Oracle Database + */ +static constexpr const char *kOracle = "oracle"; + +/** + * Pervasive PSQL + */ +static constexpr const char *kPervasive = "pervasive"; + +/** + * PointBase + */ +static constexpr const char *kPointbase = "pointbase"; + +/** + * PostgreSQL + */ +static constexpr const char *kPostgresql = "postgresql"; + +/** + * Progress Database + */ +static constexpr const char *kProgress = "progress"; + +/** + * Redis + */ +static constexpr const char *kRedis = "redis"; + +/** + * Amazon Redshift + */ +static constexpr const char *kRedshift = "redshift"; + +/** + * Cloud Spanner + */ +static constexpr const char *kSpanner = "spanner"; + +/** + * SQLite + */ +static constexpr const char *kSqlite = "sqlite"; + +/** + * Sybase + */ +static constexpr const char *kSybase = "sybase"; + +/** + * Teradata + */ +static constexpr const char *kTeradata = "teradata"; + +/** + * Trino + */ +static constexpr const char *kTrino = "trino"; + +/** + * Vertica + */ +static constexpr const char *kVertica = "vertica"; + +} // namespace DbSystemValues + +} // namespace db +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/db_metrics.h b/api/include/opentelemetry/semconv/incubating/db_metrics.h new file mode 100644 index 0000000000..a2bda6b9c3 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/db_metrics.h @@ -0,0 +1,574 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace db +{ + +/** + * The number of connections that are currently in state described by the @code state @endcode + * attribute

updowncounter + */ +static constexpr const char *kMetricDbClientConnectionCount = "metric.db.client.connection.count"; +static constexpr const char *descrMetricDbClientConnectionCount = + "The number of connections that are currently in state described by the `state` attribute"; +static constexpr const char *unitMetricDbClientConnectionCount = "{connection}"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionCount, + descrMetricDbClientConnectionCount, + unitMetricDbClientConnectionCount); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionCount, + descrMetricDbClientConnectionCount, + unitMetricDbClientConnectionCount); +} + +/** + * The time it took to create a new connection + *

+ * histogram + */ +static constexpr const char *kMetricDbClientConnectionCreateTime = + "metric.db.client.connection.create_time"; +static constexpr const char *descrMetricDbClientConnectionCreateTime = + "The time it took to create a new connection"; +static constexpr const char *unitMetricDbClientConnectionCreateTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionCreateTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionCreateTime, + descrMetricDbClientConnectionCreateTime, + unitMetricDbClientConnectionCreateTime); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionCreateTime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionCreateTime, + descrMetricDbClientConnectionCreateTime, + unitMetricDbClientConnectionCreateTime); +} + +/** + * The maximum number of idle open connections allowed + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientConnectionIdleMax = + "metric.db.client.connection.idle.max"; +static constexpr const char *descrMetricDbClientConnectionIdleMax = + "The maximum number of idle open connections allowed"; +static constexpr const char *unitMetricDbClientConnectionIdleMax = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionIdleMax(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionIdleMax, + descrMetricDbClientConnectionIdleMax, + unitMetricDbClientConnectionIdleMax); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionIdleMax( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionIdleMax, + descrMetricDbClientConnectionIdleMax, + unitMetricDbClientConnectionIdleMax); +} + +/** + * The minimum number of idle open connections allowed + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientConnectionIdleMin = + "metric.db.client.connection.idle.min"; +static constexpr const char *descrMetricDbClientConnectionIdleMin = + "The minimum number of idle open connections allowed"; +static constexpr const char *unitMetricDbClientConnectionIdleMin = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionIdleMin(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionIdleMin, + descrMetricDbClientConnectionIdleMin, + unitMetricDbClientConnectionIdleMin); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionIdleMin( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionIdleMin, + descrMetricDbClientConnectionIdleMin, + unitMetricDbClientConnectionIdleMin); +} + +/** + * The maximum number of open connections allowed + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientConnectionMax = "metric.db.client.connection.max"; +static constexpr const char *descrMetricDbClientConnectionMax = + "The maximum number of open connections allowed"; +static constexpr const char *unitMetricDbClientConnectionMax = "{connection}"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionMax( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionMax( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +/** + * The number of pending requests for an open connection, cumulative for the entire pool + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientConnectionPendingRequests = + "metric.db.client.connection.pending_requests"; +static constexpr const char *descrMetricDbClientConnectionPendingRequests = + "The number of pending requests for an open connection, cumulative for the entire pool"; +static constexpr const char *unitMetricDbClientConnectionPendingRequests = "{request}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionPendingRequests, + descrMetricDbClientConnectionPendingRequests, + unitMetricDbClientConnectionPendingRequests); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionPendingRequests, + descrMetricDbClientConnectionPendingRequests, + unitMetricDbClientConnectionPendingRequests); +} + +/** + * The number of connection timeouts that have occurred trying to obtain a connection from the pool + *

+ * counter + */ +static constexpr const char *kMetricDbClientConnectionTimeouts = + "metric.db.client.connection.timeouts"; +static constexpr const char *descrMetricDbClientConnectionTimeouts = + "The number of connection timeouts that have occurred trying to obtain a connection from the " + "pool"; +static constexpr const char *unitMetricDbClientConnectionTimeouts = "{timeout}"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionTimeouts( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricDbClientConnectionTimeouts, + descrMetricDbClientConnectionTimeouts, + unitMetricDbClientConnectionTimeouts); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionTimeouts( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionTimeouts, + descrMetricDbClientConnectionTimeouts, + unitMetricDbClientConnectionTimeouts); +} + +/** + * The time between borrowing a connection and returning it to the pool + *

+ * histogram + */ +static constexpr const char *kMetricDbClientConnectionUseTime = + "metric.db.client.connection.use_time"; +static constexpr const char *descrMetricDbClientConnectionUseTime = + "The time between borrowing a connection and returning it to the pool"; +static constexpr const char *unitMetricDbClientConnectionUseTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionUseTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionUseTime, + descrMetricDbClientConnectionUseTime, + unitMetricDbClientConnectionUseTime); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionUseTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionUseTime, + descrMetricDbClientConnectionUseTime, + unitMetricDbClientConnectionUseTime); +} + +/** + * The time it took to obtain an open connection from the pool + *

+ * histogram + */ +static constexpr const char *kMetricDbClientConnectionWaitTime = + "metric.db.client.connection.wait_time"; +static constexpr const char *descrMetricDbClientConnectionWaitTime = + "The time it took to obtain an open connection from the pool"; +static constexpr const char *unitMetricDbClientConnectionWaitTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricDbClientConnectionWaitTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionWaitTime, + descrMetricDbClientConnectionWaitTime, + unitMetricDbClientConnectionWaitTime); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientConnectionWaitTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionWaitTime, + descrMetricDbClientConnectionWaitTime, + unitMetricDbClientConnectionWaitTime); +} + +/** + * Deprecated, use @code db.client.connection.create_time @endcode instead. Note: the unit also + * changed from @code ms @endcode to @code s @endcode.

+ * @deprecated + * Replaced by @code db.client.connection.create_time @endcode. Note: the unit also changed from + * @code ms @endcode to @code s @endcode.

histogram + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsCreateTimeDeprecated = + "metric.db.client.connections.create_time.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsCreateTimeDeprecated = + "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +static constexpr const char *unitMetricDbClientConnectionsCreateTimeDeprecated = "ms"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsCreateTimeDeprecated, + descrMetricDbClientConnectionsCreateTimeDeprecated, + unitMetricDbClientConnectionsCreateTimeDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionsCreateTimeDeprecated, + descrMetricDbClientConnectionsCreateTimeDeprecated, + unitMetricDbClientConnectionsCreateTimeDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.idle.max @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.idle.max @endcode. + *

+ * updowncounter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsIdleMaxDeprecated = + "metric.db.client.connections.idle.max.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsIdleMaxDeprecated = + "Deprecated, use `db.client.connection.idle.max` instead."; +static constexpr const char *unitMetricDbClientConnectionsIdleMaxDeprecated = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, + descrMetricDbClientConnectionsIdleMaxDeprecated, + unitMetricDbClientConnectionsIdleMaxDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, + descrMetricDbClientConnectionsIdleMaxDeprecated, + unitMetricDbClientConnectionsIdleMaxDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.idle.min @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.idle.min @endcode. + *

+ * updowncounter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsIdleMinDeprecated = + "metric.db.client.connections.idle.min.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsIdleMinDeprecated = + "Deprecated, use `db.client.connection.idle.min` instead."; +static constexpr const char *unitMetricDbClientConnectionsIdleMinDeprecated = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, + descrMetricDbClientConnectionsIdleMinDeprecated, + unitMetricDbClientConnectionsIdleMinDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, + descrMetricDbClientConnectionsIdleMinDeprecated, + unitMetricDbClientConnectionsIdleMinDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.max @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.max @endcode. + *

+ * updowncounter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsMaxDeprecated = + "metric.db.client.connections.max.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsMaxDeprecated = + "Deprecated, use `db.client.connection.max` instead."; +static constexpr const char *unitMetricDbClientConnectionsMaxDeprecated = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsMaxDeprecated, + descrMetricDbClientConnectionsMaxDeprecated, + unitMetricDbClientConnectionsMaxDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, + descrMetricDbClientConnectionsMaxDeprecated, + unitMetricDbClientConnectionsMaxDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.pending_requests @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.pending_requests @endcode. + *

+ * updowncounter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsPendingRequestsDeprecated = + "metric.db.client.connections.pending_requests.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsPendingRequestsDeprecated = + "Deprecated, use `db.client.connection.pending_requests` instead."; +static constexpr const char *unitMetricDbClientConnectionsPendingRequestsDeprecated = "{request}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsPendingRequestsDeprecated, + descrMetricDbClientConnectionsPendingRequestsDeprecated, + unitMetricDbClientConnectionsPendingRequestsDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricDbClientConnectionsPendingRequestsDeprecated, + descrMetricDbClientConnectionsPendingRequestsDeprecated, + unitMetricDbClientConnectionsPendingRequestsDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.timeouts @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.timeouts @endcode. + *

+ * counter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsTimeoutsDeprecated = + "metric.db.client.connections.timeouts.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsTimeoutsDeprecated = + "Deprecated, use `db.client.connection.timeouts` instead."; +static constexpr const char *unitMetricDbClientConnectionsTimeoutsDeprecated = "{timeout}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricDbClientConnectionsTimeoutsDeprecated, + descrMetricDbClientConnectionsTimeoutsDeprecated, + unitMetricDbClientConnectionsTimeoutsDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionsTimeoutsDeprecated, + descrMetricDbClientConnectionsTimeoutsDeprecated, + unitMetricDbClientConnectionsTimeoutsDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.count @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.count @endcode. + *

+ * updowncounter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsCountDeprecated = + "metric.db.client.connections.count.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsCountDeprecated = + "Deprecated, use `db.client.connection.count` instead."; +static constexpr const char *unitMetricDbClientConnectionsCountDeprecated = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsCountDeprecated, + descrMetricDbClientConnectionsCountDeprecated, + unitMetricDbClientConnectionsCountDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsCountDeprecated, + descrMetricDbClientConnectionsCountDeprecated, + unitMetricDbClientConnectionsCountDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.use_time @endcode instead. Note: the unit also changed + * from @code ms @endcode to @code s @endcode.

+ * @deprecated + * Replaced by @code db.client.connection.use_time @endcode. Note: the unit also changed from @code + * ms @endcode to @code s @endcode.

histogram + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsUseTimeDeprecated = + "metric.db.client.connections.use_time.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsUseTimeDeprecated = + "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +static constexpr const char *unitMetricDbClientConnectionsUseTimeDeprecated = "ms"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsUseTimeDeprecated, + descrMetricDbClientConnectionsUseTimeDeprecated, + unitMetricDbClientConnectionsUseTimeDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionsUseTimeDeprecated, + descrMetricDbClientConnectionsUseTimeDeprecated, + unitMetricDbClientConnectionsUseTimeDeprecated); +} + +/** + * Deprecated, use @code db.client.connection.wait_time @endcode instead. Note: the unit also + * changed from @code ms @endcode to @code s @endcode.

+ * @deprecated + * Replaced by @code db.client.connection.wait_time @endcode. Note: the unit also changed from @code + * ms @endcode to @code s @endcode.

histogram + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricDbClientConnectionsWaitTimeDeprecated = + "metric.db.client.connections.wait_time.deprecated"; +static constexpr const char *descrMetricDbClientConnectionsWaitTimeDeprecated = + "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +static constexpr const char *unitMetricDbClientConnectionsWaitTimeDeprecated = "ms"; + +static nostd::unique_ptr> +CreateSyncMetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsWaitTimeDeprecated, + descrMetricDbClientConnectionsWaitTimeDeprecated, + unitMetricDbClientConnectionsWaitTimeDeprecated); +} + +static nostd::shared_ptr +CreateAsyncMetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientConnectionsWaitTimeDeprecated, + descrMetricDbClientConnectionsWaitTimeDeprecated, + unitMetricDbClientConnectionsWaitTimeDeprecated); +} + +/** + * Duration of database client operations. + *

+ * Batch operations SHOULD be recorded as a single operation. + *

+ * histogram + */ +static constexpr const char *kMetricDbClientOperationDuration = + "metric.db.client.operation.duration"; +static constexpr const char *descrMetricDbClientOperationDuration = + "Duration of database client operations."; +static constexpr const char *unitMetricDbClientOperationDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricDbClientOperationDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientOperationDuration, + descrMetricDbClientOperationDuration, + unitMetricDbClientOperationDuration); +} + +static nostd::shared_ptr CreateAsyncMetricDbClientOperationDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricDbClientOperationDuration, + descrMetricDbClientOperationDuration, + unitMetricDbClientOperationDuration); +} + +} // namespace db +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/deployment_attributes.h b/api/include/opentelemetry/semconv/incubating/deployment_attributes.h new file mode 100644 index 0000000000..9c4594b7f3 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/deployment_attributes.h @@ -0,0 +1,76 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace deployment +{ + +/** + * 'Deprecated, use @code deployment.environment.name @endcode instead.' + *

+ * @deprecated + * Deprecated, use @code deployment.environment.name @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDeploymentEnvironment = "deployment.environment"; + +/** + * Name of the deployment + * environment (aka deployment tier).

+ * @code deployment.environment.name @endcode does not affect the uniqueness constraints defined + * through the @code service.namespace @endcode, @code service.name @endcode and @code + * service.instance.id @endcode resource attributes. This implies that resources carrying the + * following attribute combinations MUST be considered to be identifying the same service:

+ */ +static constexpr const char *kDeploymentEnvironmentName = "deployment.environment.name"; + +/** + * The id of the deployment. + */ +static constexpr const char *kDeploymentId = "deployment.id"; + +/** + * The name of the deployment. + */ +static constexpr const char *kDeploymentName = "deployment.name"; + +/** + * The status of the deployment. + */ +static constexpr const char *kDeploymentStatus = "deployment.status"; + +namespace DeploymentStatusValues +{ +/** + * failed + */ +static constexpr const char *kFailed = "failed"; + +/** + * succeeded + */ +static constexpr const char *kSucceeded = "succeeded"; + +} // namespace DeploymentStatusValues + +} // namespace deployment +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/destination_attributes.h b/api/include/opentelemetry/semconv/incubating/destination_attributes.h new file mode 100644 index 0000000000..5069fc03b7 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/destination_attributes.h @@ -0,0 +1,37 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace destination +{ + +/** + * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address + * or Unix domain socket name.

When observed from the source side, and when communicating + * through an intermediary, @code destination.address @endcode SHOULD represent the destination + * address behind any intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kDestinationAddress = "destination.address"; + +/** + * Destination port number + */ +static constexpr const char *kDestinationPort = "destination.port"; + +} // namespace destination +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/device_attributes.h b/api/include/opentelemetry/semconv/incubating/device_attributes.h new file mode 100644 index 0000000000..c2c80f5fd2 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/device_attributes.h @@ -0,0 +1,66 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace device +{ + +/** + * A unique identifier representing the device + *

+ * 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 + * identifier. 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 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. + */ +static constexpr const char *kDeviceId = "device.id"; + +/** + * The name of the device manufacturer + *

+ * The Android OS provides this field via Build. iOS apps + * SHOULD hardcode the value @code Apple @endcode. + */ +static constexpr const char *kDeviceManufacturer = "device.manufacturer"; + +/** + * The model identifier for the device + *

+ * 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. + */ +static constexpr const char *kDeviceModelIdentifier = "device.model.identifier"; + +/** + * The marketing name for the device model + *

+ * It's recommended this value represents a human-readable version of the device model rather than a + * machine-readable alternative. + */ +static constexpr const char *kDeviceModelName = "device.model.name"; + +} // namespace device +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/disk_attributes.h b/api/include/opentelemetry/semconv/incubating/disk_attributes.h new file mode 100644 index 0000000000..ff938a9612 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/disk_attributes.h @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace disk +{ + +/** + * The disk IO operation direction. + */ +static constexpr const char *kDiskIoDirection = "disk.io.direction"; + +namespace DiskIoDirectionValues +{ +/** + * none + */ +static constexpr const char *kRead = "read"; + +/** + * none + */ +static constexpr const char *kWrite = "write"; + +} // namespace DiskIoDirectionValues + +} // namespace disk +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/dns_attributes.h b/api/include/opentelemetry/semconv/incubating/dns_attributes.h new file mode 100644 index 0000000000..b835e2a73a --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/dns_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace dns +{ + +/** + * The name being queried. + *

+ * If the name field contains non-printable characters (below 32 or above 126), those characters + * should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be + * escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n + * respectively. + */ +static constexpr const char *kDnsQuestionName = "dns.question.name"; + +} // namespace dns +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/dns_metrics.h b/api/include/opentelemetry/semconv/incubating/dns_metrics.h new file mode 100644 index 0000000000..abd9513a0c --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/dns_metrics.h @@ -0,0 +1,48 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace dns +{ + +/** + * Measures the time taken to perform a DNS lookup. + *

+ * histogram + */ +static constexpr const char *kMetricDnsLookupDuration = "metric.dns.lookup.duration"; +static constexpr const char *descrMetricDnsLookupDuration = + "Measures the time taken to perform a DNS lookup."; +static constexpr const char *unitMetricDnsLookupDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricDnsLookupDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDnsLookupDuration, descrMetricDnsLookupDuration, + unitMetricDnsLookupDuration); +} + +static nostd::shared_ptr CreateAsyncMetricDnsLookupDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricDnsLookupDuration, descrMetricDnsLookupDuration, unitMetricDnsLookupDuration); +} + +} // namespace dns +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/enduser_attributes.h b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h new file mode 100644 index 0000000000..217d5dd414 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h @@ -0,0 +1,51 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace enduser +{ + +/** + * Deprecated, use @code user.id @endcode instead. + *

+ * @deprecated + * Replaced by @code user.id @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserId = "enduser.id"; + +/** + * Deprecated, use @code user.roles @endcode instead. + *

+ * @deprecated + * Replaced by @code user.roles @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserRole = "enduser.role"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * Removed. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserScope = "enduser.scope"; + +} // namespace enduser +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/error_attributes.h b/api/include/opentelemetry/semconv/incubating/error_attributes.h new file mode 100644 index 0000000000..1b711ff112 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/error_attributes.h @@ -0,0 +1,57 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace error +{ + +/** + * Describes a class of error the operation ended with. + *

+ * The @code error.type @endcode SHOULD be predictable, and SHOULD have low cardinality. + *

+ * When @code error.type @endcode is set to a type (e.g., an exception type), its + * canonical class name identifying the type within the artifact SHOULD be used. + *

+ * Instrumentations SHOULD document the list of errors they report. + *

+ * The cardinality of @code error.type @endcode within one instrumentation library SHOULD be low. + * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications + * should be prepared for @code error.type @endcode to have high cardinality at query time when no + * additional filters are applied. + *

+ * If the operation has completed successfully, instrumentations SHOULD NOT set @code error.type + * @endcode.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC + * status codes), it's RECOMMENDED to:

+ */ +static constexpr const char *kErrorType = "error.type"; + +namespace ErrorTypeValues +{ +/** + * A fallback error value to be used when the instrumentation doesn't define a custom value. + */ +static constexpr const char *kOther = "_OTHER"; + +} // namespace ErrorTypeValues + +} // namespace error +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/event_attributes.h b/api/include/opentelemetry/semconv/incubating/event_attributes.h new file mode 100644 index 0000000000..c2faa437cf --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/event_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace event +{ + +/** + * Identifies the class / type of event. + *

+ * Event names are subject to the same rules as attribute names. Notably, event names are namespaced + * to avoid collisions and provide a clean separation of semantics for events in separate domains + * like browser, mobile, and kubernetes. + */ +static constexpr const char *kEventName = "event.name"; + +} // namespace event +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/exception_attributes.h b/api/include/opentelemetry/semconv/incubating/exception_attributes.h new file mode 100644 index 0000000000..fdc19ac6d0 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/exception_attributes.h @@ -0,0 +1,59 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace exception +{ + +/** + * SHOULD be set to true if the exception event is recorded at a point where it is known that the + * exception is escaping the scope of the span.

An exception is considered to have escaped (or + * left) the scope of a span, if that span is ended while the exception is still logically "in + * flight". This may be actually "in flight" in some languages (e.g. if the exception is passed to a + * Context manager's @code __exit__ @endcode method in Python) but will usually be caught at the + * point of recording the exception in most languages.

It is usually not possible to determine + * at the point where an exception is thrown whether it will escape the scope of a span. However, it + * is trivial to know that an exception will escape, if one checks for an active exception just + * before ending the span, as done in the example + * for recording span exceptions.

It follows that an exception may still escape the scope of + * the span even if the @code exception.escaped @endcode attribute was not set or set to false, + * since the event might have been recorded at a time where it was not + * clear whether the exception will escape. + */ +static constexpr const char *kExceptionEscaped = "exception.escaped"; + +/** + * The exception message. + */ +static constexpr const char *kExceptionMessage = "exception.message"; + +/** + * A stacktrace as a string in the natural representation for the language runtime. The + * representation is to be determined and documented by each language SIG. + */ +static constexpr const char *kExceptionStacktrace = "exception.stacktrace"; + +/** + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of + * the exception should be preferred over the static type in languages that support it. + */ +static constexpr const char *kExceptionType = "exception.type"; + +} // namespace exception +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/faas_attributes.h b/api/include/opentelemetry/semconv/incubating/faas_attributes.h new file mode 100644 index 0000000000..ed9076ec39 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/faas_attributes.h @@ -0,0 +1,232 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace faas +{ + +/** + * A boolean that is true if the serverless function is executed for the first time (aka + * cold-start). + */ +static constexpr const char *kFaasColdstart = "faas.coldstart"; + +/** + * A string containing the schedule period as Cron + * Expression. + */ +static constexpr const char *kFaasCron = "faas.cron"; + +/** + * The name of the source on which the triggering operation was performed. For example, in Cloud + * Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. + */ +static constexpr const char *kFaasDocumentCollection = "faas.document.collection"; + +/** + * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the + * name of the file, and in Cosmos DB the table name. + */ +static constexpr const char *kFaasDocumentName = "faas.document.name"; + +/** + * Describes the type of the operation that was performed on the data. + */ +static constexpr const char *kFaasDocumentOperation = "faas.document.operation"; + +/** + * A string containing the time when the data was accessed in the ISO 8601 format expressed in UTC. + */ +static constexpr const char *kFaasDocumentTime = "faas.document.time"; + +/** + * The execution environment ID as a string, that will be potentially reused for other invocations + * to the same function/function version.

+ */ +static constexpr const char *kFaasInstance = "faas.instance"; + +/** + * The invocation ID of the current function invocation. + */ +static constexpr const char *kFaasInvocationId = "faas.invocation_id"; + +/** + * The name of the invoked function. + *

+ * SHOULD be equal to the @code faas.name @endcode resource attribute of the invoked function. + */ +static constexpr const char *kFaasInvokedName = "faas.invoked_name"; + +/** + * The cloud provider of the invoked function. + *

+ * SHOULD be equal to the @code cloud.provider @endcode resource attribute of the invoked function. + */ +static constexpr const char *kFaasInvokedProvider = "faas.invoked_provider"; + +/** + * The cloud region of the invoked function. + *

+ * SHOULD be equal to the @code cloud.region @endcode resource attribute of the invoked function. + */ +static constexpr const char *kFaasInvokedRegion = "faas.invoked_region"; + +/** + * The amount of memory available to the serverless function converted to Bytes. + *

+ * It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS + * Lambda function from working correctly. On AWS Lambda, the environment variable @code + * AWS_LAMBDA_FUNCTION_MEMORY_SIZE @endcode provides this information (which must be multiplied by + * 1,048,576). + */ +static constexpr const char *kFaasMaxMemory = "faas.max_memory"; + +/** + * The name of the single function that this runtime instance executes. + *

+ * This is the name of the function as configured/deployed on the FaaS + * platform and is usually different from the name of the callback + * function (which may be stored in the + * @code code.namespace @endcode/@code + * code.function @endcode span attributes).

For some cloud providers, the above definition + * is ambiguous. The following definition of function name MUST be used for this attribute (and + * consequently the span name) for the listed cloud providers/products:

+ */ +static constexpr const char *kFaasName = "faas.name"; + +/** + * A string containing the function invocation time in the ISO 8601 format expressed in UTC. + */ +static constexpr const char *kFaasTime = "faas.time"; + +/** + * Type of the trigger which caused this function invocation. + */ +static constexpr const char *kFaasTrigger = "faas.trigger"; + +/** + * The immutable version of the function being executed. + *

+ * Depending on the cloud provider and platform, use: + *

+ *

+ */ +static constexpr const char *kFaasVersion = "faas.version"; + +namespace FaasDocumentOperationValues +{ +/** + * When a new object is created. + */ +static constexpr const char *kInsert = "insert"; + +/** + * When an object is modified. + */ +static constexpr const char *kEdit = "edit"; + +/** + * When an object is deleted. + */ +static constexpr const char *kDelete = "delete"; + +} // namespace FaasDocumentOperationValues + +namespace FaasInvokedProviderValues +{ +/** + * Alibaba Cloud + */ +static constexpr const char *kAlibabaCloud = "alibaba_cloud"; + +/** + * Amazon Web Services + */ +static constexpr const char *kAws = "aws"; + +/** + * Microsoft Azure + */ +static constexpr const char *kAzure = "azure"; + +/** + * Google Cloud Platform + */ +static constexpr const char *kGcp = "gcp"; + +/** + * Tencent Cloud + */ +static constexpr const char *kTencentCloud = "tencent_cloud"; + +} // namespace FaasInvokedProviderValues + +namespace FaasTriggerValues +{ +/** + * A response to some data source operation such as a database or filesystem read/write + */ +static constexpr const char *kDatasource = "datasource"; + +/** + * To provide an answer to an inbound HTTP request + */ +static constexpr const char *kHttp = "http"; + +/** + * A function is set to be executed when messages are sent to a messaging system + */ +static constexpr const char *kPubsub = "pubsub"; + +/** + * A function is scheduled to be executed regularly + */ +static constexpr const char *kTimer = "timer"; + +/** + * If none of the others apply + */ +static constexpr const char *kOther = "other"; + +} // namespace FaasTriggerValues + +} // namespace faas +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/faas_metrics.h b/api/include/opentelemetry/semconv/incubating/faas_metrics.h new file mode 100644 index 0000000000..fcfdfad251 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/faas_metrics.h @@ -0,0 +1,232 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace faas +{ + +/** + * Number of invocation cold starts + *

+ * counter + */ +static constexpr const char *kMetricFaasColdstarts = "metric.faas.coldstarts"; +static constexpr const char *descrMetricFaasColdstarts = "Number of invocation cold starts"; +static constexpr const char *unitMetricFaasColdstarts = "{coldstart}"; + +static nostd::unique_ptr> CreateSyncMetricFaasColdstarts( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasColdstarts, descrMetricFaasColdstarts, + unitMetricFaasColdstarts); +} + +static nostd::shared_ptr CreateAsyncMetricFaasColdstarts( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasColdstarts, descrMetricFaasColdstarts, + unitMetricFaasColdstarts); +} + +/** + * Distribution of CPU usage per invocation + *

+ * histogram + */ +static constexpr const char *kMetricFaasCpuUsage = "metric.faas.cpu_usage"; +static constexpr const char *descrMetricFaasCpuUsage = "Distribution of CPU usage per invocation"; +static constexpr const char *unitMetricFaasCpuUsage = "s"; + +static nostd::unique_ptr> CreateSyncMetricFaasCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasCpuUsage, descrMetricFaasCpuUsage, + unitMetricFaasCpuUsage); +} + +static nostd::shared_ptr CreateAsyncMetricFaasCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricFaasCpuUsage, descrMetricFaasCpuUsage, + unitMetricFaasCpuUsage); +} + +/** + * Number of invocation errors + *

+ * counter + */ +static constexpr const char *kMetricFaasErrors = "metric.faas.errors"; +static constexpr const char *descrMetricFaasErrors = "Number of invocation errors"; +static constexpr const char *unitMetricFaasErrors = "{error}"; + +static nostd::unique_ptr> CreateSyncMetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasErrors, descrMetricFaasErrors, unitMetricFaasErrors); +} + +static nostd::shared_ptr CreateAsyncMetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasErrors, descrMetricFaasErrors, + unitMetricFaasErrors); +} + +/** + * Measures the duration of the function's initialization, such as a cold start + *

+ * histogram + */ +static constexpr const char *kMetricFaasInitDuration = "metric.faas.init_duration"; +static constexpr const char *descrMetricFaasInitDuration = + "Measures the duration of the function's initialization, such as a cold start"; +static constexpr const char *unitMetricFaasInitDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricFaasInitDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasInitDuration, descrMetricFaasInitDuration, + unitMetricFaasInitDuration); +} + +static nostd::shared_ptr CreateAsyncMetricFaasInitDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricFaasInitDuration, descrMetricFaasInitDuration, + unitMetricFaasInitDuration); +} + +/** + * Number of successful invocations + *

+ * counter + */ +static constexpr const char *kMetricFaasInvocations = "metric.faas.invocations"; +static constexpr const char *descrMetricFaasInvocations = "Number of successful invocations"; +static constexpr const char *unitMetricFaasInvocations = "{invocation}"; + +static nostd::unique_ptr> CreateSyncMetricFaasInvocations( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasInvocations, descrMetricFaasInvocations, + unitMetricFaasInvocations); +} + +static nostd::shared_ptr CreateAsyncMetricFaasInvocations( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasInvocations, descrMetricFaasInvocations, + unitMetricFaasInvocations); +} + +/** + * Measures the duration of the function's logic execution + *

+ * histogram + */ +static constexpr const char *kMetricFaasInvokeDuration = "metric.faas.invoke_duration"; +static constexpr const char *descrMetricFaasInvokeDuration = + "Measures the duration of the function's logic execution"; +static constexpr const char *unitMetricFaasInvokeDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricFaasInvokeDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasInvokeDuration, descrMetricFaasInvokeDuration, + unitMetricFaasInvokeDuration); +} + +static nostd::shared_ptr CreateAsyncMetricFaasInvokeDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricFaasInvokeDuration, descrMetricFaasInvokeDuration, unitMetricFaasInvokeDuration); +} + +/** + * Distribution of max memory usage per invocation + *

+ * histogram + */ +static constexpr const char *kMetricFaasMemUsage = "metric.faas.mem_usage"; +static constexpr const char *descrMetricFaasMemUsage = + "Distribution of max memory usage per invocation"; +static constexpr const char *unitMetricFaasMemUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricFaasMemUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasMemUsage, descrMetricFaasMemUsage, + unitMetricFaasMemUsage); +} + +static nostd::shared_ptr CreateAsyncMetricFaasMemUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricFaasMemUsage, descrMetricFaasMemUsage, + unitMetricFaasMemUsage); +} + +/** + * Distribution of net I/O usage per invocation + *

+ * histogram + */ +static constexpr const char *kMetricFaasNetIo = "metric.faas.net_io"; +static constexpr const char *descrMetricFaasNetIo = "Distribution of net I/O usage per invocation"; +static constexpr const char *unitMetricFaasNetIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricFaasNetIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasNetIo, descrMetricFaasNetIo, unitMetricFaasNetIo); +} + +static nostd::shared_ptr CreateAsyncMetricFaasNetIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricFaasNetIo, descrMetricFaasNetIo, + unitMetricFaasNetIo); +} + +/** + * Number of invocation timeouts + *

+ * counter + */ +static constexpr const char *kMetricFaasTimeouts = "metric.faas.timeouts"; +static constexpr const char *descrMetricFaasTimeouts = "Number of invocation timeouts"; +static constexpr const char *unitMetricFaasTimeouts = "{timeout}"; + +static nostd::unique_ptr> CreateSyncMetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +static nostd::shared_ptr CreateAsyncMetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +} // namespace faas +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h new file mode 100644 index 0000000000..3cd8b8eb2c --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace feature_flag +{ + +/** + * The unique identifier of the feature flag. + */ +static constexpr const char *kFeatureFlagKey = "feature_flag.key"; + +/** + * The name of the service provider that performs the flag evaluation. + */ +static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name"; + +/** + * SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the + * value can be used.

A semantic identifier, commonly referred to as a variant, provides a means + * for referring to a value without including the value itself. This can + * provide additional context for understanding the meaning behind a value. + * For example, the variant @code red @endcode maybe be used for the value @code #c05543 @endcode. + *

+ * A stringified version of the value can be used in situations where a + * semantic identifier is unavailable. String representation of the value + * should be determined by the implementer. + */ +static constexpr const char *kFeatureFlagVariant = "feature_flag.variant"; + +} // namespace feature_flag +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/file_attributes.h b/api/include/opentelemetry/semconv/incubating/file_attributes.h new file mode 100644 index 0000000000..eb65a811ec --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/file_attributes.h @@ -0,0 +1,53 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace file +{ + +/** + * Directory where the file is located. It should include the drive letter, when appropriate. + */ +static constexpr const char *kFileDirectory = "file.directory"; + +/** + * File extension, excluding the leading dot. + *

+ * When the file name has multiple extensions (example.tar.gz), only the last one should be captured + * ("gz", not "tar.gz"). + */ +static constexpr const char *kFileExtension = "file.extension"; + +/** + * Name of the file including the extension, without the directory. + */ +static constexpr const char *kFileName = "file.name"; + +/** + * Full path to the file, including the file name. It should include the drive letter, when + * appropriate. + */ +static constexpr const char *kFilePath = "file.path"; + +/** + * File size in bytes. + */ +static constexpr const char *kFileSize = "file.size"; + +} // namespace file +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gcp_attributes.h b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h new file mode 100644 index 0000000000..53518251bb --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h @@ -0,0 +1,64 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace gcp +{ + +/** + * Identifies the Google Cloud service for which the official client library is intended. + *

+ * Intended to be a stable identifier for Google Cloud client libraries that is uniform across + * implementation languages. The value should be derived from the canonical service domain for the + * service; for example, 'foo.googleapis.com' should result in a value of 'foo'. + */ +static constexpr const char *kGcpClientService = "gcp.client.service"; + +/** + * The name of the Cloud Run execution being run for the + * Job, as set by the @code + * CLOUD_RUN_EXECUTION @endcode environment variable. + */ +static constexpr const char *kGcpCloudRunJobExecution = "gcp.cloud_run.job.execution"; + +/** + * The index for a task within an execution as provided by the @code + * CLOUD_RUN_TASK_INDEX @endcode environment variable. + */ +static constexpr const char *kGcpCloudRunJobTaskIndex = "gcp.cloud_run.job.task_index"; + +/** + * The hostname of a GCE instance. This is the full value of the default or custom hostname. + */ +static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostname"; + +/** + * The instance name of a GCE instance. This is the value provided by @code host.name @endcode, the + * visible name of the instance in the Cloud Console UI, and the prefix for the default hostname of + * the instance as defined by the default + * internal DNS name. + */ +static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; + +} // namespace gcp +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h new file mode 100644 index 0000000000..03f2eebc2c --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h @@ -0,0 +1,206 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace gen_ai +{ + +/** + * The full response received from the GenAI model. + *

+ * It's RECOMMENDED to format completions as JSON string matching OpenAI messages format + */ +static constexpr const char *kGenAiCompletion = "gen_ai.completion"; + +/** + * The name of the operation being performed. + *

+ * If one of the predefined values applies, but specific system uses a different name it's + * RECOMMENDED to document it in the semantic conventions for specific GenAI system and use + * system-specific name in the instrumentation. If a different name is not documented, + * instrumentation libraries SHOULD use applicable predefined value. + */ +static constexpr const char *kGenAiOperationName = "gen_ai.operation.name"; + +/** + * The full prompt sent to the GenAI model. + *

+ * It's RECOMMENDED to format prompts as JSON string matching OpenAI messages format + */ +static constexpr const char *kGenAiPrompt = "gen_ai.prompt"; + +/** + * The frequency penalty setting for the GenAI request. + */ +static constexpr const char *kGenAiRequestFrequencyPenalty = "gen_ai.request.frequency_penalty"; + +/** + * The maximum number of tokens the model generates for a request. + */ +static constexpr const char *kGenAiRequestMaxTokens = "gen_ai.request.max_tokens"; + +/** + * The name of the GenAI model a request is being made to. + */ +static constexpr const char *kGenAiRequestModel = "gen_ai.request.model"; + +/** + * The presence penalty setting for the GenAI request. + */ +static constexpr const char *kGenAiRequestPresencePenalty = "gen_ai.request.presence_penalty"; + +/** + * List of sequences that the model will use to stop generating further tokens. + */ +static constexpr const char *kGenAiRequestStopSequences = "gen_ai.request.stop_sequences"; + +/** + * The temperature setting for the GenAI request. + */ +static constexpr const char *kGenAiRequestTemperature = "gen_ai.request.temperature"; + +/** + * The top_k sampling setting for the GenAI request. + */ +static constexpr const char *kGenAiRequestTopK = "gen_ai.request.top_k"; + +/** + * The top_p sampling setting for the GenAI request. + */ +static constexpr const char *kGenAiRequestTopP = "gen_ai.request.top_p"; + +/** + * Array of reasons the model stopped generating tokens, corresponding to each generation received. + */ +static constexpr const char *kGenAiResponseFinishReasons = "gen_ai.response.finish_reasons"; + +/** + * The unique identifier for the completion. + */ +static constexpr const char *kGenAiResponseId = "gen_ai.response.id"; + +/** + * The name of the model that generated the response. + */ +static constexpr const char *kGenAiResponseModel = "gen_ai.response.model"; + +/** + * The Generative AI product as identified by the client or server instrumentation. + *

+ * The @code gen_ai.system @endcode describes a family of GenAI models with specific model + * identified by @code gen_ai.request.model @endcode and @code gen_ai.response.model @endcode + * attributes.

The actual GenAI product may differ from the one identified by the client. For + * example, when using OpenAI client libraries to communicate with Mistral, the @code gen_ai.system + * @endcode is set to @code openai @endcode based on the instrumentation's best knowledge.

For + * custom model, a custom friendly name SHOULD be used. If none of these options apply, the @code + * gen_ai.system @endcode SHOULD be set to @code _OTHER @endcode. + */ +static constexpr const char *kGenAiSystem = "gen_ai.system"; + +/** + * The type of token being counted. + */ +static constexpr const char *kGenAiTokenType = "gen_ai.token.type"; + +/** + * Deprecated, use @code gen_ai.usage.output_tokens @endcode instead. + *

+ * @deprecated + * Replaced by @code gen_ai.usage.output_tokens @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsageCompletionTokens = "gen_ai.usage.completion_tokens"; + +/** + * The number of tokens used in the GenAI input (prompt). + */ +static constexpr const char *kGenAiUsageInputTokens = "gen_ai.usage.input_tokens"; + +/** + * The number of tokens used in the GenAI response (completion). + */ +static constexpr const char *kGenAiUsageOutputTokens = "gen_ai.usage.output_tokens"; + +/** + * Deprecated, use @code gen_ai.usage.input_tokens @endcode instead. + *

+ * @deprecated + * Replaced by @code gen_ai.usage.input_tokens @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsagePromptTokens = "gen_ai.usage.prompt_tokens"; + +namespace GenAiOperationNameValues +{ +/** + * Chat completion operation such as OpenAI Chat API + */ +static constexpr const char *kChat = "chat"; + +/** + * Text completions operation such as OpenAI Completions API + * (Legacy) + */ +static constexpr const char *kTextCompletion = "text_completion"; + +} // namespace GenAiOperationNameValues + +namespace GenAiSystemValues +{ +/** + * OpenAI + */ +static constexpr const char *kOpenai = "openai"; + +/** + * Vertex AI + */ +static constexpr const char *kVertexAi = "vertex_ai"; + +/** + * Anthropic + */ +static constexpr const char *kAnthropic = "anthropic"; + +/** + * Cohere + */ +static constexpr const char *kCohere = "cohere"; + +} // namespace GenAiSystemValues + +namespace GenAiTokenTypeValues +{ +/** + * Input tokens (prompt, input, etc.) + */ +static constexpr const char *kInput = "input"; + +/** + * Output tokens (completion, response, etc.) + */ +static constexpr const char *kCompletion = "output"; + +} // namespace GenAiTokenTypeValues + +} // namespace gen_ai +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h b/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h new file mode 100644 index 0000000000..48db5b7351 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h @@ -0,0 +1,157 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace gen_ai +{ + +/** + * GenAI operation duration + *

+ * histogram + */ +static constexpr const char *kMetricGenAiClientOperationDuration = + "metric.gen_ai.client.operation.duration"; +static constexpr const char *descrMetricGenAiClientOperationDuration = "GenAI operation duration"; +static constexpr const char *unitMetricGenAiClientOperationDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricGenAiClientOperationDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiClientOperationDuration, + descrMetricGenAiClientOperationDuration, + unitMetricGenAiClientOperationDuration); +} + +static nostd::shared_ptr +CreateAsyncMetricGenAiClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricGenAiClientOperationDuration, + descrMetricGenAiClientOperationDuration, + unitMetricGenAiClientOperationDuration); +} + +/** + * Measures number of input and output tokens used + *

+ * histogram + */ +static constexpr const char *kMetricGenAiClientTokenUsage = "metric.gen_ai.client.token.usage"; +static constexpr const char *descrMetricGenAiClientTokenUsage = + "Measures number of input and output tokens used"; +static constexpr const char *unitMetricGenAiClientTokenUsage = "{token}"; + +static nostd::unique_ptr> CreateSyncMetricGenAiClientTokenUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiClientTokenUsage, + descrMetricGenAiClientTokenUsage, + unitMetricGenAiClientTokenUsage); +} + +static nostd::shared_ptr CreateAsyncMetricGenAiClientTokenUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricGenAiClientTokenUsage, + descrMetricGenAiClientTokenUsage, + unitMetricGenAiClientTokenUsage); +} + +/** + * Generative AI server request duration such as time-to-last byte or last output token + *

+ * histogram + */ +static constexpr const char *kMetricGenAiServerRequestDuration = + "metric.gen_ai.server.request.duration"; +static constexpr const char *descrMetricGenAiServerRequestDuration = + "Generative AI server request duration such as time-to-last byte or last output token"; +static constexpr const char *unitMetricGenAiServerRequestDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricGenAiServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerRequestDuration, + descrMetricGenAiServerRequestDuration, + unitMetricGenAiServerRequestDuration); +} + +static nostd::shared_ptr CreateAsyncMetricGenAiServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricGenAiServerRequestDuration, + descrMetricGenAiServerRequestDuration, + unitMetricGenAiServerRequestDuration); +} + +/** + * Time per output token generated after the first token for successful responses + *

+ * histogram + */ +static constexpr const char *kMetricGenAiServerTimePerOutputToken = + "metric.gen_ai.server.time_per_output_token"; +static constexpr const char *descrMetricGenAiServerTimePerOutputToken = + "Time per output token generated after the first token for successful responses"; +static constexpr const char *unitMetricGenAiServerTimePerOutputToken = "s"; + +static nostd::unique_ptr> +CreateSyncMetricGenAiServerTimePerOutputToken(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerTimePerOutputToken, + descrMetricGenAiServerTimePerOutputToken, + unitMetricGenAiServerTimePerOutputToken); +} + +static nostd::shared_ptr +CreateAsyncMetricGenAiServerTimePerOutputToken(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricGenAiServerTimePerOutputToken, + descrMetricGenAiServerTimePerOutputToken, + unitMetricGenAiServerTimePerOutputToken); +} + +/** + * Time to generate first token for successful responses + *

+ * histogram + */ +static constexpr const char *kMetricGenAiServerTimeToFirstToken = + "metric.gen_ai.server.time_to_first_token"; +static constexpr const char *descrMetricGenAiServerTimeToFirstToken = + "Time to generate first token for successful responses"; +static constexpr const char *unitMetricGenAiServerTimeToFirstToken = "s"; + +static nostd::unique_ptr> CreateSyncMetricGenAiServerTimeToFirstToken( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerTimeToFirstToken, + descrMetricGenAiServerTimeToFirstToken, + unitMetricGenAiServerTimeToFirstToken); +} + +static nostd::shared_ptr +CreateAsyncMetricGenAiServerTimeToFirstToken(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricGenAiServerTimeToFirstToken, + descrMetricGenAiServerTimeToFirstToken, + unitMetricGenAiServerTimeToFirstToken); +} + +} // namespace gen_ai +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/graphql_attributes.h b/api/include/opentelemetry/semconv/incubating/graphql_attributes.h new file mode 100644 index 0000000000..fe899d1c69 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/graphql_attributes.h @@ -0,0 +1,60 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace graphql +{ + +/** + * The GraphQL document being executed. + *

+ * The value may be sanitized to exclude sensitive information. + */ +static constexpr const char *kGraphqlDocument = "graphql.document"; + +/** + * The name of the operation being executed. + */ +static constexpr const char *kGraphqlOperationName = "graphql.operation.name"; + +/** + * The type of the operation being executed. + */ +static constexpr const char *kGraphqlOperationType = "graphql.operation.type"; + +namespace GraphqlOperationTypeValues +{ +/** + * GraphQL query + */ +static constexpr const char *kQuery = "query"; + +/** + * GraphQL mutation + */ +static constexpr const char *kMutation = "mutation"; + +/** + * GraphQL subscription + */ +static constexpr const char *kSubscription = "subscription"; + +} // namespace GraphqlOperationTypeValues + +} // namespace graphql +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/heroku_attributes.h b/api/include/opentelemetry/semconv/incubating/heroku_attributes.h new file mode 100644 index 0000000000..a16bd33161 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/heroku_attributes.h @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace heroku +{ + +/** + * Unique identifier for the application + */ +static constexpr const char *kHerokuAppId = "heroku.app.id"; + +/** + * Commit hash for the current release + */ +static constexpr const char *kHerokuReleaseCommit = "heroku.release.commit"; + +/** + * Time and date the release was created + */ +static constexpr const char *kHerokuReleaseCreationTimestamp = "heroku.release.creation_timestamp"; + +} // namespace heroku +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/host_attributes.h b/api/include/opentelemetry/semconv/incubating/host_attributes.h new file mode 100644 index 0000000000..e608bd5d46 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/host_attributes.h @@ -0,0 +1,159 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace host +{ + +/** + * The CPU architecture the host system is running on. + */ +static constexpr const char *kHostArch = "host.arch"; + +/** + * The amount of level 2 memory cache available to the processor (in Bytes). + */ +static constexpr const char *kHostCpuCacheL2Size = "host.cpu.cache.l2.size"; + +/** + * Family or generation of the CPU. + */ +static constexpr const char *kHostCpuFamily = "host.cpu.family"; + +/** + * Model identifier. It provides more granular information about the CPU, distinguishing it from + * other CPUs within the same family. + */ +static constexpr const char *kHostCpuModelId = "host.cpu.model.id"; + +/** + * Model designation of the processor. + */ +static constexpr const char *kHostCpuModelName = "host.cpu.model.name"; + +/** + * Stepping or core revisions. + */ +static constexpr const char *kHostCpuStepping = "host.cpu.stepping"; + +/** + * Processor manufacturer identifier. A maximum 12-character string. + *

+ * CPUID command returns the vendor ID string in EBX, EDX + * and ECX registers. Writing these to memory in this order results in a 12-character string. + */ +static constexpr const char *kHostCpuVendorId = "host.cpu.vendor.id"; + +/** + * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For + * non-containerized systems, this should be the @code machine-id @endcode. See the table below for + * the sources to use to determine the @code machine-id @endcode based on operating system. + */ +static constexpr const char *kHostId = "host.id"; + +/** + * VM image ID or host OS image ID. For Cloud, this value is from the provider. + */ +static constexpr const char *kHostImageId = "host.image.id"; + +/** + * Name of the VM image or OS install the host was instantiated from. + */ +static constexpr const char *kHostImageName = "host.image.name"; + +/** + * The version string of the VM image or host OS as defined in Version Attributes. + */ +static constexpr const char *kHostImageVersion = "host.image.version"; + +/** + * Available IP addresses of the host, excluding loopback interfaces. + *

+ * IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be specified in the + * RFC 5952 format. + */ +static constexpr const char *kHostIp = "host.ip"; + +/** + * Available MAC addresses of the host, excluding loopback interfaces. + *

+ * MAC Addresses MUST be represented in IEEE RA + * hexadecimal form: as hyphen-separated octets in uppercase hexadecimal form from most to least + * significant. + */ +static constexpr const char *kHostMac = "host.mac"; + +/** + * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully + * qualified hostname, or another name specified by the user. + */ +static constexpr const char *kHostName = "host.name"; + +/** + * Type of host. For Cloud, this must be the machine type. + */ +static constexpr const char *kHostType = "host.type"; + +namespace HostArchValues +{ +/** + * AMD64 + */ +static constexpr const char *kAmd64 = "amd64"; + +/** + * ARM32 + */ +static constexpr const char *kArm32 = "arm32"; + +/** + * ARM64 + */ +static constexpr const char *kArm64 = "arm64"; + +/** + * Itanium + */ +static constexpr const char *kIa64 = "ia64"; + +/** + * 32-bit PowerPC + */ +static constexpr const char *kPpc32 = "ppc32"; + +/** + * 64-bit PowerPC + */ +static constexpr const char *kPpc64 = "ppc64"; + +/** + * IBM z/Architecture + */ +static constexpr const char *kS390x = "s390x"; + +/** + * 32-bit x86 + */ +static constexpr const char *kX86 = "x86"; + +} // namespace HostArchValues + +} // namespace host +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/http_attributes.h b/api/include/opentelemetry/semconv/incubating/http_attributes.h new file mode 100644 index 0000000000..3e06e4e925 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/http_attributes.h @@ -0,0 +1,365 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace http +{ + +/** + * Deprecated, use @code client.address @endcode instead. + *

+ * @deprecated + * Replaced by @code client.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpClientIp = "http.client_ip"; + +/** + * State of the HTTP connection in the HTTP connection pool. + */ +static constexpr const char *kHttpConnectionState = "http.connection.state"; + +/** + * Deprecated, use @code network.protocol.name @endcode instead. + *

+ * @deprecated + * Replaced by @code network.protocol.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpFlavor = "http.flavor"; + +/** + * Deprecated, use one of @code server.address @endcode, @code client.address @endcode or @code + * http.request.header.host @endcode instead, depending on the usage.

+ * @deprecated + * Replaced by one of @code server.address @endcode, @code client.address @endcode or @code + * http.request.header.host @endcode, depending on the usage. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpHost = "http.host"; + +/** + * Deprecated, use @code http.request.method @endcode instead. + *

+ * @deprecated + * Replaced by @code http.request.method @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpMethod = "http.method"; + +/** + * The size of the request payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size. + */ +static constexpr const char *kHttpRequestBodySize = "http.request.body.size"; + +/** + * HTTP request headers, @code @endcode being the normalized HTTP Header name (lowercase), the + * value being the header values.

Instrumentations SHOULD require an explicit configuration of + * which headers are to be captured. Including all request headers can be a security risk - explicit + * configuration helps avoid leaking sensitive information. The @code User-Agent @endcode header is + * already captured in the @code user_agent.original @endcode attribute. Users MAY explicitly + * configure instrumentations to capture them even though it is not recommended. The attribute value + * MUST consist of either multiple header values as an array of strings or a single-item array + * containing a possibly comma-concatenated string, depending on the way the HTTP library provides + * access to headers. + */ +static constexpr const char *kHttpRequestHeader = "http.request.header"; + +/** + * HTTP request method. + *

+ * HTTP request method value SHOULD be "known" to the instrumentation. + * By default, this convention defines "known" methods as the ones listed in RFC9110 and the PATCH method + * defined in RFC5789.

If the HTTP + * request method is not known to instrumentation, it MUST set the @code http.request.method + * @endcode attribute to @code _OTHER @endcode.

If the HTTP instrumentation could end up + * converting valid HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to + * override the list of known HTTP methods. If this override is done via environment variable, then + * the environment variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a + * comma-separated list of case-sensitive known HTTP methods (this list MUST be a full override of + * the default known method, it is not a list of known methods in addition to the defaults).

+ * HTTP method names are case-sensitive and @code http.request.method @endcode attribute value MUST + * match a known HTTP method name exactly. Instrumentations for specific web frameworks that + * consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. Tracing + * instrumentations that do so, MUST also set @code http.request.method_original @endcode to the + * original value. + */ +static constexpr const char *kHttpRequestMethod = "http.request.method"; + +/** + * Original HTTP method sent by the client in the request line. + */ +static constexpr const char *kHttpRequestMethodOriginal = "http.request.method_original"; + +/** + * The ordinal number of request resending attempt (for any reason, including redirects). + *

+ * The resend count SHOULD be updated each time an HTTP request gets resent by the client, + * regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 + * Server Unavailable, network issues, or any other). + */ +static constexpr const char *kHttpRequestResendCount = "http.request.resend_count"; + +/** + * The total size of the request in bytes. This should be the total number of bytes sent over the + * wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request + * body if any. + */ +static constexpr const char *kHttpRequestSize = "http.request.size"; + +/** + * Deprecated, use @code http.request.header.content-length @endcode instead. + *

+ * @deprecated + * Replaced by @code http.request.header.content-length @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpRequestContentLength = "http.request_content_length"; + +/** + * Deprecated, use @code http.request.body.size @endcode instead. + *

+ * @deprecated + * Replaced by @code http.request.body.size @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpRequestContentLengthUncompressed = + "http.request_content_length_uncompressed"; + +/** + * The size of the response payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size. + */ +static constexpr const char *kHttpResponseBodySize = "http.response.body.size"; + +/** + * HTTP response headers, @code @endcode being the normalized HTTP Header name (lowercase), + * the value being the header values.

Instrumentations SHOULD require an explicit configuration + * of which headers are to be captured. Including all response headers can be a security risk - + * explicit configuration helps avoid leaking sensitive information. Users MAY explicitly configure + * instrumentations to capture them even though it is not recommended. The attribute value MUST + * consist of either multiple header values as an array of strings or a single-item array containing + * a possibly comma-concatenated string, depending on the way the HTTP library provides access to + * headers. + */ +static constexpr const char *kHttpResponseHeader = "http.response.header"; + +/** + * The total size of the response in bytes. This should be the total number of bytes sent over the + * wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response + * body and trailers if any. + */ +static constexpr const char *kHttpResponseSize = "http.response.size"; + +/** + * HTTP response status code. + */ +static constexpr const char *kHttpResponseStatusCode = "http.response.status_code"; + +/** + * Deprecated, use @code http.response.header.content-length @endcode instead. + *

+ * @deprecated + * Replaced by @code http.response.header.content-length @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpResponseContentLength = "http.response_content_length"; + +/** + * Deprecated, use @code http.response.body.size @endcode instead. + *

+ * @deprecated + * Replace by @code http.response.body.size @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpResponseContentLengthUncompressed = + "http.response_content_length_uncompressed"; + +/** + * The matched route, that is, the path template in the format used by the respective server + * framework.

MUST NOT be populated when this is not supported by the HTTP server framework as + * the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD + * include the application root if + * there is one. + */ +static constexpr const char *kHttpRoute = "http.route"; + +/** + * Deprecated, use @code url.scheme @endcode instead. + *

+ * @deprecated + * Replaced by @code url.scheme @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpScheme = "http.scheme"; + +/** + * Deprecated, use @code server.address @endcode instead. + *

+ * @deprecated + * Replaced by @code server.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpServerName = "http.server_name"; + +/** + * Deprecated, use @code http.response.status_code @endcode instead. + *

+ * @deprecated + * Replaced by @code http.response.status_code @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpStatusCode = "http.status_code"; + +/** + * Deprecated, use @code url.path @endcode and @code url.query @endcode instead. + *

+ * @deprecated + * Split to @code url.path @endcode and `url.query. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpTarget = "http.target"; + +/** + * Deprecated, use @code url.full @endcode instead. + *

+ * @deprecated + * Replaced by @code url.full @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpUrl = "http.url"; + +/** + * Deprecated, use @code user_agent.original @endcode instead. + *

+ * @deprecated + * Replaced by @code user_agent.original @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpUserAgent = "http.user_agent"; + +namespace HttpConnectionStateValues +{ +/** + * active state. + */ +static constexpr const char *kActive = "active"; + +/** + * idle state. + */ +static constexpr const char *kIdle = "idle"; + +} // namespace HttpConnectionStateValues + +namespace HttpFlavorValues +{ +/** + * HTTP/1.0 + */ +static constexpr const char *kHttp10 = "1.0"; + +/** + * HTTP/1.1 + */ +static constexpr const char *kHttp11 = "1.1"; + +/** + * HTTP/2 + */ +static constexpr const char *kHttp20 = "2.0"; + +/** + * HTTP/3 + */ +static constexpr const char *kHttp30 = "3.0"; + +/** + * SPDY protocol. + */ +static constexpr const char *kSpdy = "SPDY"; + +/** + * QUIC protocol. + */ +static constexpr const char *kQuic = "QUIC"; + +} // namespace HttpFlavorValues + +namespace HttpRequestMethodValues +{ +/** + * CONNECT method. + */ +static constexpr const char *kConnect = "CONNECT"; + +/** + * DELETE method. + */ +static constexpr const char *kDelete = "DELETE"; + +/** + * GET method. + */ +static constexpr const char *kGet = "GET"; + +/** + * HEAD method. + */ +static constexpr const char *kHead = "HEAD"; + +/** + * OPTIONS method. + */ +static constexpr const char *kOptions = "OPTIONS"; + +/** + * PATCH method. + */ +static constexpr const char *kPatch = "PATCH"; + +/** + * POST method. + */ +static constexpr const char *kPost = "POST"; + +/** + * PUT method. + */ +static constexpr const char *kPut = "PUT"; + +/** + * TRACE method. + */ +static constexpr const char *kTrace = "TRACE"; + +/** + * Any HTTP method that the instrumentation has no prior knowledge of. + */ +static constexpr const char *kOther = "_OTHER"; + +} // namespace HttpRequestMethodValues + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/http_metrics.h b/api/include/opentelemetry/semconv/incubating/http_metrics.h new file mode 100644 index 0000000000..a2820feced --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/http_metrics.h @@ -0,0 +1,304 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace http +{ + +/** + * Number of active HTTP requests. + *

+ * updowncounter + */ +static constexpr const char *kMetricHttpClientActiveRequests = "metric.http.client.active_requests"; +static constexpr const char *descrMetricHttpClientActiveRequests = + "Number of active HTTP requests."; +static constexpr const char *unitMetricHttpClientActiveRequests = "{request}"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientActiveRequests( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpClientActiveRequests, + descrMetricHttpClientActiveRequests, + unitMetricHttpClientActiveRequests); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientActiveRequests( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpClientActiveRequests, + descrMetricHttpClientActiveRequests, + unitMetricHttpClientActiveRequests); +} + +/** + * The duration of the successfully established outbound HTTP connections. + *

+ * histogram + */ +static constexpr const char *kMetricHttpClientConnectionDuration = + "metric.http.client.connection.duration"; +static constexpr const char *descrMetricHttpClientConnectionDuration = + "The duration of the successfully established outbound HTTP connections."; +static constexpr const char *unitMetricHttpClientConnectionDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientConnectionDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientConnectionDuration, + descrMetricHttpClientConnectionDuration, + unitMetricHttpClientConnectionDuration); +} + +static nostd::shared_ptr +CreateAsyncMetricHttpClientConnectionDuration(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpClientConnectionDuration, + descrMetricHttpClientConnectionDuration, + unitMetricHttpClientConnectionDuration); +} + +/** + * Number of outbound HTTP connections that are currently active or idle on the client. + *

+ * updowncounter + */ +static constexpr const char *kMetricHttpClientOpenConnections = + "metric.http.client.open_connections"; +static constexpr const char *descrMetricHttpClientOpenConnections = + "Number of outbound HTTP connections that are currently active or idle on the client."; +static constexpr const char *unitMetricHttpClientOpenConnections = "{connection}"; + +static nostd::unique_ptr> +CreateSyncMetricHttpClientOpenConnections(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpClientOpenConnections, + descrMetricHttpClientOpenConnections, + unitMetricHttpClientOpenConnections); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientOpenConnections( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpClientOpenConnections, + descrMetricHttpClientOpenConnections, + unitMetricHttpClientOpenConnections); +} + +/** + * Size of HTTP client request bodies. + *

+ * The size of the request payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size.

histogram + */ +static constexpr const char *kMetricHttpClientRequestBodySize = + "metric.http.client.request.body.size"; +static constexpr const char *descrMetricHttpClientRequestBodySize = + "Size of HTTP client request bodies."; +static constexpr const char *unitMetricHttpClientRequestBodySize = "By"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientRequestBodySize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestBodySize, + descrMetricHttpClientRequestBodySize, + unitMetricHttpClientRequestBodySize); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientRequestBodySize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpClientRequestBodySize, + descrMetricHttpClientRequestBodySize, + unitMetricHttpClientRequestBodySize); +} + +/** + * Duration of HTTP client requests. + *

+ * histogram + */ +static constexpr const char *kMetricHttpClientRequestDuration = + "metric.http.client.request.duration"; +static constexpr const char *descrMetricHttpClientRequestDuration = + "Duration of HTTP client requests."; +static constexpr const char *unitMetricHttpClientRequestDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +/** + * Size of HTTP client response bodies. + *

+ * The size of the response payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size.

histogram + */ +static constexpr const char *kMetricHttpClientResponseBodySize = + "metric.http.client.response.body.size"; +static constexpr const char *descrMetricHttpClientResponseBodySize = + "Size of HTTP client response bodies."; +static constexpr const char *unitMetricHttpClientResponseBodySize = "By"; + +static nostd::unique_ptr> CreateSyncMetricHttpClientResponseBodySize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientResponseBodySize, + descrMetricHttpClientResponseBodySize, + unitMetricHttpClientResponseBodySize); +} + +static nostd::shared_ptr CreateAsyncMetricHttpClientResponseBodySize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpClientResponseBodySize, + descrMetricHttpClientResponseBodySize, + unitMetricHttpClientResponseBodySize); +} + +/** + * Number of active HTTP server requests. + *

+ * updowncounter + */ +static constexpr const char *kMetricHttpServerActiveRequests = "metric.http.server.active_requests"; +static constexpr const char *descrMetricHttpServerActiveRequests = + "Number of active HTTP server requests."; +static constexpr const char *unitMetricHttpServerActiveRequests = "{request}"; + +static nostd::unique_ptr> CreateSyncMetricHttpServerActiveRequests( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpServerActiveRequests, + descrMetricHttpServerActiveRequests, + unitMetricHttpServerActiveRequests); +} + +static nostd::shared_ptr CreateAsyncMetricHttpServerActiveRequests( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpServerActiveRequests, + descrMetricHttpServerActiveRequests, + unitMetricHttpServerActiveRequests); +} + +/** + * Size of HTTP server request bodies. + *

+ * The size of the request payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size.

histogram + */ +static constexpr const char *kMetricHttpServerRequestBodySize = + "metric.http.server.request.body.size"; +static constexpr const char *descrMetricHttpServerRequestBodySize = + "Size of HTTP server request bodies."; +static constexpr const char *unitMetricHttpServerRequestBodySize = "By"; + +static nostd::unique_ptr> CreateSyncMetricHttpServerRequestBodySize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestBodySize, + descrMetricHttpServerRequestBodySize, + unitMetricHttpServerRequestBodySize); +} + +static nostd::shared_ptr CreateAsyncMetricHttpServerRequestBodySize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpServerRequestBodySize, + descrMetricHttpServerRequestBodySize, + unitMetricHttpServerRequestBodySize); +} + +/** + * Duration of HTTP server requests. + *

+ * histogram + */ +static constexpr const char *kMetricHttpServerRequestDuration = + "metric.http.server.request.duration"; +static constexpr const char *descrMetricHttpServerRequestDuration = + "Duration of HTTP server requests."; +static constexpr const char *unitMetricHttpServerRequestDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricHttpServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +static nostd::shared_ptr CreateAsyncMetricHttpServerRequestDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +/** + * Size of HTTP server response bodies. + *

+ * The size of the response payload body in bytes. This is the number of bytes transferred excluding + * headers and is often, but not always, present as the Content-Length + * header. For requests using transport encoding, this should be the compressed size.

histogram + */ +static constexpr const char *kMetricHttpServerResponseBodySize = + "metric.http.server.response.body.size"; +static constexpr const char *descrMetricHttpServerResponseBodySize = + "Size of HTTP server response bodies."; +static constexpr const char *unitMetricHttpServerResponseBodySize = "By"; + +static nostd::unique_ptr> CreateSyncMetricHttpServerResponseBodySize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerResponseBodySize, + descrMetricHttpServerResponseBodySize, + unitMetricHttpServerResponseBodySize); +} + +static nostd::shared_ptr CreateAsyncMetricHttpServerResponseBodySize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricHttpServerResponseBodySize, + descrMetricHttpServerResponseBodySize, + unitMetricHttpServerResponseBodySize); +} + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/k8s_attributes.h b/api/include/opentelemetry/semconv/incubating/k8s_attributes.h new file mode 100644 index 0000000000..2d51d057c7 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/k8s_attributes.h @@ -0,0 +1,180 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace k8s +{ + +/** + * The name of the cluster. + */ +static constexpr const char *kK8sClusterName = "k8s.cluster.name"; + +/** + * A pseudo-ID for the cluster, set to the UID of the @code kube-system @endcode namespace. + *

+ * K8s doesn't have support for obtaining a cluster ID. If this is ever + * added, we will recommend collecting the @code k8s.cluster.uid @endcode through the + * official APIs. In the meantime, we are able to use the @code uid @endcode of the + * @code kube-system @endcode namespace as a proxy for cluster ID. Read on for the + * rationale. + *

+ * Every object created in a K8s cluster is assigned a distinct UID. The + * @code kube-system @endcode namespace is used by Kubernetes itself and will exist + * for the lifetime of the cluster. Using the @code uid @endcode of the @code kube-system @endcode + * namespace is a reasonable proxy for the K8s ClusterID as it will only + * change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + * UUIDs as standardized by + * ISO/IEC 9834-8 and ITU-T + * X.667. Which states:

If generated according to one of the mechanisms defined + * in Rec. ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be different from all other + * UUIDs generated before 3603 A.D., or is extremely likely to be different (depending on the + * mechanism chosen).
+ * + *

+ * Therefore, UIDs between clusters should be extremely unlikely to + * conflict. + */ +static constexpr const char *kK8sClusterUid = "k8s.cluster.uid"; + +/** + * The name of the Container from Pod specification, must be unique within a Pod. Container runtime + * usually uses different globally unique name (@code container.name @endcode). + */ +static constexpr const char *kK8sContainerName = "k8s.container.name"; + +/** + * Number of times the container was restarted. This attribute can be used to identify a particular + * container (running or stopped) within a container spec. + */ +static constexpr const char *kK8sContainerRestartCount = "k8s.container.restart_count"; + +/** + * Last terminated reason of the Container. + */ +static constexpr const char *kK8sContainerStatusLastTerminatedReason = + "k8s.container.status.last_terminated_reason"; + +/** + * The name of the CronJob. + */ +static constexpr const char *kK8sCronjobName = "k8s.cronjob.name"; + +/** + * The UID of the CronJob. + */ +static constexpr const char *kK8sCronjobUid = "k8s.cronjob.uid"; + +/** + * The name of the DaemonSet. + */ +static constexpr const char *kK8sDaemonsetName = "k8s.daemonset.name"; + +/** + * The UID of the DaemonSet. + */ +static constexpr const char *kK8sDaemonsetUid = "k8s.daemonset.uid"; + +/** + * The name of the Deployment. + */ +static constexpr const char *kK8sDeploymentName = "k8s.deployment.name"; + +/** + * The UID of the Deployment. + */ +static constexpr const char *kK8sDeploymentUid = "k8s.deployment.uid"; + +/** + * The name of the Job. + */ +static constexpr const char *kK8sJobName = "k8s.job.name"; + +/** + * The UID of the Job. + */ +static constexpr const char *kK8sJobUid = "k8s.job.uid"; + +/** + * The name of the namespace that the pod is running in. + */ +static constexpr const char *kK8sNamespaceName = "k8s.namespace.name"; + +/** + * The name of the Node. + */ +static constexpr const char *kK8sNodeName = "k8s.node.name"; + +/** + * The UID of the Node. + */ +static constexpr const char *kK8sNodeUid = "k8s.node.uid"; + +/** + * The annotation key-value pairs placed on the Pod, the @code @endcode being the annotation + * name, the value being the annotation value. + */ +static constexpr const char *kK8sPodAnnotation = "k8s.pod.annotation"; + +/** + * The label key-value pairs placed on the Pod, the @code @endcode being the label name, the + * value being the label value. + */ +static constexpr const char *kK8sPodLabel = "k8s.pod.label"; + +/** + * Deprecated, use @code k8s.pod.label @endcode instead. + *

+ * @deprecated + * Replaced by @code k8s.pod.label @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kK8sPodLabels = "k8s.pod.labels"; + +/** + * The name of the Pod. + */ +static constexpr const char *kK8sPodName = "k8s.pod.name"; + +/** + * The UID of the Pod. + */ +static constexpr const char *kK8sPodUid = "k8s.pod.uid"; + +/** + * The name of the ReplicaSet. + */ +static constexpr const char *kK8sReplicasetName = "k8s.replicaset.name"; + +/** + * The UID of the ReplicaSet. + */ +static constexpr const char *kK8sReplicasetUid = "k8s.replicaset.uid"; + +/** + * The name of the StatefulSet. + */ +static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name"; + +/** + * The UID of the StatefulSet. + */ +static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid"; + +} // namespace k8s +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/linux_attributes.h b/api/include/opentelemetry/semconv/incubating/linux_attributes.h new file mode 100644 index 0000000000..024e2b60e6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/linux_attributes.h @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace linux +{ + +/** + * The Linux Slab memory state + */ +static constexpr const char *kLinuxMemorySlabState = "linux.memory.slab.state"; + +namespace LinuxMemorySlabStateValues +{ +/** + * none + */ +static constexpr const char *kReclaimable = "reclaimable"; + +/** + * none + */ +static constexpr const char *kUnreclaimable = "unreclaimable"; + +} // namespace LinuxMemorySlabStateValues + +} // namespace linux +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/log_attributes.h b/api/include/opentelemetry/semconv/incubating/log_attributes.h new file mode 100644 index 0000000000..6bda8a4d31 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/log_attributes.h @@ -0,0 +1,82 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace log +{ + +/** + * The basename of the file. + */ +static constexpr const char *kLogFileName = "log.file.name"; + +/** + * The basename of the file, with symlinks resolved. + */ +static constexpr const char *kLogFileNameResolved = "log.file.name_resolved"; + +/** + * The full path to the file. + */ +static constexpr const char *kLogFilePath = "log.file.path"; + +/** + * The full path to the file, with symlinks resolved. + */ +static constexpr const char *kLogFilePathResolved = "log.file.path_resolved"; + +/** + * The stream associated with the log. See below for a list of well-known values. + */ +static constexpr const char *kLogIostream = "log.iostream"; + +/** + * The complete orignal Log Record. + *

+ * This value MAY be added when processing a Log Record which was originally transmitted as a string + * or equivalent data type AND the Body field of the Log Record does not contain the same value. + * (e.g. a syslog or a log record read from a file.) + */ +static constexpr const char *kLogRecordOriginal = "log.record.original"; + +/** + * A unique identifier for the Log Record. + *

+ * If an id is provided, other log records with the same id will be considered duplicates and can be + * removed safely. This means, that two distinguishable log records MUST have different values. The + * id MAY be an Universally Unique Lexicographically Sortable + * Identifier (ULID), but other identifiers (e.g. UUID) may be used as needed. + */ +static constexpr const char *kLogRecordUid = "log.record.uid"; + +namespace LogIostreamValues +{ +/** + * Logs from stdout stream + */ +static constexpr const char *kStdout = "stdout"; + +/** + * Events from stderr stream + */ +static constexpr const char *kStderr = "stderr"; + +} // namespace LogIostreamValues + +} // namespace log +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/message_attributes.h b/api/include/opentelemetry/semconv/incubating/message_attributes.h new file mode 100644 index 0000000000..508a1e58f6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/message_attributes.h @@ -0,0 +1,74 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace message +{ + +/** + * Deprecated, use @code rpc.message.compressed_size @endcode instead. + *

+ * @deprecated + * Replaced by @code rpc.message.compressed_size @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessageCompressedSize = "message.compressed_size"; + +/** + * Deprecated, use @code rpc.message.id @endcode instead. + *

+ * @deprecated + * Replaced by @code rpc.message.id @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessageId = "message.id"; + +/** + * Deprecated, use @code rpc.message.type @endcode instead. + *

+ * @deprecated + * Replaced by @code rpc.message.type @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessageType = "message.type"; + +/** + * Deprecated, use @code rpc.message.uncompressed_size @endcode instead. + *

+ * @deprecated + * Replaced by @code rpc.message.uncompressed_size @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size"; + +namespace MessageTypeValues +{ +/** + * none + */ +static constexpr const char *kSent = "SENT"; + +/** + * none + */ +static constexpr const char *kReceived = "RECEIVED"; + +} // namespace MessageTypeValues + +} // namespace message +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/messaging_attributes.h b/api/include/opentelemetry/semconv/incubating/messaging_attributes.h new file mode 100644 index 0000000000..c5f07fe241 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/messaging_attributes.h @@ -0,0 +1,534 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace messaging +{ + +/** + * The number of messages sent, received, or processed in the scope of the batching operation. + *

+ * Instrumentations SHOULD NOT set @code messaging.batch.message_count @endcode on spans that + * operate with a single message. When a messaging client library supports both batch and + * single-message API for the same operation, instrumentations SHOULD use @code + * messaging.batch.message_count @endcode for batching APIs and SHOULD NOT use it for single-message + * APIs. + */ +static constexpr const char *kMessagingBatchMessageCount = "messaging.batch.message_count"; + +/** + * A unique identifier for the client that consumes or produces a message. + */ +static constexpr const char *kMessagingClientId = "messaging.client.id"; + +#if 0 +// Excluded attribute: +/** + * Deprecated, use @code messaging.client.id @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.id @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingClientId + = "messaging.client_id"; +#endif + +/** + * The name of the consumer group with which a consumer is associated. + *

+ * Semantic conventions for individual messaging systems SHOULD document whether @code + * messaging.consumer.group.name @endcode is applicable and what it means in the context of that + * system. + */ +static constexpr const char *kMessagingConsumerGroupName = "messaging.consumer.group.name"; + +/** + * A boolean that is true if the message destination is anonymous (could be unnamed or have + * auto-generated name). + */ +static constexpr const char *kMessagingDestinationAnonymous = "messaging.destination.anonymous"; + +/** + * The message destination name + *

+ * Destination name SHOULD uniquely identify a specific queue, topic or other entity within the + * broker. If the broker doesn't have such notion, the destination name SHOULD uniquely identify the + * broker. + */ +static constexpr const char *kMessagingDestinationName = "messaging.destination.name"; + +/** + * The identifier of the partition messages are sent to or received from, unique within the @code + * messaging.destination.name @endcode. + */ +static constexpr const char *kMessagingDestinationPartitionId = + "messaging.destination.partition.id"; + +/** + * The name of the destination subscription from which a message is consumed. + *

+ * Semantic conventions for individual messaging systems SHOULD document whether @code + * messaging.destination.subscription.name @endcode is applicable and what it means in the context + * of that system. + */ +static constexpr const char *kMessagingDestinationSubscriptionName = + "messaging.destination.subscription.name"; + +/** + * Low cardinality representation of the messaging destination name + *

+ * Destination names could be constructed from templates. An example would be a destination name + * involving a user name or product id. Although the destination name in this case is of high + * cardinality, the underlying template is of low cardinality and can be effectively used for + * grouping and aggregation. + */ +static constexpr const char *kMessagingDestinationTemplate = "messaging.destination.template"; + +/** + * A boolean that is true if the message destination is temporary and might not exist anymore after + * messages are processed. + */ +static constexpr const char *kMessagingDestinationTemporary = "messaging.destination.temporary"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * No replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishAnonymous = + "messaging.destination_publish.anonymous"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * No replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishName = + "messaging.destination_publish.name"; + +/** + * Deprecated, use @code messaging.consumer.group.name @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.consumer.group.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingEventhubsConsumerGroup = + "messaging.eventhubs.consumer.group"; + +/** + * The UTC epoch seconds at which the message has been accepted and stored in the entity. + */ +static constexpr const char *kMessagingEventhubsMessageEnqueuedTime = + "messaging.eventhubs.message.enqueued_time"; + +/** + * The ack deadline in seconds set for the modify ack deadline request. + */ +static constexpr const char *kMessagingGcpPubsubMessageAckDeadline = + "messaging.gcp_pubsub.message.ack_deadline"; + +/** + * The ack id for a given message. + */ +static constexpr const char *kMessagingGcpPubsubMessageAckId = + "messaging.gcp_pubsub.message.ack_id"; + +/** + * The delivery attempt for a given message. + */ +static constexpr const char *kMessagingGcpPubsubMessageDeliveryAttempt = + "messaging.gcp_pubsub.message.delivery_attempt"; + +/** + * The ordering key for a given message. If the attribute is not present, the message does not have + * an ordering key. + */ +static constexpr const char *kMessagingGcpPubsubMessageOrderingKey = + "messaging.gcp_pubsub.message.ordering_key"; + +/** + * Deprecated, use @code messaging.consumer.group.name @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.consumer.group.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.consumer.group"; + +/** + * Deprecated, use @code messaging.destination.partition.id @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.destination.partition.id @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaDestinationPartition = + "messaging.kafka.destination.partition"; + +/** + * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the + * same partition. They differ from @code messaging.message.id @endcode in that they're not unique. + * If the key is @code null @endcode, the attribute MUST NOT be set.

If the key type is not + * string, it's string representation has to be supplied for the attribute. If the key has no + * unambiguous, canonical string form, don't include its value. + */ +static constexpr const char *kMessagingKafkaMessageKey = "messaging.kafka.message.key"; + +/** + * Deprecated, use @code messaging.kafka.offset @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.kafka.offset @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaMessageOffset = "messaging.kafka.message.offset"; + +/** + * A boolean that is true if the message is a tombstone. + */ +static constexpr const char *kMessagingKafkaMessageTombstone = "messaging.kafka.message.tombstone"; + +/** + * The offset of a record in the corresponding Kafka partition. + */ +static constexpr const char *kMessagingKafkaOffset = "messaging.kafka.offset"; + +/** + * The size of the message body in bytes. + *

+ * This can refer to both the compressed or uncompressed body size. If both sizes are known, the + * uncompressed body size should be used. + */ +static constexpr const char *kMessagingMessageBodySize = "messaging.message.body.size"; + +/** + * The conversation ID identifying the conversation to which the message belongs, represented as a + * string. Sometimes called "Correlation ID". + */ +static constexpr const char *kMessagingMessageConversationId = "messaging.message.conversation_id"; + +/** + * The size of the message body and metadata in bytes. + *

+ * This can refer to both the compressed or uncompressed size. If both sizes are known, the + * uncompressed size should be used. + */ +static constexpr const char *kMessagingMessageEnvelopeSize = "messaging.message.envelope.size"; + +/** + * A value used by the messaging system as an identifier for the message, represented as a string. + */ +static constexpr const char *kMessagingMessageId = "messaging.message.id"; + +/** + * Deprecated, use @code messaging.operation.type @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.operation.type @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingOperation = "messaging.operation"; + +/** + * The system-specific name of the messaging operation. + */ +static constexpr const char *kMessagingOperationName = "messaging.operation.name"; + +/** + * A string identifying the type of the messaging operation. + *

+ * If a custom value is used, it MUST be of low cardinality. + */ +static constexpr const char *kMessagingOperationType = "messaging.operation.type"; + +/** + * RabbitMQ message routing key. + */ +static constexpr const char *kMessagingRabbitmqDestinationRoutingKey = + "messaging.rabbitmq.destination.routing_key"; + +/** + * RabbitMQ message delivery tag + */ +static constexpr const char *kMessagingRabbitmqMessageDeliveryTag = + "messaging.rabbitmq.message.delivery_tag"; + +/** + * Deprecated, use @code messaging.consumer.group.name @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.consumer.group.name @endcode on the consumer spans. No replacement + * for producer spans. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingRocketmqClientGroup = "messaging.rocketmq.client_group"; + +/** + * Model of message consumption. This only applies to consumer spans. + */ +static constexpr const char *kMessagingRocketmqConsumptionModel = + "messaging.rocketmq.consumption_model"; + +/** + * The delay time level for delay message, which determines the message delay time. + */ +static constexpr const char *kMessagingRocketmqMessageDelayTimeLevel = + "messaging.rocketmq.message.delay_time_level"; + +/** + * The timestamp in milliseconds that the delay message is expected to be delivered to consumer. + */ +static constexpr const char *kMessagingRocketmqMessageDeliveryTimestamp = + "messaging.rocketmq.message.delivery_timestamp"; + +/** + * It is essential for FIFO message. Messages that belong to the same message group are always + * processed one by one within the same consumer group. + */ +static constexpr const char *kMessagingRocketmqMessageGroup = "messaging.rocketmq.message.group"; + +/** + * Key(s) of message, another way to mark message besides message id. + */ +static constexpr const char *kMessagingRocketmqMessageKeys = "messaging.rocketmq.message.keys"; + +/** + * The secondary classifier of message besides topic. + */ +static constexpr const char *kMessagingRocketmqMessageTag = "messaging.rocketmq.message.tag"; + +/** + * Type of message. + */ +static constexpr const char *kMessagingRocketmqMessageType = "messaging.rocketmq.message.type"; + +/** + * Namespace of RocketMQ resources, resources in different namespaces are individual. + */ +static constexpr const char *kMessagingRocketmqNamespace = "messaging.rocketmq.namespace"; + +/** + * Deprecated, use @code messaging.servicebus.destination.subscription_name @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.servicebus.destination.subscription_name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingServicebusDestinationSubscriptionName = + "messaging.servicebus.destination.subscription_name"; + +/** + * Describes the settlement + * type. + */ +static constexpr const char *kMessagingServicebusDispositionStatus = + "messaging.servicebus.disposition_status"; + +/** + * Number of deliveries that have been attempted for this message. + */ +static constexpr const char *kMessagingServicebusMessageDeliveryCount = + "messaging.servicebus.message.delivery_count"; + +/** + * The UTC epoch seconds at which the message has been accepted and stored in the entity. + */ +static constexpr const char *kMessagingServicebusMessageEnqueuedTime = + "messaging.servicebus.message.enqueued_time"; + +/** + * The messaging system as identified by the client instrumentation. + *

+ * The actual messaging system may differ from the one known by the client. For example, when using + * Kafka client libraries to communicate with Azure Event Hubs, the @code messaging.system @endcode + * is set to @code kafka @endcode based on the instrumentation's best knowledge. + */ +static constexpr const char *kMessagingSystem = "messaging.system"; + +namespace MessagingOperationTypeValues +{ +/** + * One or more messages are provided for publishing to an intermediary. If a single message is + * published, the context of the "Publish" span can be used as the creation context and no "Create" + * span needs to be created. + */ +static constexpr const char *kPublish = "publish"; + +/** + * A message is created. "Create" spans always refer to a single message and are used to provide a + * unique creation context for messages in batch publishing scenarios. + */ +static constexpr const char *kCreate = "create"; + +/** + * One or more messages are requested by a consumer. This operation refers to pull-based scenarios, + * where consumers explicitly call methods of messaging SDKs to receive messages. + */ +static constexpr const char *kReceive = "receive"; + +/** + * One or more messages are processed by a consumer. + */ +static constexpr const char *kProcess = "process"; + +/** + * One or more messages are settled. + */ +static constexpr const char *kSettle = "settle"; + +/** + * Deprecated. Use @code process @endcode instead. + *

+ * @deprecated + * Replaced by @code process @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDeliver = "deliver"; + +} // namespace MessagingOperationTypeValues + +namespace MessagingRocketmqConsumptionModelValues +{ +/** + * Clustering consumption model + */ +static constexpr const char *kClustering = "clustering"; + +/** + * Broadcasting consumption model + */ +static constexpr const char *kBroadcasting = "broadcasting"; + +} // namespace MessagingRocketmqConsumptionModelValues + +namespace MessagingRocketmqMessageTypeValues +{ +/** + * Normal message + */ +static constexpr const char *kNormal = "normal"; + +/** + * FIFO message + */ +static constexpr const char *kFifo = "fifo"; + +/** + * Delay message + */ +static constexpr const char *kDelay = "delay"; + +/** + * Transaction message + */ +static constexpr const char *kTransaction = "transaction"; + +} // namespace MessagingRocketmqMessageTypeValues + +namespace MessagingServicebusDispositionStatusValues +{ +/** + * Message is completed + */ +static constexpr const char *kComplete = "complete"; + +/** + * Message is abandoned + */ +static constexpr const char *kAbandon = "abandon"; + +/** + * Message is sent to dead letter queue + */ +static constexpr const char *kDeadLetter = "dead_letter"; + +/** + * Message is deferred + */ +static constexpr const char *kDefer = "defer"; + +} // namespace MessagingServicebusDispositionStatusValues + +namespace MessagingSystemValues +{ +/** + * Apache ActiveMQ + */ +static constexpr const char *kActivemq = "activemq"; + +/** + * Amazon Simple Queue Service (SQS) + */ +static constexpr const char *kAwsSqs = "aws_sqs"; + +/** + * Azure Event Grid + */ +static constexpr const char *kEventgrid = "eventgrid"; + +/** + * Azure Event Hubs + */ +static constexpr const char *kEventhubs = "eventhubs"; + +/** + * Azure Service Bus + */ +static constexpr const char *kServicebus = "servicebus"; + +/** + * Google Cloud Pub/Sub + */ +static constexpr const char *kGcpPubsub = "gcp_pubsub"; + +/** + * Java Message Service + */ +static constexpr const char *kJms = "jms"; + +/** + * Apache Kafka + */ +static constexpr const char *kKafka = "kafka"; + +/** + * RabbitMQ + */ +static constexpr const char *kRabbitmq = "rabbitmq"; + +/** + * Apache RocketMQ + */ +static constexpr const char *kRocketmq = "rocketmq"; + +/** + * Apache Pulsar + */ +static constexpr const char *kPulsar = "pulsar"; + +} // namespace MessagingSystemValues + +} // namespace messaging +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/messaging_metrics.h b/api/include/opentelemetry/semconv/incubating/messaging_metrics.h new file mode 100644 index 0000000000..3e1b1fe5eb --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/messaging_metrics.h @@ -0,0 +1,289 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace messaging +{ + +/** + * Number of messages that were delivered to the application. + *

+ * Records the number of messages pulled from the broker or number of messages dispatched to the + * application in push-based scenarios. The metric SHOULD be reported once per message delivery. For + * example, if receiving and processing operations are both instrumented for a single message + * delivery, this counter is incremented when the message is received and not reported when it is + * processed.

counter + */ +static constexpr const char *kMetricMessagingClientConsumedMessages = + "metric.messaging.client.consumed.messages"; +static constexpr const char *descrMetricMessagingClientConsumedMessages = + "Number of messages that were delivered to the application."; +static constexpr const char *unitMetricMessagingClientConsumedMessages = "{message}"; + +static nostd::unique_ptr> +CreateSyncMetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingClientConsumedMessages, + descrMetricMessagingClientConsumedMessages, + unitMetricMessagingClientConsumedMessages); +} + +static nostd::shared_ptr +CreateAsyncMetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingClientConsumedMessages, + descrMetricMessagingClientConsumedMessages, + unitMetricMessagingClientConsumedMessages); +} + +/** + * Duration of messaging operation initiated by a producer or consumer client. + *

+ * This metric SHOULD NOT be used to report processing duration - processing duration is reported in + * @code messaging.process.duration @endcode metric.

histogram + */ +static constexpr const char *kMetricMessagingClientOperationDuration = + "metric.messaging.client.operation.duration"; +static constexpr const char *descrMetricMessagingClientOperationDuration = + "Duration of messaging operation initiated by a producer or consumer client."; +static constexpr const char *unitMetricMessagingClientOperationDuration = "s"; + +static nostd::unique_ptr> +CreateSyncMetricMessagingClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingClientOperationDuration, + descrMetricMessagingClientOperationDuration, + unitMetricMessagingClientOperationDuration); +} + +static nostd::shared_ptr +CreateAsyncMetricMessagingClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricMessagingClientOperationDuration, + descrMetricMessagingClientOperationDuration, + unitMetricMessagingClientOperationDuration); +} + +/** + * Number of messages producer attempted to publish to the broker. + *

+ * This metric MUST NOT count messages that were created haven't yet been attempted to be published. + *

+ * counter + */ +static constexpr const char *kMetricMessagingClientPublishedMessages = + "metric.messaging.client.published.messages"; +static constexpr const char *descrMetricMessagingClientPublishedMessages = + "Number of messages producer attempted to publish to the broker."; +static constexpr const char *unitMetricMessagingClientPublishedMessages = "{message}"; + +static nostd::unique_ptr> +CreateSyncMetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +static nostd::shared_ptr +CreateAsyncMetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +/** + * Duration of processing operation. + *

+ * This metric MUST be reported for operations with @code messaging.operation.type @endcode that + * matches @code process @endcode.

histogram + */ +static constexpr const char *kMetricMessagingProcessDuration = "metric.messaging.process.duration"; +static constexpr const char *descrMetricMessagingProcessDuration = + "Duration of processing operation."; +static constexpr const char *unitMetricMessagingProcessDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricMessagingProcessDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingProcessDuration, + descrMetricMessagingProcessDuration, + unitMetricMessagingProcessDuration); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingProcessDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricMessagingProcessDuration, + descrMetricMessagingProcessDuration, + unitMetricMessagingProcessDuration); +} + +/** + * Deprecated. Use @code messaging.client.consumed.messages @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.consumed.messages @endcode. + *

+ * counter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingProcessMessages = "metric.messaging.process.messages"; +static constexpr const char *descrMetricMessagingProcessMessages = + "Deprecated. Use `messaging.client.consumed.messages` instead."; +static constexpr const char *unitMetricMessagingProcessMessages = "{message}"; + +static nostd::unique_ptr> CreateSyncMetricMessagingProcessMessages( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingProcessMessages, + descrMetricMessagingProcessMessages, + unitMetricMessagingProcessMessages); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingProcessMessages( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingProcessMessages, + descrMetricMessagingProcessMessages, + unitMetricMessagingProcessMessages); +} + +/** + * Deprecated. Use @code messaging.client.operation.duration @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.operation.duration @endcode. + *

+ * histogram + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingPublishDuration = "metric.messaging.publish.duration"; +static constexpr const char *descrMetricMessagingPublishDuration = + "Deprecated. Use `messaging.client.operation.duration` instead."; +static constexpr const char *unitMetricMessagingPublishDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricMessagingPublishDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingPublishDuration, + descrMetricMessagingPublishDuration, + unitMetricMessagingPublishDuration); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingPublishDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricMessagingPublishDuration, + descrMetricMessagingPublishDuration, + unitMetricMessagingPublishDuration); +} + +/** + * Deprecated. Use @code messaging.client.produced.messages @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.produced.messages @endcode. + *

+ * counter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingPublishMessages = "metric.messaging.publish.messages"; +static constexpr const char *descrMetricMessagingPublishMessages = + "Deprecated. Use `messaging.client.produced.messages` instead."; +static constexpr const char *unitMetricMessagingPublishMessages = "{message}"; + +static nostd::unique_ptr> CreateSyncMetricMessagingPublishMessages( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingPublishMessages, + descrMetricMessagingPublishMessages, + unitMetricMessagingPublishMessages); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingPublishMessages( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingPublishMessages, + descrMetricMessagingPublishMessages, + unitMetricMessagingPublishMessages); +} + +/** + * Deprecated. Use @code messaging.client.operation.duration @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.operation.duration @endcode. + *

+ * histogram + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingReceiveDuration = "metric.messaging.receive.duration"; +static constexpr const char *descrMetricMessagingReceiveDuration = + "Deprecated. Use `messaging.client.operation.duration` instead."; +static constexpr const char *unitMetricMessagingReceiveDuration = "s"; + +static nostd::unique_ptr> CreateSyncMetricMessagingReceiveDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingReceiveDuration, + descrMetricMessagingReceiveDuration, + unitMetricMessagingReceiveDuration); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingReceiveDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricMessagingReceiveDuration, + descrMetricMessagingReceiveDuration, + unitMetricMessagingReceiveDuration); +} + +/** + * Deprecated. Use @code messaging.client.consumed.messages @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.client.consumed.messages @endcode. + *

+ * counter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingReceiveMessages = "metric.messaging.receive.messages"; +static constexpr const char *descrMetricMessagingReceiveMessages = + "Deprecated. Use `messaging.client.consumed.messages` instead."; +static constexpr const char *unitMetricMessagingReceiveMessages = "{message}"; + +static nostd::unique_ptr> CreateSyncMetricMessagingReceiveMessages( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +static nostd::shared_ptr CreateAsyncMetricMessagingReceiveMessages( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +} // namespace messaging +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/net_attributes.h b/api/include/opentelemetry/semconv/incubating/net_attributes.h new file mode 100644 index 0000000000..9562299223 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/net_attributes.h @@ -0,0 +1,209 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace net +{ + +/** + * Deprecated, use @code network.local.address @endcode. + *

+ * @deprecated + * Replaced by @code network.local.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetHostIp = "net.host.ip"; + +/** + * Deprecated, use @code server.address @endcode. + *

+ * @deprecated + * Replaced by @code server.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetHostName = "net.host.name"; + +/** + * Deprecated, use @code server.port @endcode. + *

+ * @deprecated + * Replaced by @code server.port @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetHostPort = "net.host.port"; + +/** + * Deprecated, use @code network.peer.address @endcode. + *

+ * @deprecated + * Replaced by @code network.peer.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetPeerIp = "net.peer.ip"; + +/** + * Deprecated, use @code server.address @endcode on client spans and @code client.address @endcode + * on server spans.

+ * @deprecated + * Replaced by @code server.address @endcode on client spans and @code client.address @endcode on + * server spans. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetPeerName = "net.peer.name"; + +/** + * Deprecated, use @code server.port @endcode on client spans and @code client.port @endcode on + * server spans.

+ * @deprecated + * Replaced by @code server.port @endcode on client spans and @code client.port @endcode on server + * spans. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetPeerPort = "net.peer.port"; + +/** + * Deprecated, use @code network.protocol.name @endcode. + *

+ * @deprecated + * Replaced by @code network.protocol.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetProtocolName = "net.protocol.name"; + +/** + * Deprecated, use @code network.protocol.version @endcode. + *

+ * @deprecated + * Replaced by @code network.protocol.version @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetProtocolVersion = "net.protocol.version"; + +/** + * Deprecated, use @code network.transport @endcode and @code network.type @endcode. + *

+ * @deprecated + * Split to @code network.transport @endcode and @code network.type @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockFamily = "net.sock.family"; + +/** + * Deprecated, use @code network.local.address @endcode. + *

+ * @deprecated + * Replaced by @code network.local.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockHostAddr = "net.sock.host.addr"; + +/** + * Deprecated, use @code network.local.port @endcode. + *

+ * @deprecated + * Replaced by @code network.local.port @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockHostPort = "net.sock.host.port"; + +/** + * Deprecated, use @code network.peer.address @endcode. + *

+ * @deprecated + * Replaced by @code network.peer.address @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerAddr = "net.sock.peer.addr"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * Removed. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerName = "net.sock.peer.name"; + +/** + * Deprecated, use @code network.peer.port @endcode. + *

+ * @deprecated + * Replaced by @code network.peer.port @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerPort = "net.sock.peer.port"; + +/** + * Deprecated, use @code network.transport @endcode. + *

+ * @deprecated + * Replaced by @code network.transport @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetTransport = "net.transport"; + +namespace NetSockFamilyValues +{ +/** + * IPv4 address + */ +static constexpr const char *kInet = "inet"; + +/** + * IPv6 address + */ +static constexpr const char *kInet6 = "inet6"; + +/** + * Unix domain socket path + */ +static constexpr const char *kUnix = "unix"; + +} // namespace NetSockFamilyValues + +namespace NetTransportValues +{ +/** + * none + */ +static constexpr const char *kIpTcp = "ip_tcp"; + +/** + * none + */ +static constexpr const char *kIpUdp = "ip_udp"; + +/** + * Named or anonymous pipe. + */ +static constexpr const char *kPipe = "pipe"; + +/** + * In-process communication. + */ +static constexpr const char *kInproc = "inproc"; + +/** + * Something else (non IP-based). + */ +static constexpr const char *kOther = "other"; + +} // namespace NetTransportValues + +} // namespace net +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/network_attributes.h b/api/include/opentelemetry/semconv/incubating/network_attributes.h new file mode 100644 index 0000000000..ea855c5735 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/network_attributes.h @@ -0,0 +1,308 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace network +{ + +/** + * The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + */ +static constexpr const char *kNetworkCarrierIcc = "network.carrier.icc"; + +/** + * The mobile carrier country code. + */ +static constexpr const char *kNetworkCarrierMcc = "network.carrier.mcc"; + +/** + * The mobile carrier network code. + */ +static constexpr const char *kNetworkCarrierMnc = "network.carrier.mnc"; + +/** + * The name of the mobile carrier. + */ +static constexpr const char *kNetworkCarrierName = "network.carrier.name"; + +/** + * This describes more details regarding the connection.type. It may be the type of cell technology + * connection, but it could be used for describing details about a wifi connection. + */ +static constexpr const char *kNetworkConnectionSubtype = "network.connection.subtype"; + +/** + * The internet connection type. + */ +static constexpr const char *kNetworkConnectionType = "network.connection.type"; + +/** + * The network IO operation direction. + */ +static constexpr const char *kNetworkIoDirection = "network.io.direction"; + +/** + * Local address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkLocalAddress = "network.local.address"; + +/** + * Local port number of the network connection. + */ +static constexpr const char *kNetworkLocalPort = "network.local.port"; + +/** + * Peer address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkPeerAddress = "network.peer.address"; + +/** + * Peer port number of the network connection. + */ +static constexpr const char *kNetworkPeerPort = "network.peer.port"; + +/** + * OSI application layer or non-OSI + * equivalent.

The value SHOULD be normalized to lowercase. + */ +static constexpr const char *kNetworkProtocolName = "network.protocol.name"; + +/** + * The actual version of the protocol used for network communication. + *

+ * If protocol version is subject to negotiation (for example using ALPN), this attribute SHOULD be set to the + * negotiated version. If the actual protocol version is not known, this attribute SHOULD NOT be + * set. + */ +static constexpr const char *kNetworkProtocolVersion = "network.protocol.version"; + +/** + * OSI transport layer or inter-process communication + * method.

The value SHOULD be normalized to lowercase.

Consider always setting the + * transport when setting a port number, since a port number is ambiguous without knowing the + * transport. For example different processes could be listening on TCP port 12345 and UDP port + * 12345. + */ +static constexpr const char *kNetworkTransport = "network.transport"; + +/** + * OSI network layer or non-OSI equivalent. + *

+ * The value SHOULD be normalized to lowercase. + */ +static constexpr const char *kNetworkType = "network.type"; + +namespace NetworkConnectionSubtypeValues +{ +/** + * GPRS + */ +static constexpr const char *kGprs = "gprs"; + +/** + * EDGE + */ +static constexpr const char *kEdge = "edge"; + +/** + * UMTS + */ +static constexpr const char *kUmts = "umts"; + +/** + * CDMA + */ +static constexpr const char *kCdma = "cdma"; + +/** + * EVDO Rel. 0 + */ +static constexpr const char *kEvdo0 = "evdo_0"; + +/** + * EVDO Rev. A + */ +static constexpr const char *kEvdoA = "evdo_a"; + +/** + * CDMA2000 1XRTT + */ +static constexpr const char *kCdma20001xrtt = "cdma2000_1xrtt"; + +/** + * HSDPA + */ +static constexpr const char *kHsdpa = "hsdpa"; + +/** + * HSUPA + */ +static constexpr const char *kHsupa = "hsupa"; + +/** + * HSPA + */ +static constexpr const char *kHspa = "hspa"; + +/** + * IDEN + */ +static constexpr const char *kIden = "iden"; + +/** + * EVDO Rev. B + */ +static constexpr const char *kEvdoB = "evdo_b"; + +/** + * LTE + */ +static constexpr const char *kLte = "lte"; + +/** + * EHRPD + */ +static constexpr const char *kEhrpd = "ehrpd"; + +/** + * HSPAP + */ +static constexpr const char *kHspap = "hspap"; + +/** + * GSM + */ +static constexpr const char *kGsm = "gsm"; + +/** + * TD-SCDMA + */ +static constexpr const char *kTdScdma = "td_scdma"; + +/** + * IWLAN + */ +static constexpr const char *kIwlan = "iwlan"; + +/** + * 5G NR (New Radio) + */ +static constexpr const char *kNr = "nr"; + +/** + * 5G NRNSA (New Radio Non-Standalone) + */ +static constexpr const char *kNrnsa = "nrnsa"; + +/** + * LTE CA + */ +static constexpr const char *kLteCa = "lte_ca"; + +} // namespace NetworkConnectionSubtypeValues + +namespace NetworkConnectionTypeValues +{ +/** + * none + */ +static constexpr const char *kWifi = "wifi"; + +/** + * none + */ +static constexpr const char *kWired = "wired"; + +/** + * none + */ +static constexpr const char *kCell = "cell"; + +/** + * none + */ +static constexpr const char *kUnavailable = "unavailable"; + +/** + * none + */ +static constexpr const char *kUnknown = "unknown"; + +} // namespace NetworkConnectionTypeValues + +namespace NetworkIoDirectionValues +{ +/** + * none + */ +static constexpr const char *kTransmit = "transmit"; + +/** + * none + */ +static constexpr const char *kReceive = "receive"; + +} // namespace NetworkIoDirectionValues + +namespace NetworkTransportValues +{ +/** + * TCP + */ +static constexpr const char *kTcp = "tcp"; + +/** + * UDP + */ +static constexpr const char *kUdp = "udp"; + +/** + * Named or anonymous pipe. + */ +static constexpr const char *kPipe = "pipe"; + +/** + * Unix domain socket + */ +static constexpr const char *kUnix = "unix"; + +/** + * QUIC + */ +static constexpr const char *kQuic = "quic"; + +} // namespace NetworkTransportValues + +namespace NetworkTypeValues +{ +/** + * IPv4 + */ +static constexpr const char *kIpv4 = "ipv4"; + +/** + * IPv6 + */ +static constexpr const char *kIpv6 = "ipv6"; + +} // namespace NetworkTypeValues + +} // namespace network +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/oci_attributes.h b/api/include/opentelemetry/semconv/incubating/oci_attributes.h new file mode 100644 index 0000000000..ade92d35c8 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/oci_attributes.h @@ -0,0 +1,36 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace oci +{ + +/** + * The digest of the OCI image manifest. For container images specifically is the digest by which + * the container image is known.

Follows OCI Image Manifest + * Specification, and specifically the Digest + * property. An example can be found in Example Image + * Manifest. + */ +static constexpr const char *kOciManifestDigest = "oci.manifest.digest"; + +} // namespace oci +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h b/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h new file mode 100644 index 0000000000..159645e76b --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h @@ -0,0 +1,45 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace opentracing +{ + +/** + * Parent-child Reference type + *

+ * The causal relationship between a child Span and a parent Span. + */ +static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; + +namespace OpentracingRefTypeValues +{ +/** + * The parent Span depends on the child Span in some capacity + */ +static constexpr const char *kChildOf = "child_of"; + +/** + * The parent Span doesn't depend in any way on the result of the child Span + */ +static constexpr const char *kFollowsFrom = "follows_from"; + +} // namespace OpentracingRefTypeValues + +} // namespace opentracing +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/os_attributes.h b/api/include/opentelemetry/semconv/incubating/os_attributes.h new file mode 100644 index 0000000000..807deaaf92 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/os_attributes.h @@ -0,0 +1,110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace os +{ + +/** + * Unique identifier for a particular build or compilation of the operating system. + */ +static constexpr const char *kOsBuildId = "os.build_id"; + +/** + * Human readable (not intended to be parsed) OS version information, like e.g. reported by @code + * ver @endcode or @code lsb_release -a @endcode commands. + */ +static constexpr const char *kOsDescription = "os.description"; + +/** + * Human readable operating system name. + */ +static constexpr const char *kOsName = "os.name"; + +/** + * The operating system type. + */ +static constexpr const char *kOsType = "os.type"; + +/** + * The version string of the operating system as defined in Version Attributes. + */ +static constexpr const char *kOsVersion = "os.version"; + +namespace OsTypeValues +{ +/** + * Microsoft Windows + */ +static constexpr const char *kWindows = "windows"; + +/** + * Linux + */ +static constexpr const char *kLinux = "linux"; + +/** + * Apple Darwin + */ +static constexpr const char *kDarwin = "darwin"; + +/** + * FreeBSD + */ +static constexpr const char *kFreebsd = "freebsd"; + +/** + * NetBSD + */ +static constexpr const char *kNetbsd = "netbsd"; + +/** + * OpenBSD + */ +static constexpr const char *kOpenbsd = "openbsd"; + +/** + * DragonFly BSD + */ +static constexpr const char *kDragonflybsd = "dragonflybsd"; + +/** + * HP-UX (Hewlett Packard Unix) + */ +static constexpr const char *kHpux = "hpux"; + +/** + * AIX (Advanced Interactive eXecutive) + */ +static constexpr const char *kAix = "aix"; + +/** + * SunOS, Oracle Solaris + */ +static constexpr const char *kSolaris = "solaris"; + +/** + * IBM z/OS + */ +static constexpr const char *kZOs = "z_os"; + +} // namespace OsTypeValues + +} // namespace os +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/otel_attributes.h b/api/include/opentelemetry/semconv/incubating/otel_attributes.h new file mode 100644 index 0000000000..241e07d1aa --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/otel_attributes.h @@ -0,0 +1,73 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace otel +{ + +/** + * @deprecated + * use the @code otel.scope.name @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kOtelLibraryName = "otel.library.name"; + +/** + * @deprecated + * use the @code otel.scope.version @endcode attribute. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kOtelLibraryVersion = "otel.library.version"; + +/** + * The name of the instrumentation scope - (@code InstrumentationScope.Name @endcode in OTLP). + */ +static constexpr const char *kOtelScopeName = "otel.scope.name"; + +/** + * The version of the instrumentation scope - (@code InstrumentationScope.Version @endcode in OTLP). + */ +static constexpr const char *kOtelScopeVersion = "otel.scope.version"; + +/** + * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. + */ +static constexpr const char *kOtelStatusCode = "otel.status_code"; + +/** + * Description of the Status if it has a value, otherwise not set. + */ +static constexpr const char *kOtelStatusDescription = "otel.status_description"; + +namespace OtelStatusCodeValues +{ +/** + * The operation has been validated by an Application developer or Operator to have completed + * successfully. + */ +static constexpr const char *kOk = "OK"; + +/** + * The operation contains an error. + */ +static constexpr const char *kError = "ERROR"; + +} // namespace OtelStatusCodeValues + +} // namespace otel +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/other_attributes.h b/api/include/opentelemetry/semconv/incubating/other_attributes.h new file mode 100644 index 0000000000..bc6d26ef16 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/other_attributes.h @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace other +{ + +/** + * Deprecated, use @code db.client.connection.state @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.state @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kState = "state"; + +namespace StateValues +{ +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kUsed = "used"; + +} // namespace StateValues + +} // namespace other +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/peer_attributes.h b/api/include/opentelemetry/semconv/incubating/peer_attributes.h new file mode 100644 index 0000000000..6215d913f5 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/peer_attributes.h @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace peer +{ + +/** + * The @code service.name @endcode of the remote + * service. SHOULD be equal to the actual @code service.name @endcode resource attribute of the + * remote service if any. + */ +static constexpr const char *kPeerService = "peer.service"; + +} // namespace peer +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/pool_attributes.h b/api/include/opentelemetry/semconv/incubating/pool_attributes.h new file mode 100644 index 0000000000..6c26b22c23 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/pool_attributes.h @@ -0,0 +1,33 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace pool +{ + +/** + * Deprecated, use @code db.client.connection.pool.name @endcode instead. + *

+ * @deprecated + * Replaced by @code db.client.connection.pool.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kPoolName = "pool.name"; + +} // namespace pool +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/process_attributes.h b/api/include/opentelemetry/semconv/incubating/process_attributes.h new file mode 100644 index 0000000000..392ef869d1 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/process_attributes.h @@ -0,0 +1,226 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace process +{ + +/** + * The command used to launch the process (i.e. the command name). On Linux based systems, can be + * set to the zeroth string in @code proc/[pid]/cmdline @endcode. On Windows, can be set to the + * first parameter extracted from @code GetCommandLineW @endcode. + */ +static constexpr const char *kProcessCommand = "process.command"; + +/** + * All the command arguments (including the command/executable itself) as received by the process. + * On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according + * to the list of null-delimited strings extracted from @code proc/[pid]/cmdline @endcode. For + * libc-based executables, this would be the full argv vector passed to @code main @endcode. + */ +static constexpr const char *kProcessCommandArgs = "process.command_args"; + +/** + * The full command used to launch the process as a single string representing the full command. On + * Windows, can be set to the result of @code GetCommandLineW @endcode. Do not set this if you have + * to assemble it just for monitoring; use @code process.command_args @endcode instead. + */ +static constexpr const char *kProcessCommandLine = "process.command_line"; + +/** + * Specifies whether the context switches for this data point were voluntary or involuntary. + */ +static constexpr const char *kProcessContextSwitchType = "process.context_switch_type"; + +/** + * Deprecated, use @code cpu.mode @endcode instead. + *

+ * @deprecated + * Replaced by @code cpu.mode @endcode + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kProcessCpuState = "process.cpu.state"; + +/** + * The date and time the process was created, in ISO 8601 format. + */ +static constexpr const char *kProcessCreationTime = "process.creation.time"; + +/** + * The name of the process executable. On Linux based systems, can be set to the @code Name @endcode + * in @code proc/[pid]/status @endcode. On Windows, can be set to the base name of @code + * GetProcessImageFileNameW @endcode. + */ +static constexpr const char *kProcessExecutableName = "process.executable.name"; + +/** + * The full path to the process executable. On Linux based systems, can be set to the target of + * @code proc/[pid]/exe @endcode. On Windows, can be set to the result of @code + * GetProcessImageFileNameW @endcode. + */ +static constexpr const char *kProcessExecutablePath = "process.executable.path"; + +/** + * The exit code of the process. + */ +static constexpr const char *kProcessExitCode = "process.exit.code"; + +/** + * The date and time the process exited, in ISO 8601 format. + */ +static constexpr const char *kProcessExitTime = "process.exit.time"; + +/** + * The PID of the process's group leader. This is also the process group ID (PGID) of the process. + */ +static constexpr const char *kProcessGroupLeaderPid = "process.group_leader.pid"; + +/** + * Whether the process is connected to an interactive shell. + */ +static constexpr const char *kProcessInteractive = "process.interactive"; + +/** + * The username of the user that owns the process. + */ +static constexpr const char *kProcessOwner = "process.owner"; + +/** + * The type of page fault for this data point. Type @code major @endcode is for major/hard page + * faults, and @code minor @endcode is for minor/soft page faults. + */ +static constexpr const char *kProcessPagingFaultType = "process.paging.fault_type"; + +/** + * Parent Process identifier (PPID). + */ +static constexpr const char *kProcessParentPid = "process.parent_pid"; + +/** + * Process identifier (PID). + */ +static constexpr const char *kProcessPid = "process.pid"; + +/** + * The real user ID (RUID) of the process. + */ +static constexpr const char *kProcessRealUserId = "process.real_user.id"; + +/** + * The username of the real user of the process. + */ +static constexpr const char *kProcessRealUserName = "process.real_user.name"; + +/** + * An additional description about the runtime of the process, for example a specific vendor + * customization of the runtime environment. + */ +static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; + +/** + * The name of the runtime of this process. + */ +static constexpr const char *kProcessRuntimeName = "process.runtime.name"; + +/** + * The version of the runtime of this process, as returned by the runtime without modification. + */ +static constexpr const char *kProcessRuntimeVersion = "process.runtime.version"; + +/** + * The saved user ID (SUID) of the process. + */ +static constexpr const char *kProcessSavedUserId = "process.saved_user.id"; + +/** + * The username of the saved user. + */ +static constexpr const char *kProcessSavedUserName = "process.saved_user.name"; + +/** + * The PID of the process's session leader. This is also the session ID (SID) of the process. + */ +static constexpr const char *kProcessSessionLeaderPid = "process.session_leader.pid"; + +/** + * The effective user ID (EUID) of the process. + */ +static constexpr const char *kProcessUserId = "process.user.id"; + +/** + * The username of the effective user of the process. + */ +static constexpr const char *kProcessUserName = "process.user.name"; + +/** + * Virtual process identifier. + *

+ * The process ID within a PID namespace. This is not necessarily unique across all processes on the + * host but it is unique within the process namespace that the process exists within. + */ +static constexpr const char *kProcessVpid = "process.vpid"; + +namespace ProcessContextSwitchTypeValues +{ +/** + * none + */ +static constexpr const char *kVoluntary = "voluntary"; + +/** + * none + */ +static constexpr const char *kInvoluntary = "involuntary"; + +} // namespace ProcessContextSwitchTypeValues + +namespace ProcessCpuStateValues +{ +/** + * none + */ +static constexpr const char *kSystem = "system"; + +/** + * none + */ +static constexpr const char *kUser = "user"; + +/** + * none + */ +static constexpr const char *kWait = "wait"; + +} // namespace ProcessCpuStateValues + +namespace ProcessPagingFaultTypeValues +{ +/** + * none + */ +static constexpr const char *kMajor = "major"; + +/** + * none + */ +static constexpr const char *kMinor = "minor"; + +} // namespace ProcessPagingFaultTypeValues + +} // namespace process +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/process_metrics.h b/api/include/opentelemetry/semconv/incubating/process_metrics.h new file mode 100644 index 0000000000..2ee736ed27 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/process_metrics.h @@ -0,0 +1,267 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace process +{ + +/** + * Number of times the process has been context switched. + *

+ * counter + */ +static constexpr const char *kMetricProcessContextSwitches = "metric.process.context_switches"; +static constexpr const char *descrMetricProcessContextSwitches = + "Number of times the process has been context switched."; +static constexpr const char *unitMetricProcessContextSwitches = "{count}"; + +static nostd::unique_ptr> CreateSyncMetricProcessContextSwitches( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessContextSwitches, + descrMetricProcessContextSwitches, + unitMetricProcessContextSwitches); +} + +static nostd::shared_ptr CreateAsyncMetricProcessContextSwitches( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessContextSwitches, + descrMetricProcessContextSwitches, + unitMetricProcessContextSwitches); +} + +/** + * Total CPU seconds broken down by different states. + *

+ * counter + */ +static constexpr const char *kMetricProcessCpuTime = "metric.process.cpu.time"; +static constexpr const char *descrMetricProcessCpuTime = + "Total CPU seconds broken down by different states."; +static constexpr const char *unitMetricProcessCpuTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricProcessCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessCpuTime, descrMetricProcessCpuTime, + unitMetricProcessCpuTime); +} + +static nostd::shared_ptr CreateAsyncMetricProcessCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessCpuTime, descrMetricProcessCpuTime, + unitMetricProcessCpuTime); +} + +/** + * Difference in process.cpu.time since the last measurement, divided by the elapsed time and number + * of CPUs available to the process.

gauge + */ +static constexpr const char *kMetricProcessCpuUtilization = "metric.process.cpu.utilization"; +static constexpr const char *descrMetricProcessCpuUtilization = + "Difference in process.cpu.time since the last measurement, divided by the elapsed time and " + "number of CPUs available to the process."; +static constexpr const char *unitMetricProcessCpuUtilization = "1"; + +static nostd::unique_ptr> CreateSyncMetricProcessCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricProcessCpuUtilization, descrMetricProcessCpuUtilization, + unitMetricProcessCpuUtilization); +} + +static nostd::shared_ptr CreateAsyncMetricProcessCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricProcessCpuUtilization, + descrMetricProcessCpuUtilization, + unitMetricProcessCpuUtilization); +} + +/** + * Disk bytes transferred. + *

+ * counter + */ +static constexpr const char *kMetricProcessDiskIo = "metric.process.disk.io"; +static constexpr const char *descrMetricProcessDiskIo = "Disk bytes transferred."; +static constexpr const char *unitMetricProcessDiskIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessDiskIo, descrMetricProcessDiskIo, + unitMetricProcessDiskIo); +} + +static nostd::shared_ptr CreateAsyncMetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessDiskIo, descrMetricProcessDiskIo, + unitMetricProcessDiskIo); +} + +/** + * The amount of physical memory in use. + *

+ * updowncounter + */ +static constexpr const char *kMetricProcessMemoryUsage = "metric.process.memory.usage"; +static constexpr const char *descrMetricProcessMemoryUsage = + "The amount of physical memory in use."; +static constexpr const char *unitMetricProcessMemoryUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricProcessMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessMemoryUsage, descrMetricProcessMemoryUsage, + unitMetricProcessMemoryUsage); +} + +static nostd::shared_ptr CreateAsyncMetricProcessMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessMemoryUsage, descrMetricProcessMemoryUsage, unitMetricProcessMemoryUsage); +} + +/** + * The amount of committed virtual memory. + *

+ * updowncounter + */ +static constexpr const char *kMetricProcessMemoryVirtual = "metric.process.memory.virtual"; +static constexpr const char *descrMetricProcessMemoryVirtual = + "The amount of committed virtual memory."; +static constexpr const char *unitMetricProcessMemoryVirtual = "By"; + +static nostd::unique_ptr> CreateSyncMetricProcessMemoryVirtual( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricProcessMemoryVirtual, descrMetricProcessMemoryVirtual, unitMetricProcessMemoryVirtual); +} + +static nostd::shared_ptr CreateAsyncMetricProcessMemoryVirtual( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessMemoryVirtual, descrMetricProcessMemoryVirtual, unitMetricProcessMemoryVirtual); +} + +/** + * Network bytes transferred. + *

+ * counter + */ +static constexpr const char *kMetricProcessNetworkIo = "metric.process.network.io"; +static constexpr const char *descrMetricProcessNetworkIo = "Network bytes transferred."; +static constexpr const char *unitMetricProcessNetworkIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricProcessNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessNetworkIo, descrMetricProcessNetworkIo, + unitMetricProcessNetworkIo); +} + +static nostd::shared_ptr CreateAsyncMetricProcessNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessNetworkIo, descrMetricProcessNetworkIo, + unitMetricProcessNetworkIo); +} + +/** + * Number of file descriptors in use by the process. + *

+ * updowncounter + */ +static constexpr const char *kMetricProcessOpenFileDescriptorCount = + "metric.process.open_file_descriptor.count"; +static constexpr const char *descrMetricProcessOpenFileDescriptorCount = + "Number of file descriptors in use by the process."; +static constexpr const char *unitMetricProcessOpenFileDescriptorCount = "{count}"; + +static nostd::unique_ptr> +CreateSyncMetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessOpenFileDescriptorCount, + descrMetricProcessOpenFileDescriptorCount, + unitMetricProcessOpenFileDescriptorCount); +} + +static nostd::shared_ptr +CreateAsyncMetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricProcessOpenFileDescriptorCount, + descrMetricProcessOpenFileDescriptorCount, + unitMetricProcessOpenFileDescriptorCount); +} + +/** + * Number of page faults the process has made. + *

+ * counter + */ +static constexpr const char *kMetricProcessPagingFaults = "metric.process.paging.faults"; +static constexpr const char *descrMetricProcessPagingFaults = + "Number of page faults the process has made."; +static constexpr const char *unitMetricProcessPagingFaults = "{fault}"; + +static nostd::unique_ptr> CreateSyncMetricProcessPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessPagingFaults, descrMetricProcessPagingFaults, + unitMetricProcessPagingFaults); +} + +static nostd::shared_ptr CreateAsyncMetricProcessPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricProcessPagingFaults, descrMetricProcessPagingFaults, unitMetricProcessPagingFaults); +} + +/** + * Process threads count. + *

+ * updowncounter + */ +static constexpr const char *kMetricProcessThreadCount = "metric.process.thread.count"; +static constexpr const char *descrMetricProcessThreadCount = "Process threads count."; +static constexpr const char *unitMetricProcessThreadCount = "{thread}"; + +static nostd::unique_ptr> CreateSyncMetricProcessThreadCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessThreadCount, descrMetricProcessThreadCount, + unitMetricProcessThreadCount); +} + +static nostd::shared_ptr CreateAsyncMetricProcessThreadCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessThreadCount, descrMetricProcessThreadCount, unitMetricProcessThreadCount); +} + +} // namespace process +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/rpc_attributes.h b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h new file mode 100644 index 0000000000..49ba418512 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h @@ -0,0 +1,355 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace rpc +{ + +/** + * The error codes of the Connect + * request. Error codes are always string values. + */ +static constexpr const char *kRpcConnectRpcErrorCode = "rpc.connect_rpc.error_code"; + +/** + * Connect request metadata, @code @endcode being the normalized Connect Metadata key + * (lowercase), the value being the metadata values.

Instrumentations SHOULD require an explicit + * configuration of which metadata values are to be captured. Including all request metadata values + * can be a security risk - explicit configuration helps avoid leaking sensitive information. + */ +static constexpr const char *kRpcConnectRpcRequestMetadata = "rpc.connect_rpc.request.metadata"; + +/** + * Connect response metadata, @code @endcode being the normalized Connect Metadata key + * (lowercase), the value being the metadata values.

Instrumentations SHOULD require an explicit + * configuration of which metadata values are to be captured. Including all response metadata values + * can be a security risk - explicit configuration helps avoid leaking sensitive information. + */ +static constexpr const char *kRpcConnectRpcResponseMetadata = "rpc.connect_rpc.response.metadata"; + +/** + * gRPC request metadata, @code @endcode being the normalized gRPC Metadata key (lowercase), + * the value being the metadata values.

Instrumentations SHOULD require an explicit + * configuration of which metadata values are to be captured. Including all request metadata values + * can be a security risk - explicit configuration helps avoid leaking sensitive information. + */ +static constexpr const char *kRpcGrpcRequestMetadata = "rpc.grpc.request.metadata"; + +/** + * gRPC response metadata, @code @endcode being the normalized gRPC Metadata key (lowercase), + * the value being the metadata values.

Instrumentations SHOULD require an explicit + * configuration of which metadata values are to be captured. Including all response metadata values + * can be a security risk - explicit configuration helps avoid leaking sensitive information. + */ +static constexpr const char *kRpcGrpcResponseMetadata = "rpc.grpc.response.metadata"; + +/** + * The numeric status + * code of the gRPC request. + */ +static constexpr const char *kRpcGrpcStatusCode = "rpc.grpc.status_code"; + +/** + * @code error.code @endcode property of response if it is an error response. + */ +static constexpr const char *kRpcJsonrpcErrorCode = "rpc.jsonrpc.error_code"; + +/** + * @code error.message @endcode property of response if it is an error response. + */ +static constexpr const char *kRpcJsonrpcErrorMessage = "rpc.jsonrpc.error_message"; + +/** + * @code id @endcode property of request or response. Since protocol allows id to be int, string, + * @code null @endcode or missing (for notifications), value is expected to be cast to string for + * simplicity. Use empty string in case of @code null @endcode value. Omit entirely if this is a + * notification. + */ +static constexpr const char *kRpcJsonrpcRequestId = "rpc.jsonrpc.request_id"; + +/** + * Protocol version as in @code jsonrpc @endcode property of request/response. Since JSON-RPC 1.0 + * doesn't specify this, the value can be omitted. + */ +static constexpr const char *kRpcJsonrpcVersion = "rpc.jsonrpc.version"; + +/** + * Compressed size of the message in bytes. + */ +static constexpr const char *kRpcMessageCompressedSize = "rpc.message.compressed_size"; + +/** + * MUST be calculated as two different counters starting from @code 1 @endcode one for sent messages + * and one for received message.

This way we guarantee that the values will be consistent + * between different implementations. + */ +static constexpr const char *kRpcMessageId = "rpc.message.id"; + +/** + * Whether this is a received or sent message. + */ +static constexpr const char *kRpcMessageType = "rpc.message.type"; + +/** + * Uncompressed size of the message in bytes. + */ +static constexpr const char *kRpcMessageUncompressedSize = "rpc.message.uncompressed_size"; + +/** + * The name of the (logical) method being called, must be equal to the $method part in the span + * name.

This is the logical name of the method from the RPC interface perspective, which can be + * different from the name of any implementing method/function. The @code code.function @endcode + * attribute may be used to store the latter (e.g., method actually executing the call on the server + * side, RPC client stub method on the client side). + */ +static constexpr const char *kRpcMethod = "rpc.method"; + +/** + * The full (logical) name of the service being called, including its package name, if applicable. + *

+ * This is the logical name of the service from the RPC interface perspective, which can be + * different from the name of any implementing class. The @code code.namespace @endcode attribute + * may be used to store the latter (despite the attribute name, it may include a class name; e.g., + * class with method actually executing the call on the server side, RPC client stub class on the + * client side). + */ +static constexpr const char *kRpcService = "rpc.service"; + +/** + * A string identifying the remoting system. See below for a list of well-known identifiers. + */ +static constexpr const char *kRpcSystem = "rpc.system"; + +namespace RpcConnectRpcErrorCodeValues +{ +/** + * none + */ +static constexpr const char *kCancelled = "cancelled"; + +/** + * none + */ +static constexpr const char *kUnknown = "unknown"; + +/** + * none + */ +static constexpr const char *kInvalidArgument = "invalid_argument"; + +/** + * none + */ +static constexpr const char *kDeadlineExceeded = "deadline_exceeded"; + +/** + * none + */ +static constexpr const char *kNotFound = "not_found"; + +/** + * none + */ +static constexpr const char *kAlreadyExists = "already_exists"; + +/** + * none + */ +static constexpr const char *kPermissionDenied = "permission_denied"; + +/** + * none + */ +static constexpr const char *kResourceExhausted = "resource_exhausted"; + +/** + * none + */ +static constexpr const char *kFailedPrecondition = "failed_precondition"; + +/** + * none + */ +static constexpr const char *kAborted = "aborted"; + +/** + * none + */ +static constexpr const char *kOutOfRange = "out_of_range"; + +/** + * none + */ +static constexpr const char *kUnimplemented = "unimplemented"; + +/** + * none + */ +static constexpr const char *kInternal = "internal"; + +/** + * none + */ +static constexpr const char *kUnavailable = "unavailable"; + +/** + * none + */ +static constexpr const char *kDataLoss = "data_loss"; + +/** + * none + */ +static constexpr const char *kUnauthenticated = "unauthenticated"; + +} // namespace RpcConnectRpcErrorCodeValues + +namespace RpcGrpcStatusCodeValues +{ +/** + * OK + */ +static constexpr int kOk = 0; + +/** + * CANCELLED + */ +static constexpr int kCancelled = 1; + +/** + * UNKNOWN + */ +static constexpr int kUnknown = 2; + +/** + * INVALID_ARGUMENT + */ +static constexpr int kInvalidArgument = 3; + +/** + * DEADLINE_EXCEEDED + */ +static constexpr int kDeadlineExceeded = 4; + +/** + * NOT_FOUND + */ +static constexpr int kNotFound = 5; + +/** + * ALREADY_EXISTS + */ +static constexpr int kAlreadyExists = 6; + +/** + * PERMISSION_DENIED + */ +static constexpr int kPermissionDenied = 7; + +/** + * RESOURCE_EXHAUSTED + */ +static constexpr int kResourceExhausted = 8; + +/** + * FAILED_PRECONDITION + */ +static constexpr int kFailedPrecondition = 9; + +/** + * ABORTED + */ +static constexpr int kAborted = 10; + +/** + * OUT_OF_RANGE + */ +static constexpr int kOutOfRange = 11; + +/** + * UNIMPLEMENTED + */ +static constexpr int kUnimplemented = 12; + +/** + * INTERNAL + */ +static constexpr int kInternal = 13; + +/** + * UNAVAILABLE + */ +static constexpr int kUnavailable = 14; + +/** + * DATA_LOSS + */ +static constexpr int kDataLoss = 15; + +/** + * UNAUTHENTICATED + */ +static constexpr int kUnauthenticated = 16; + +} // namespace RpcGrpcStatusCodeValues + +namespace RpcMessageTypeValues +{ +/** + * none + */ +static constexpr const char *kSent = "SENT"; + +/** + * none + */ +static constexpr const char *kReceived = "RECEIVED"; + +} // namespace RpcMessageTypeValues + +namespace RpcSystemValues +{ +/** + * gRPC + */ +static constexpr const char *kGrpc = "grpc"; + +/** + * Java RMI + */ +static constexpr const char *kJavaRmi = "java_rmi"; + +/** + * .NET WCF + */ +static constexpr const char *kDotnetWcf = "dotnet_wcf"; + +/** + * Apache Dubbo + */ +static constexpr const char *kApacheDubbo = "apache_dubbo"; + +/** + * Connect RPC + */ +static constexpr const char *kConnectRpc = "connect_rpc"; + +} // namespace RpcSystemValues + +} // namespace rpc +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/rpc_metrics.h b/api/include/opentelemetry/semconv/incubating/rpc_metrics.h new file mode 100644 index 0000000000..0fb503694e --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/rpc_metrics.h @@ -0,0 +1,311 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace rpc +{ + +/** + * Measures the duration of outbound RPC. + *

+ * While streaming RPCs may record this metric as start-of-batch + * to end-of-batch, it's hard to interpret in practice. + *

+ * Streaming: N/A. + *

+ * histogram + */ +static constexpr const char *kMetricRpcClientDuration = "metric.rpc.client.duration"; +static constexpr const char *descrMetricRpcClientDuration = + "Measures the duration of outbound RPC."; +static constexpr const char *unitMetricRpcClientDuration = "ms"; + +static nostd::unique_ptr> CreateSyncMetricRpcClientDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientDuration, descrMetricRpcClientDuration, + unitMetricRpcClientDuration); +} + +static nostd::shared_ptr CreateAsyncMetricRpcClientDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricRpcClientDuration, descrMetricRpcClientDuration, unitMetricRpcClientDuration); +} + +/** + * Measures the size of RPC request messages (uncompressed). + *

+ * Streaming: Recorded per message in a streaming batch + *

+ * histogram + */ +static constexpr const char *kMetricRpcClientRequestSize = "metric.rpc.client.request.size"; +static constexpr const char *descrMetricRpcClientRequestSize = + "Measures the size of RPC request messages (uncompressed)."; +static constexpr const char *unitMetricRpcClientRequestSize = "By"; + +static nostd::unique_ptr> CreateSyncMetricRpcClientRequestSize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientRequestSize, descrMetricRpcClientRequestSize, + unitMetricRpcClientRequestSize); +} + +static nostd::shared_ptr CreateAsyncMetricRpcClientRequestSize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricRpcClientRequestSize, descrMetricRpcClientRequestSize, unitMetricRpcClientRequestSize); +} + +/** + * Measures the number of messages received per RPC. + *

+ * Should be 1 for all non-streaming RPCs. + *

+ * Streaming: This metric is required for server and client streaming RPCs + *

+ * histogram + */ +static constexpr const char *kMetricRpcClientRequestsPerRpc = "metric.rpc.client.requests_per_rpc"; +static constexpr const char *descrMetricRpcClientRequestsPerRpc = + "Measures the number of messages received per RPC."; +static constexpr const char *unitMetricRpcClientRequestsPerRpc = "{count}"; + +static nostd::unique_ptr> CreateSyncMetricRpcClientRequestsPerRpc( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientRequestsPerRpc, + descrMetricRpcClientRequestsPerRpc, + unitMetricRpcClientRequestsPerRpc); +} + +static nostd::shared_ptr CreateAsyncMetricRpcClientRequestsPerRpc( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcClientRequestsPerRpc, + descrMetricRpcClientRequestsPerRpc, + unitMetricRpcClientRequestsPerRpc); +} + +/** + * Measures the size of RPC response messages (uncompressed). + *

+ * Streaming: Recorded per response in a streaming batch + *

+ * histogram + */ +static constexpr const char *kMetricRpcClientResponseSize = "metric.rpc.client.response.size"; +static constexpr const char *descrMetricRpcClientResponseSize = + "Measures the size of RPC response messages (uncompressed)."; +static constexpr const char *unitMetricRpcClientResponseSize = "By"; + +static nostd::unique_ptr> CreateSyncMetricRpcClientResponseSize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientResponseSize, + descrMetricRpcClientResponseSize, + unitMetricRpcClientResponseSize); +} + +static nostd::shared_ptr CreateAsyncMetricRpcClientResponseSize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcClientResponseSize, + descrMetricRpcClientResponseSize, + unitMetricRpcClientResponseSize); +} + +/** + * Measures the number of messages sent per RPC. + *

+ * Should be 1 for all non-streaming RPCs. + *

+ * Streaming: This metric is required for server and client streaming RPCs + *

+ * histogram + */ +static constexpr const char *kMetricRpcClientResponsesPerRpc = + "metric.rpc.client.responses_per_rpc"; +static constexpr const char *descrMetricRpcClientResponsesPerRpc = + "Measures the number of messages sent per RPC."; +static constexpr const char *unitMetricRpcClientResponsesPerRpc = "{count}"; + +static nostd::unique_ptr> CreateSyncMetricRpcClientResponsesPerRpc( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientResponsesPerRpc, + descrMetricRpcClientResponsesPerRpc, + unitMetricRpcClientResponsesPerRpc); +} + +static nostd::shared_ptr CreateAsyncMetricRpcClientResponsesPerRpc( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcClientResponsesPerRpc, + descrMetricRpcClientResponsesPerRpc, + unitMetricRpcClientResponsesPerRpc); +} + +/** + * Measures the duration of inbound RPC. + *

+ * While streaming RPCs may record this metric as start-of-batch + * to end-of-batch, it's hard to interpret in practice. + *

+ * Streaming: N/A. + *

+ * histogram + */ +static constexpr const char *kMetricRpcServerDuration = "metric.rpc.server.duration"; +static constexpr const char *descrMetricRpcServerDuration = "Measures the duration of inbound RPC."; +static constexpr const char *unitMetricRpcServerDuration = "ms"; + +static nostd::unique_ptr> CreateSyncMetricRpcServerDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerDuration, descrMetricRpcServerDuration, + unitMetricRpcServerDuration); +} + +static nostd::shared_ptr CreateAsyncMetricRpcServerDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricRpcServerDuration, descrMetricRpcServerDuration, unitMetricRpcServerDuration); +} + +/** + * Measures the size of RPC request messages (uncompressed). + *

+ * Streaming: Recorded per message in a streaming batch + *

+ * histogram + */ +static constexpr const char *kMetricRpcServerRequestSize = "metric.rpc.server.request.size"; +static constexpr const char *descrMetricRpcServerRequestSize = + "Measures the size of RPC request messages (uncompressed)."; +static constexpr const char *unitMetricRpcServerRequestSize = "By"; + +static nostd::unique_ptr> CreateSyncMetricRpcServerRequestSize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerRequestSize, descrMetricRpcServerRequestSize, + unitMetricRpcServerRequestSize); +} + +static nostd::shared_ptr CreateAsyncMetricRpcServerRequestSize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram( + kMetricRpcServerRequestSize, descrMetricRpcServerRequestSize, unitMetricRpcServerRequestSize); +} + +/** + * Measures the number of messages received per RPC. + *

+ * Should be 1 for all non-streaming RPCs. + *

+ * Streaming : This metric is required for server and client streaming RPCs + *

+ * histogram + */ +static constexpr const char *kMetricRpcServerRequestsPerRpc = "metric.rpc.server.requests_per_rpc"; +static constexpr const char *descrMetricRpcServerRequestsPerRpc = + "Measures the number of messages received per RPC."; +static constexpr const char *unitMetricRpcServerRequestsPerRpc = "{count}"; + +static nostd::unique_ptr> CreateSyncMetricRpcServerRequestsPerRpc( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerRequestsPerRpc, + descrMetricRpcServerRequestsPerRpc, + unitMetricRpcServerRequestsPerRpc); +} + +static nostd::shared_ptr CreateAsyncMetricRpcServerRequestsPerRpc( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcServerRequestsPerRpc, + descrMetricRpcServerRequestsPerRpc, + unitMetricRpcServerRequestsPerRpc); +} + +/** + * Measures the size of RPC response messages (uncompressed). + *

+ * Streaming: Recorded per response in a streaming batch + *

+ * histogram + */ +static constexpr const char *kMetricRpcServerResponseSize = "metric.rpc.server.response.size"; +static constexpr const char *descrMetricRpcServerResponseSize = + "Measures the size of RPC response messages (uncompressed)."; +static constexpr const char *unitMetricRpcServerResponseSize = "By"; + +static nostd::unique_ptr> CreateSyncMetricRpcServerResponseSize( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerResponseSize, + descrMetricRpcServerResponseSize, + unitMetricRpcServerResponseSize); +} + +static nostd::shared_ptr CreateAsyncMetricRpcServerResponseSize( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcServerResponseSize, + descrMetricRpcServerResponseSize, + unitMetricRpcServerResponseSize); +} + +/** + * Measures the number of messages sent per RPC. + *

+ * Should be 1 for all non-streaming RPCs. + *

+ * Streaming: This metric is required for server and client streaming RPCs + *

+ * histogram + */ +static constexpr const char *kMetricRpcServerResponsesPerRpc = + "metric.rpc.server.responses_per_rpc"; +static constexpr const char *descrMetricRpcServerResponsesPerRpc = + "Measures the number of messages sent per RPC."; +static constexpr const char *unitMetricRpcServerResponsesPerRpc = "{count}"; + +static nostd::unique_ptr> CreateSyncMetricRpcServerResponsesPerRpc( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerResponsesPerRpc, + descrMetricRpcServerResponsesPerRpc, + unitMetricRpcServerResponsesPerRpc); +} + +static nostd::shared_ptr CreateAsyncMetricRpcServerResponsesPerRpc( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableHistogram(kMetricRpcServerResponsesPerRpc, + descrMetricRpcServerResponsesPerRpc, + unitMetricRpcServerResponsesPerRpc); +} + +} // namespace rpc +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/server_attributes.h b/api/include/opentelemetry/semconv/incubating/server_attributes.h new file mode 100644 index 0000000000..21cb75d729 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/server_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace server +{ + +/** + * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain + * socket name.

When observed from the client side, and when communicating through an + * intermediary, @code server.address @endcode SHOULD represent the server address behind any + * intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kServerAddress = "server.address"; + +/** + * Server port number. + *

+ * When observed from the client side, and when communicating through an intermediary, @code + * server.port @endcode SHOULD represent the server port behind any intermediaries, for example + * proxies, if it's available. + */ +static constexpr const char *kServerPort = "server.port"; + +} // namespace server +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/service_attributes.h b/api/include/opentelemetry/semconv/incubating/service_attributes.h new file mode 100644 index 0000000000..7582c19868 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/service_attributes.h @@ -0,0 +1,84 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace service +{ + +/** + * The string ID of the service instance. + *

+ * MUST be unique for each instance of the same @code service.namespace,service.name @endcode pair + * (in other words + * @code service.namespace,service.name,service.instance.id @endcode triplet MUST be globally + * unique). The ID helps to distinguish instances of the same service that exist at the same time + * (e.g. instances of a horizontally scaled service).

Implementations, such as SDKs, are + * recommended to generate a random Version 1 or Version 4 RFC 4122 UUID, but are free to use an inherent + * unique ID as the source of this value if stability is desirable. In that case, the ID SHOULD be + * used as source of a UUID Version 5 and SHOULD use the following UUID as the namespace: @code + * 4d63009a-8d0f-11ee-aad7-4c796ed8e320 @endcode.

UUIDs are typically recommended, as only an + * opaque value for the purposes of identifying a service instance is needed. Similar to what can be + * seen in the man page for the @code /etc/machine-id + * @endcode file, the underlying data, such as pod name and namespace should be treated as + * confidential, being the user's choice to expose it or not via another resource attribute.

For + * applications running behind an application server (like unicorn), we do not recommend using one + * identifier for all processes participating in the application. Instead, it's recommended each + * division (e.g. a worker thread in unicorn) to have its own instance.id.

It's not recommended + * for a Collector to set @code service.instance.id @endcode if it can't unambiguously determine the + * service instance that is generating that telemetry. For instance, creating an UUID based on @code + * pod.name @endcode will likely be wrong, as the Collector might not know from which container + * within that pod the telemetry originated. However, Collectors can set the @code + * service.instance.id @endcode if they can unambiguously determine the service instance for that + * telemetry. This is typically the case for scraping receivers, as they know the target address and + * port. + */ +static constexpr const char *kServiceInstanceId = "service.instance.id"; + +/** + * Logical name of the service. + *

+ * MUST be the same for all instances of horizontally scaled services. If the value was not + * specified, SDKs MUST fallback to @code unknown_service: @endcode concatenated with @code process.executable.name @endcode, e.g. @code unknown_service:bash + * @endcode. If @code process.executable.name @endcode is not available, the value MUST be set to + * @code unknown_service @endcode. + */ +static constexpr const char *kServiceName = "service.name"; + +/** + * A namespace for @code service.name @endcode. + *

+ * A string value having a meaning that helps to distinguish a group of services, for example the + * team name that owns a group of services. @code service.name @endcode is expected to be unique + * within the same namespace. If @code service.namespace @endcode is not specified in the Resource + * then @code service.name @endcode is expected to be unique for all services that have no explicit + * namespace defined (so the empty/unspecified namespace is simply one more valid namespace). + * Zero-length namespace string is assumed equal to unspecified namespace. + */ +static constexpr const char *kServiceNamespace = "service.namespace"; + +/** + * The version string of the service API or implementation. The format is not defined by these + * conventions. + */ +static constexpr const char *kServiceVersion = "service.version"; + +} // namespace service +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/session_attributes.h b/api/include/opentelemetry/semconv/incubating/session_attributes.h new file mode 100644 index 0000000000..abbe9446d6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/session_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace session +{ + +/** + * A unique id to identify a session. + */ +static constexpr const char *kSessionId = "session.id"; + +/** + * The previous @code session.id @endcode for this user, when known. + */ +static constexpr const char *kSessionPreviousId = "session.previous_id"; + +} // namespace session +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/source_attributes.h b/api/include/opentelemetry/semconv/incubating/source_attributes.h new file mode 100644 index 0000000000..06a6ddc2f6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/source_attributes.h @@ -0,0 +1,37 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace source +{ + +/** + * Source address - domain name if available without reverse DNS lookup; otherwise, IP address or + * Unix domain socket name.

When observed from the destination side, and when communicating + * through an intermediary, @code source.address @endcode SHOULD represent the source address behind + * any intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kSourceAddress = "source.address"; + +/** + * Source port number + */ +static constexpr const char *kSourcePort = "source.port"; + +} // namespace source +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/system_attributes.h b/api/include/opentelemetry/semconv/incubating/system_attributes.h new file mode 100644 index 0000000000..be7ec80186 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/system_attributes.h @@ -0,0 +1,383 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace system +{ + +/** + * The logical CPU number [0..n-1] + */ +static constexpr const char *kSystemCpuLogicalNumber = "system.cpu.logical_number"; + +/** + * Deprecated, use @code cpu.mode @endcode instead. + *

+ * @deprecated + * Replaced by @code cpu.mode @endcode + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kSystemCpuState = "system.cpu.state"; + +/** + * The device identifier + */ +static constexpr const char *kSystemDevice = "system.device"; + +/** + * The filesystem mode + */ +static constexpr const char *kSystemFilesystemMode = "system.filesystem.mode"; + +/** + * The filesystem mount path + */ +static constexpr const char *kSystemFilesystemMountpoint = "system.filesystem.mountpoint"; + +/** + * The filesystem state + */ +static constexpr const char *kSystemFilesystemState = "system.filesystem.state"; + +/** + * The filesystem type + */ +static constexpr const char *kSystemFilesystemType = "system.filesystem.type"; + +/** + * The memory state + */ +static constexpr const char *kSystemMemoryState = "system.memory.state"; + +/** + * A stateless protocol MUST NOT set this attribute + */ +static constexpr const char *kSystemNetworkState = "system.network.state"; + +/** + * The paging access direction + */ +static constexpr const char *kSystemPagingDirection = "system.paging.direction"; + +/** + * The memory paging state + */ +static constexpr const char *kSystemPagingState = "system.paging.state"; + +/** + * The memory paging type + */ +static constexpr const char *kSystemPagingType = "system.paging.type"; + +/** + * The process state, e.g., Linux Process State + * Codes + */ +static constexpr const char *kSystemProcessStatus = "system.process.status"; + +/** + * Deprecated, use @code system.process.status @endcode instead. + *

+ * @deprecated + * Replaced by @code system.process.status @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kSystemProcessesStatus = "system.processes.status"; + +namespace SystemCpuStateValues +{ +/** + * none + */ +static constexpr const char *kUser = "user"; + +/** + * none + */ +static constexpr const char *kSystem = "system"; + +/** + * none + */ +static constexpr const char *kNice = "nice"; + +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kIowait = "iowait"; + +/** + * none + */ +static constexpr const char *kInterrupt = "interrupt"; + +/** + * none + */ +static constexpr const char *kSteal = "steal"; + +} // namespace SystemCpuStateValues + +namespace SystemFilesystemStateValues +{ +/** + * none + */ +static constexpr const char *kUsed = "used"; + +/** + * none + */ +static constexpr const char *kFree = "free"; + +/** + * none + */ +static constexpr const char *kReserved = "reserved"; + +} // namespace SystemFilesystemStateValues + +namespace SystemFilesystemTypeValues +{ +/** + * none + */ +static constexpr const char *kFat32 = "fat32"; + +/** + * none + */ +static constexpr const char *kExfat = "exfat"; + +/** + * none + */ +static constexpr const char *kNtfs = "ntfs"; + +/** + * none + */ +static constexpr const char *kRefs = "refs"; + +/** + * none + */ +static constexpr const char *kHfsplus = "hfsplus"; + +/** + * none + */ +static constexpr const char *kExt4 = "ext4"; + +} // namespace SystemFilesystemTypeValues + +namespace SystemMemoryStateValues +{ +/** + * none + */ +static constexpr const char *kUsed = "used"; + +/** + * none + */ +static constexpr const char *kFree = "free"; + +/** + * none + *

+ * @deprecated + * Removed, report shared memory usage with @code metric.system.memory.shared @endcode metric + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kShared = "shared"; + +/** + * none + */ +static constexpr const char *kBuffers = "buffers"; + +/** + * none + */ +static constexpr const char *kCached = "cached"; + +} // namespace SystemMemoryStateValues + +namespace SystemNetworkStateValues +{ +/** + * none + */ +static constexpr const char *kClose = "close"; + +/** + * none + */ +static constexpr const char *kCloseWait = "close_wait"; + +/** + * none + */ +static constexpr const char *kClosing = "closing"; + +/** + * none + */ +static constexpr const char *kDelete = "delete"; + +/** + * none + */ +static constexpr const char *kEstablished = "established"; + +/** + * none + */ +static constexpr const char *kFinWait1 = "fin_wait_1"; + +/** + * none + */ +static constexpr const char *kFinWait2 = "fin_wait_2"; + +/** + * none + */ +static constexpr const char *kLastAck = "last_ack"; + +/** + * none + */ +static constexpr const char *kListen = "listen"; + +/** + * none + */ +static constexpr const char *kSynRecv = "syn_recv"; + +/** + * none + */ +static constexpr const char *kSynSent = "syn_sent"; + +/** + * none + */ +static constexpr const char *kTimeWait = "time_wait"; + +} // namespace SystemNetworkStateValues + +namespace SystemPagingDirectionValues +{ +/** + * none + */ +static constexpr const char *kIn = "in"; + +/** + * none + */ +static constexpr const char *kOut = "out"; + +} // namespace SystemPagingDirectionValues + +namespace SystemPagingStateValues +{ +/** + * none + */ +static constexpr const char *kUsed = "used"; + +/** + * none + */ +static constexpr const char *kFree = "free"; + +} // namespace SystemPagingStateValues + +namespace SystemPagingTypeValues +{ +/** + * none + */ +static constexpr const char *kMajor = "major"; + +/** + * none + */ +static constexpr const char *kMinor = "minor"; + +} // namespace SystemPagingTypeValues + +namespace SystemProcessStatusValues +{ +/** + * none + */ +static constexpr const char *kRunning = "running"; + +/** + * none + */ +static constexpr const char *kSleeping = "sleeping"; + +/** + * none + */ +static constexpr const char *kStopped = "stopped"; + +/** + * none + */ +static constexpr const char *kDefunct = "defunct"; + +} // namespace SystemProcessStatusValues + +namespace SystemProcessesStatusValues +{ +/** + * none + */ +static constexpr const char *kRunning = "running"; + +/** + * none + */ +static constexpr const char *kSleeping = "sleeping"; + +/** + * none + */ +static constexpr const char *kStopped = "stopped"; + +/** + * none + */ +static constexpr const char *kDefunct = "defunct"; + +} // namespace SystemProcessesStatusValues + +} // namespace system +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/system_metrics.h b/api/include/opentelemetry/semconv/incubating/system_metrics.h new file mode 100644 index 0000000000..c6f82d35dd --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/system_metrics.h @@ -0,0 +1,758 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace system +{ + +/** + * Reports the current frequency of the CPU in Hz + *

+ * gauge + */ +static constexpr const char *kMetricSystemCpuFrequency = "metric.system.cpu.frequency"; +static constexpr const char *descrMetricSystemCpuFrequency = + "Reports the current frequency of the CPU in Hz"; +static constexpr const char *unitMetricSystemCpuFrequency = "{Hz}"; + +static nostd::unique_ptr> CreateSyncMetricSystemCpuFrequency( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, + unitMetricSystemCpuFrequency); +} + +static nostd::shared_ptr CreateAsyncMetricSystemCpuFrequency( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, + unitMetricSystemCpuFrequency); +} + +/** + * Reports the number of logical (virtual) processor cores created by the operating system to manage + * multitasking

updowncounter + */ +static constexpr const char *kMetricSystemCpuLogicalCount = "metric.system.cpu.logical.count"; +static constexpr const char *descrMetricSystemCpuLogicalCount = + "Reports the number of logical (virtual) processor cores created by the operating system to " + "manage multitasking"; +static constexpr const char *unitMetricSystemCpuLogicalCount = "{cpu}"; + +static nostd::unique_ptr> CreateSyncMetricSystemCpuLogicalCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemCpuLogicalCount, + descrMetricSystemCpuLogicalCount, + unitMetricSystemCpuLogicalCount); +} + +static nostd::shared_ptr CreateAsyncMetricSystemCpuLogicalCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuLogicalCount, + descrMetricSystemCpuLogicalCount, + unitMetricSystemCpuLogicalCount); +} + +/** + * Reports the number of actual physical processor cores on the hardware + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemCpuPhysicalCount = "metric.system.cpu.physical.count"; +static constexpr const char *descrMetricSystemCpuPhysicalCount = + "Reports the number of actual physical processor cores on the hardware"; +static constexpr const char *unitMetricSystemCpuPhysicalCount = "{cpu}"; + +static nostd::unique_ptr> CreateSyncMetricSystemCpuPhysicalCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemCpuPhysicalCount, + descrMetricSystemCpuPhysicalCount, + unitMetricSystemCpuPhysicalCount); +} + +static nostd::shared_ptr CreateAsyncMetricSystemCpuPhysicalCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuPhysicalCount, + descrMetricSystemCpuPhysicalCount, + unitMetricSystemCpuPhysicalCount); +} + +/** + * Seconds each logical CPU spent on each mode + *

+ * counter + */ +static constexpr const char *kMetricSystemCpuTime = "metric.system.cpu.time"; +static constexpr const char *descrMetricSystemCpuTime = + "Seconds each logical CPU spent on each mode"; +static constexpr const char *unitMetricSystemCpuTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemCpuTime, descrMetricSystemCpuTime, + unitMetricSystemCpuTime); +} + +static nostd::shared_ptr CreateAsyncMetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime, + unitMetricSystemCpuTime); +} + +/** + * Difference in system.cpu.time since the last measurement, divided by the elapsed time and number + * of logical CPUs

gauge + */ +static constexpr const char *kMetricSystemCpuUtilization = "metric.system.cpu.utilization"; +static constexpr const char *descrMetricSystemCpuUtilization = + "Difference in system.cpu.time since the last measurement, divided by the elapsed time and " + "number of logical CPUs"; +static constexpr const char *unitMetricSystemCpuUtilization = "1"; + +static nostd::unique_ptr> CreateSyncMetricSystemCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, + unitMetricSystemCpuUtilization); +} + +static nostd::shared_ptr CreateAsyncMetricSystemCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, unitMetricSystemCpuUtilization); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemDiskIo = "metric.system.disk.io"; +static constexpr const char *descrMetricSystemDiskIo = ""; +static constexpr const char *unitMetricSystemDiskIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskIo, descrMetricSystemDiskIo, + unitMetricSystemDiskIo); +} + +static nostd::shared_ptr CreateAsyncMetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo, + unitMetricSystemDiskIo); +} + +/** + * Time disk spent activated + *

+ * The real elapsed time ("wall clock") used in the I/O path (time from operations running in + * parallel are not counted). Measured as:

+ * counter + */ +static constexpr const char *kMetricSystemDiskIoTime = "metric.system.disk.io_time"; +static constexpr const char *descrMetricSystemDiskIoTime = "Time disk spent activated"; +static constexpr const char *unitMetricSystemDiskIoTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricSystemDiskIoTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +static nostd::shared_ptr CreateAsyncMetricSystemDiskIoTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemDiskMerged = "metric.system.disk.merged"; +static constexpr const char *descrMetricSystemDiskMerged = ""; +static constexpr const char *unitMetricSystemDiskMerged = "{operation}"; + +static nostd::unique_ptr> CreateSyncMetricSystemDiskMerged( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged, + unitMetricSystemDiskMerged); +} + +static nostd::shared_ptr CreateAsyncMetricSystemDiskMerged( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged, + unitMetricSystemDiskMerged); +} + +/** + * Sum of the time each operation took to complete + *

+ * Because it is the sum of time each request took, parallel-issued requests each contribute to make + * the count grow. Measured as:

  • Linux: Fields 7 & 11 from procfs-diskstats
  • + *
  • Windows: "Avg. Disk sec/Read" perf counter multiplied by "Disk Reads/sec" perf counter + * (similar for Writes)
  • + *
+ * counter + */ +static constexpr const char *kMetricSystemDiskOperationTime = "metric.system.disk.operation_time"; +static constexpr const char *descrMetricSystemDiskOperationTime = + "Sum of the time each operation took to complete"; +static constexpr const char *unitMetricSystemDiskOperationTime = "s"; + +static nostd::unique_ptr> CreateSyncMetricSystemDiskOperationTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskOperationTime, + descrMetricSystemDiskOperationTime, + unitMetricSystemDiskOperationTime); +} + +static nostd::shared_ptr CreateAsyncMetricSystemDiskOperationTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskOperationTime, + descrMetricSystemDiskOperationTime, + unitMetricSystemDiskOperationTime); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemDiskOperations = "metric.system.disk.operations"; +static constexpr const char *descrMetricSystemDiskOperations = ""; +static constexpr const char *unitMetricSystemDiskOperations = "{operation}"; + +static nostd::unique_ptr> CreateSyncMetricSystemDiskOperations( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskOperations, descrMetricSystemDiskOperations, + unitMetricSystemDiskOperations); +} + +static nostd::shared_ptr CreateAsyncMetricSystemDiskOperations( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemDiskOperations, descrMetricSystemDiskOperations, unitMetricSystemDiskOperations); +} + +/** + * updowncounter + */ +static constexpr const char *kMetricSystemFilesystemUsage = "metric.system.filesystem.usage"; +static constexpr const char *descrMetricSystemFilesystemUsage = ""; +static constexpr const char *unitMetricSystemFilesystemUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemFilesystemUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +static nostd::shared_ptr CreateAsyncMetricSystemFilesystemUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemFilesystemUtilization = + "metric.system.filesystem.utilization"; +static constexpr const char *descrMetricSystemFilesystemUtilization = ""; +static constexpr const char *unitMetricSystemFilesystemUtilization = "1"; + +static nostd::unique_ptr> CreateSyncMetricSystemFilesystemUtilization( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricSystemFilesystemUtilization, + descrMetricSystemFilesystemUtilization, + unitMetricSystemFilesystemUtilization); +} + +static nostd::shared_ptr +CreateAsyncMetricSystemFilesystemUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemFilesystemUtilization, + descrMetricSystemFilesystemUtilization, + unitMetricSystemFilesystemUtilization); +} + +/** + * An estimate of how much memory is available for starting new applications, without causing + * swapping

This is an alternative to @code system.memory.usage @endcode metric with @code + * state=free @endcode. Linux starting from 3.14 exports "available" memory. It takes "free" memory + * as a baseline, and then factors in kernel-specific values. This is supposed to be more accurate + * than just "free" memory. For reference, see the calculations here. See also @code MemAvailable @endcode in /proc/meminfo.

updowncounter + */ +static constexpr const char *kMetricSystemLinuxMemoryAvailable = + "metric.system.linux.memory.available"; +static constexpr const char *descrMetricSystemLinuxMemoryAvailable = + "An estimate of how much memory is available for starting new applications, without causing " + "swapping"; +static constexpr const char *unitMetricSystemLinuxMemoryAvailable = "By"; + +static nostd::unique_ptr> +CreateSyncMetricSystemLinuxMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemoryAvailable, + descrMetricSystemLinuxMemoryAvailable, + unitMetricSystemLinuxMemoryAvailable); +} + +static nostd::shared_ptr CreateAsyncMetricSystemLinuxMemoryAvailable( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemoryAvailable, + descrMetricSystemLinuxMemoryAvailable, + unitMetricSystemLinuxMemoryAvailable); +} + +/** + * Reports the memory used by the Linux kernel for managing caches of frequently used objects. + *

+ * The sum over the @code reclaimable @endcode and @code unreclaimable @endcode state values in + * @code linux.memory.slab.usage @endcode SHOULD be equal to the total slab memory available on the + * system. Note that the total slab memory is not constant and may vary over time. See also the Slab + * allocator and @code Slab @endcode in /proc/meminfo.

updowncounter + */ +static constexpr const char *kMetricSystemLinuxMemorySlabUsage = + "metric.system.linux.memory.slab.usage"; +static constexpr const char *descrMetricSystemLinuxMemorySlabUsage = + "Reports the memory used by the Linux kernel for managing caches of frequently used objects."; +static constexpr const char *unitMetricSystemLinuxMemorySlabUsage = "By"; + +static nostd::unique_ptr> +CreateSyncMetricSystemLinuxMemorySlabUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemorySlabUsage, + descrMetricSystemLinuxMemorySlabUsage, + unitMetricSystemLinuxMemorySlabUsage); +} + +static nostd::shared_ptr CreateAsyncMetricSystemLinuxMemorySlabUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemorySlabUsage, + descrMetricSystemLinuxMemorySlabUsage, + unitMetricSystemLinuxMemorySlabUsage); +} + +/** + * Total memory available in the system. + *

+ * Its value SHOULD equal the sum of @code system.memory.state @endcode over all states. + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemMemoryLimit = "metric.system.memory.limit"; +static constexpr const char *descrMetricSystemMemoryLimit = "Total memory available in the system."; +static constexpr const char *unitMetricSystemMemoryLimit = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemMemoryLimit( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, + unitMetricSystemMemoryLimit); +} + +static nostd::shared_ptr CreateAsyncMetricSystemMemoryLimit( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, unitMetricSystemMemoryLimit); +} + +/** + * Shared memory used (mostly by tmpfs). + *

+ * Equivalent of @code shared @endcode from @code free @endcode command or + * @code Shmem @endcode from @code + * /proc/meminfo @endcode"

updowncounter + */ +static constexpr const char *kMetricSystemMemoryShared = "metric.system.memory.shared"; +static constexpr const char *descrMetricSystemMemoryShared = + "Shared memory used (mostly by tmpfs)."; +static constexpr const char *unitMetricSystemMemoryShared = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemMemoryShared( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryShared, descrMetricSystemMemoryShared, + unitMetricSystemMemoryShared); +} + +static nostd::shared_ptr CreateAsyncMetricSystemMemoryShared( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryShared, descrMetricSystemMemoryShared, unitMetricSystemMemoryShared); +} + +/** + * Reports memory in use by state. + *

+ * The sum over all @code system.memory.state @endcode values SHOULD equal the total memory + * available on the system, that is @code system.memory.limit @endcode. + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemMemoryUsage = "metric.system.memory.usage"; +static constexpr const char *descrMetricSystemMemoryUsage = "Reports memory in use by state."; +static constexpr const char *unitMetricSystemMemoryUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, + unitMetricSystemMemoryUsage); +} + +static nostd::shared_ptr CreateAsyncMetricSystemMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, unitMetricSystemMemoryUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemMemoryUtilization = "metric.system.memory.utilization"; +static constexpr const char *descrMetricSystemMemoryUtilization = ""; +static constexpr const char *unitMetricSystemMemoryUtilization = "1"; + +static nostd::unique_ptr> CreateSyncMetricSystemMemoryUtilization( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricSystemMemoryUtilization, + descrMetricSystemMemoryUtilization, + unitMetricSystemMemoryUtilization); +} + +static nostd::shared_ptr CreateAsyncMetricSystemMemoryUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemMemoryUtilization, + descrMetricSystemMemoryUtilization, + unitMetricSystemMemoryUtilization); +} + +/** + * updowncounter + */ +static constexpr const char *kMetricSystemNetworkConnections = "metric.system.network.connections"; +static constexpr const char *descrMetricSystemNetworkConnections = ""; +static constexpr const char *unitMetricSystemNetworkConnections = "{connection}"; + +static nostd::unique_ptr> CreateSyncMetricSystemNetworkConnections( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemNetworkConnections, + descrMetricSystemNetworkConnections, + unitMetricSystemNetworkConnections); +} + +static nostd::shared_ptr CreateAsyncMetricSystemNetworkConnections( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemNetworkConnections, + descrMetricSystemNetworkConnections, + unitMetricSystemNetworkConnections); +} + +/** + * Count of packets that are dropped or discarded even though there was no error + *

+ * Measured as: + *

+ *

+ * counter + */ +static constexpr const char *kMetricSystemNetworkDropped = "metric.system.network.dropped"; +static constexpr const char *descrMetricSystemNetworkDropped = + "Count of packets that are dropped or discarded even though there was no error"; +static constexpr const char *unitMetricSystemNetworkDropped = "{packet}"; + +static nostd::unique_ptr> CreateSyncMetricSystemNetworkDropped( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, + unitMetricSystemNetworkDropped); +} + +static nostd::shared_ptr CreateAsyncMetricSystemNetworkDropped( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped); +} + +/** + * Count of network errors detected + *

+ * Measured as: + *

+ *

+ * counter + */ +static constexpr const char *kMetricSystemNetworkErrors = "metric.system.network.errors"; +static constexpr const char *descrMetricSystemNetworkErrors = "Count of network errors detected"; +static constexpr const char *unitMetricSystemNetworkErrors = "{error}"; + +static nostd::unique_ptr> CreateSyncMetricSystemNetworkErrors( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, + unitMetricSystemNetworkErrors); +} + +static nostd::shared_ptr CreateAsyncMetricSystemNetworkErrors( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, unitMetricSystemNetworkErrors); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemNetworkIo = "metric.system.network.io"; +static constexpr const char *descrMetricSystemNetworkIo = ""; +static constexpr const char *unitMetricSystemNetworkIo = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo, + unitMetricSystemNetworkIo); +} + +static nostd::shared_ptr CreateAsyncMetricSystemNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo, + unitMetricSystemNetworkIo); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemNetworkPackets = "metric.system.network.packets"; +static constexpr const char *descrMetricSystemNetworkPackets = ""; +static constexpr const char *unitMetricSystemNetworkPackets = "{packet}"; + +static nostd::unique_ptr> CreateSyncMetricSystemNetworkPackets( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, + unitMetricSystemNetworkPackets); +} + +static nostd::shared_ptr CreateAsyncMetricSystemNetworkPackets( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemPagingFaults = "metric.system.paging.faults"; +static constexpr const char *descrMetricSystemPagingFaults = ""; +static constexpr const char *unitMetricSystemPagingFaults = "{fault}"; + +static nostd::unique_ptr> CreateSyncMetricSystemPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemPagingFaults, descrMetricSystemPagingFaults, + unitMetricSystemPagingFaults); +} + +static nostd::shared_ptr CreateAsyncMetricSystemPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemPagingFaults, descrMetricSystemPagingFaults, unitMetricSystemPagingFaults); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemPagingOperations = "metric.system.paging.operations"; +static constexpr const char *descrMetricSystemPagingOperations = ""; +static constexpr const char *unitMetricSystemPagingOperations = "{operation}"; + +static nostd::unique_ptr> CreateSyncMetricSystemPagingOperations( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemPagingOperations, + descrMetricSystemPagingOperations, + unitMetricSystemPagingOperations); +} + +static nostd::shared_ptr CreateAsyncMetricSystemPagingOperations( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemPagingOperations, + descrMetricSystemPagingOperations, + unitMetricSystemPagingOperations); +} + +/** + * Unix swap or windows pagefile usage + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemPagingUsage = "metric.system.paging.usage"; +static constexpr const char *descrMetricSystemPagingUsage = "Unix swap or windows pagefile usage"; +static constexpr const char *unitMetricSystemPagingUsage = "By"; + +static nostd::unique_ptr> CreateSyncMetricSystemPagingUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemPagingUsage, descrMetricSystemPagingUsage, + unitMetricSystemPagingUsage); +} + +static nostd::shared_ptr CreateAsyncMetricSystemPagingUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemPagingUsage, descrMetricSystemPagingUsage, unitMetricSystemPagingUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemPagingUtilization = "metric.system.paging.utilization"; +static constexpr const char *descrMetricSystemPagingUtilization = ""; +static constexpr const char *unitMetricSystemPagingUtilization = "1"; + +static nostd::unique_ptr> CreateSyncMetricSystemPagingUtilization( + metrics::Meter *meter) +{ + return meter->CreateUInt64Gauge(kMetricSystemPagingUtilization, + descrMetricSystemPagingUtilization, + unitMetricSystemPagingUtilization); +} + +static nostd::shared_ptr CreateAsyncMetricSystemPagingUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemPagingUtilization, + descrMetricSystemPagingUtilization, + unitMetricSystemPagingUtilization); +} + +/** + * Total number of processes in each state + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemProcessCount = "metric.system.process.count"; +static constexpr const char *descrMetricSystemProcessCount = + "Total number of processes in each state"; +static constexpr const char *unitMetricSystemProcessCount = "{process}"; + +static nostd::unique_ptr> CreateSyncMetricSystemProcessCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemProcessCount, descrMetricSystemProcessCount, + unitMetricSystemProcessCount); +} + +static nostd::shared_ptr CreateAsyncMetricSystemProcessCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemProcessCount, descrMetricSystemProcessCount, unitMetricSystemProcessCount); +} + +/** + * Total number of processes created over uptime of the host + *

+ * counter + */ +static constexpr const char *kMetricSystemProcessCreated = "metric.system.process.created"; +static constexpr const char *descrMetricSystemProcessCreated = + "Total number of processes created over uptime of the host"; +static constexpr const char *unitMetricSystemProcessCreated = "{process}"; + +static nostd::unique_ptr> CreateSyncMetricSystemProcessCreated( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemProcessCreated, descrMetricSystemProcessCreated, + unitMetricSystemProcessCreated); +} + +static nostd::shared_ptr CreateAsyncMetricSystemProcessCreated( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated); +} + +} // namespace system +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h b/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h new file mode 100644 index 0000000000..5504febaba --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h @@ -0,0 +1,125 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace telemetry +{ + +/** + * The name of the auto instrumentation agent or distribution, if used. + *

+ * Official auto instrumentation agents and distributions SHOULD set the @code telemetry.distro.name + * @endcode attribute to a string starting with @code opentelemetry- @endcode, e.g. @code + * opentelemetry-java-instrumentation @endcode. + */ +static constexpr const char *kTelemetryDistroName = "telemetry.distro.name"; + +/** + * The version string of the auto instrumentation agent or distribution, if used. + */ +static constexpr const char *kTelemetryDistroVersion = "telemetry.distro.version"; + +/** + * The language of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkLanguage = "telemetry.sdk.language"; + +/** + * The name of the telemetry SDK as defined above. + *

+ * The OpenTelemetry SDK MUST set the @code telemetry.sdk.name @endcode attribute to @code + * opentelemetry @endcode. If another SDK, like a fork or a vendor-provided implementation, is used, + * this SDK MUST set the + * @code telemetry.sdk.name @endcode attribute to the fully-qualified class or module name of this + * SDK's main entry point or another suitable identifier depending on the language. The identifier + * @code opentelemetry @endcode is reserved and MUST NOT be used in this case. All custom + * identifiers SHOULD be stable across different versions of an implementation. + */ +static constexpr const char *kTelemetrySdkName = "telemetry.sdk.name"; + +/** + * The version string of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkVersion = "telemetry.sdk.version"; + +namespace TelemetrySdkLanguageValues +{ +/** + * none + */ +static constexpr const char *kCpp = "cpp"; + +/** + * none + */ +static constexpr const char *kDotnet = "dotnet"; + +/** + * none + */ +static constexpr const char *kErlang = "erlang"; + +/** + * none + */ +static constexpr const char *kGo = "go"; + +/** + * none + */ +static constexpr const char *kJava = "java"; + +/** + * none + */ +static constexpr const char *kNodejs = "nodejs"; + +/** + * none + */ +static constexpr const char *kPhp = "php"; + +/** + * none + */ +static constexpr const char *kPython = "python"; + +/** + * none + */ +static constexpr const char *kRuby = "ruby"; + +/** + * none + */ +static constexpr const char *kRust = "rust"; + +/** + * none + */ +static constexpr const char *kSwift = "swift"; + +/** + * none + */ +static constexpr const char *kWebjs = "webjs"; + +} // namespace TelemetrySdkLanguageValues + +} // namespace telemetry +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/test_attributes.h b/api/include/opentelemetry/semconv/incubating/test_attributes.h new file mode 100644 index 0000000000..dce482055c --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/test_attributes.h @@ -0,0 +1,93 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace test +{ + +/** + * The fully qualified human readable name of the test case. + */ +static constexpr const char *kTestCaseName = "test.case.name"; + +/** + * The status of the actual test case result from test execution. + */ +static constexpr const char *kTestCaseResultStatus = "test.case.result.status"; + +/** + * The human readable name of a test suite. + */ +static constexpr const char *kTestSuiteName = "test.suite.name"; + +/** + * The status of the test suite run. + */ +static constexpr const char *kTestSuiteRunStatus = "test.suite.run.status"; + +namespace TestCaseResultStatusValues +{ +/** + * pass + */ +static constexpr const char *kPass = "pass"; + +/** + * fail + */ +static constexpr const char *kFail = "fail"; + +} // namespace TestCaseResultStatusValues + +namespace TestSuiteRunStatusValues +{ +/** + * success + */ +static constexpr const char *kSuccess = "success"; + +/** + * failure + */ +static constexpr const char *kFailure = "failure"; + +/** + * skipped + */ +static constexpr const char *kSkipped = "skipped"; + +/** + * aborted + */ +static constexpr const char *kAborted = "aborted"; + +/** + * timed_out + */ +static constexpr const char *kTimedOut = "timed_out"; + +/** + * in_progress + */ +static constexpr const char *kInProgress = "in_progress"; + +} // namespace TestSuiteRunStatusValues + +} // namespace test +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/thread_attributes.h b/api/include/opentelemetry/semconv/incubating/thread_attributes.h new file mode 100644 index 0000000000..8c053f8408 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/thread_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace thread +{ + +/** + * Current "managed" thread ID (as opposed to OS thread ID). + */ +static constexpr const char *kThreadId = "thread.id"; + +/** + * Current thread name. + */ +static constexpr const char *kThreadName = "thread.name"; + +} // namespace thread +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/tls_attributes.h b/api/include/opentelemetry/semconv/incubating/tls_attributes.h new file mode 100644 index 0000000000..5e14b6d3f0 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/tls_attributes.h @@ -0,0 +1,221 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace tls +{ + +/** + * String indicating the cipher used during the + * current connection.

The values allowed for @code tls.cipher @endcode MUST be one of the @code + * Descriptions @endcode of the registered + * TLS Cipher Suits. + */ +static constexpr const char *kTlsCipher = "tls.cipher"; + +/** + * PEM-encoded stand-alone certificate offered by the client. This is usually mutually-exclusive of + * @code client.certificate_chain @endcode since this value also exists in that list. + */ +static constexpr const char *kTlsClientCertificate = "tls.client.certificate"; + +/** + * Array of PEM-encoded certificates that make up the certificate chain offered by the client. This + * is usually mutually-exclusive of @code client.certificate @endcode since that value should be the + * first certificate in the chain. + */ +static constexpr const char *kTlsClientCertificateChain = "tls.client.certificate_chain"; + +/** + * Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the + * client. For consistency with other hash values, this value should be formatted as an uppercase + * hash. + */ +static constexpr const char *kTlsClientHashMd5 = "tls.client.hash.md5"; + +/** + * Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by + * the client. For consistency with other hash values, this value should be formatted as an + * uppercase hash. + */ +static constexpr const char *kTlsClientHashSha1 = "tls.client.hash.sha1"; + +/** + * Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by + * the client. For consistency with other hash values, this value should be formatted as an + * uppercase hash. + */ +static constexpr const char *kTlsClientHashSha256 = "tls.client.hash.sha256"; + +/** + * Distinguished name of subject of the issuer of + * the x.509 certificate presented by the client. + */ +static constexpr const char *kTlsClientIssuer = "tls.client.issuer"; + +/** + * A hash that identifies clients based on how they perform an SSL/TLS handshake. + */ +static constexpr const char *kTlsClientJa3 = "tls.client.ja3"; + +/** + * Date/Time indicating when client certificate is no longer considered valid. + */ +static constexpr const char *kTlsClientNotAfter = "tls.client.not_after"; + +/** + * Date/Time indicating when client certificate is first considered valid. + */ +static constexpr const char *kTlsClientNotBefore = "tls.client.not_before"; + +/** + * Deprecated, use @code server.address @endcode instead. + *

+ * @deprecated + * Replaced by `server.address. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kTlsClientServerName = "tls.client.server_name"; + +/** + * Distinguished name of subject of the x.509 certificate presented by the client. + */ +static constexpr const char *kTlsClientSubject = "tls.client.subject"; + +/** + * Array of ciphers offered by the client during the client hello. + */ +static constexpr const char *kTlsClientSupportedCiphers = "tls.client.supported_ciphers"; + +/** + * String indicating the curve used for the given cipher, when applicable + */ +static constexpr const char *kTlsCurve = "tls.curve"; + +/** + * Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted + * tunnel. + */ +static constexpr const char *kTlsEstablished = "tls.established"; + +/** + * String indicating the protocol being tunneled. Per the values in the IANA + * registry, this string should be lower case. + */ +static constexpr const char *kTlsNextProtocol = "tls.next_protocol"; + +/** + * Normalized lowercase protocol name parsed from original string of the negotiated SSL/TLS + * protocol version + */ +static constexpr const char *kTlsProtocolName = "tls.protocol.name"; + +/** + * Numeric part of the version parsed from the original string of the negotiated SSL/TLS + * protocol version + */ +static constexpr const char *kTlsProtocolVersion = "tls.protocol.version"; + +/** + * Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation. + */ +static constexpr const char *kTlsResumed = "tls.resumed"; + +/** + * PEM-encoded stand-alone certificate offered by the server. This is usually mutually-exclusive of + * @code server.certificate_chain @endcode since this value also exists in that list. + */ +static constexpr const char *kTlsServerCertificate = "tls.server.certificate"; + +/** + * Array of PEM-encoded certificates that make up the certificate chain offered by the server. This + * is usually mutually-exclusive of @code server.certificate @endcode since that value should be the + * first certificate in the chain. + */ +static constexpr const char *kTlsServerCertificateChain = "tls.server.certificate_chain"; + +/** + * Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the + * server. For consistency with other hash values, this value should be formatted as an uppercase + * hash. + */ +static constexpr const char *kTlsServerHashMd5 = "tls.server.hash.md5"; + +/** + * Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by + * the server. For consistency with other hash values, this value should be formatted as an + * uppercase hash. + */ +static constexpr const char *kTlsServerHashSha1 = "tls.server.hash.sha1"; + +/** + * Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by + * the server. For consistency with other hash values, this value should be formatted as an + * uppercase hash. + */ +static constexpr const char *kTlsServerHashSha256 = "tls.server.hash.sha256"; + +/** + * Distinguished name of subject of the issuer of + * the x.509 certificate presented by the client. + */ +static constexpr const char *kTlsServerIssuer = "tls.server.issuer"; + +/** + * A hash that identifies servers based on how they perform an SSL/TLS handshake. + */ +static constexpr const char *kTlsServerJa3s = "tls.server.ja3s"; + +/** + * Date/Time indicating when server certificate is no longer considered valid. + */ +static constexpr const char *kTlsServerNotAfter = "tls.server.not_after"; + +/** + * Date/Time indicating when server certificate is first considered valid. + */ +static constexpr const char *kTlsServerNotBefore = "tls.server.not_before"; + +/** + * Distinguished name of subject of the x.509 certificate presented by the server. + */ +static constexpr const char *kTlsServerSubject = "tls.server.subject"; + +namespace TlsProtocolNameValues +{ +/** + * none + */ +static constexpr const char *kSsl = "ssl"; + +/** + * none + */ +static constexpr const char *kTls = "tls"; + +} // namespace TlsProtocolNameValues + +} // namespace tls +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/url_attributes.h b/api/include/opentelemetry/semconv/incubating/url_attributes.h new file mode 100644 index 0000000000..fb3418e26a --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/url_attributes.h @@ -0,0 +1,137 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace url +{ + +/** + * Domain extracted from the @code url.full @endcode, such as "opentelemetry.io". + *

+ * In some cases a URL may refer to an IP and/or port directly, without a domain name. In this case, + * the IP address would go to the domain field. If the URL contains a literal IPv6 address enclosed by + * @code [ @endcode and @code ] @endcode, the @code [ @endcode and @code ] @endcode characters + * should also be captured in the domain field. + */ +static constexpr const char *kUrlDomain = "url.domain"; + +/** + * The file extension extracted from the @code url.full @endcode, excluding the leading dot. + *

+ * The file extension is only set if it exists, as not every url has a file extension. When the file + * name has multiple extensions @code example.tar.gz @endcode, only the last one should be captured + * @code gz @endcode, not @code tar.gz @endcode. + */ +static constexpr const char *kUrlExtension = "url.extension"; + +/** + * The URI fragment component + */ +static constexpr const char *kUrlFragment = "url.fragment"; + +/** + * Absolute URL describing a network resource according to RFC3986

For network calls, URL usually has + * @code scheme://host[:port][path][?query][#fragment] @endcode format, where the fragment is not + * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless. + * @code url.full @endcode MUST NOT contain credentials passed via URL in form of @code + * https://username:password@www.example.com/ @endcode. In such case username and password SHOULD be + * redacted and attribute's value SHOULD be @code https://REDACTED:REDACTED@www.example.com/ + * @endcode. + * @code url.full @endcode SHOULD capture the absolute URL when it is available (or can be + * reconstructed). Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when + * instrumentations can identify it. + */ +static constexpr const char *kUrlFull = "url.full"; + +/** + * Unmodified original URL as seen in the event source. + *

+ * In network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is + * often just represented as a path. This field is meant to represent the URL as it was observed, + * complete or not. + * @code url.original @endcode might contain credentials passed via URL in form of @code + * https://username:password@www.example.com/ @endcode. In such case password and username SHOULD + * NOT be redacted and attribute's value SHOULD remain the same. + */ +static constexpr const char *kUrlOriginal = "url.original"; + +/** + * The URI path component + *

+ * Sensitive content provided in @code url.path @endcode SHOULD be scrubbed when instrumentations + * can identify it. + */ +static constexpr const char *kUrlPath = "url.path"; + +/** + * Port extracted from the @code url.full @endcode + */ +static constexpr const char *kUrlPort = "url.port"; + +/** + * The URI query component + *

+ * Sensitive content provided in @code url.query @endcode SHOULD be scrubbed when instrumentations + * can identify it. + */ +static constexpr const char *kUrlQuery = "url.query"; + +/** + * The highest registered url domain, stripped of the subdomain. + *

+ * This value can be determined precisely with the public suffix + * list. For example, the registered domain for @code foo.example.com @endcode is @code + * example.com @endcode. Trying to approximate this by simply taking the last two labels will not + * work well for TLDs such as @code co.uk @endcode. + */ +static constexpr const char *kUrlRegisteredDomain = "url.registered_domain"; + +/** + * The URI scheme component + * identifying the used protocol. + */ +static constexpr const char *kUrlScheme = "url.scheme"; + +/** + * The subdomain portion of a fully qualified domain name includes all of the names except the host + * name under the registered_domain. In a partially qualified domain, or if the qualification level + * of the full name cannot be determined, subdomain contains all of the names below the registered + * domain.

The subdomain portion of @code www.east.mydomain.co.uk @endcode is @code east + * @endcode. If the domain has multiple levels of subdomain, such as @code sub2.sub1.example.com + * @endcode, the subdomain field should contain @code sub2.sub1 @endcode, with no trailing period. + */ +static constexpr const char *kUrlSubdomain = "url.subdomain"; + +/** + * The low-cardinality template of an absolute path reference. + */ +static constexpr const char *kUrlTemplate = "url.template"; + +/** + * The effective top level domain (eTLD), also known as the domain suffix, is the last part of the + * domain name. For example, the top level domain for example.com is @code com @endcode.

This + * value can be determined precisely with the public suffix + * list. + */ +static constexpr const char *kUrlTopLevelDomain = "url.top_level_domain"; + +} // namespace url +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h b/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h new file mode 100644 index 0000000000..738bb6de15 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h @@ -0,0 +1,51 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace user_agent +{ + +/** + * Name of the user-agent extracted from original. Usually refers to the browser's name. + *

+ * Example of extracting browser's name from original + * string. In the case of using a user-agent for non-browser products, such as microservices with + * multiple names/versions inside the @code user_agent.original @endcode, the most significant name + * SHOULD be selected. In such a scenario it should align with @code user_agent.version @endcode + */ +static constexpr const char *kUserAgentName = "user_agent.name"; + +/** + * Value of the HTTP + * User-Agent header sent by the client. + */ +static constexpr const char *kUserAgentOriginal = "user_agent.original"; + +/** + * Version of the user-agent extracted from original. Usually refers to the browser's version + *

+ * Example of extracting browser's version from original + * string. In the case of using a user-agent for non-browser products, such as microservices with + * multiple names/versions inside the @code user_agent.original @endcode, the most significant + * version SHOULD be selected. In such a scenario it should align with @code user_agent.name + * @endcode + */ +static constexpr const char *kUserAgentVersion = "user_agent.version"; + +} // namespace user_agent +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/user_attributes.h b/api/include/opentelemetry/semconv/incubating/user_attributes.h new file mode 100644 index 0000000000..cc5a80d069 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/user_attributes.h @@ -0,0 +1,57 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace user +{ + +/** + * User email address. + */ +static constexpr const char *kUserEmail = "user.email"; + +/** + * User's full name + */ +static constexpr const char *kUserFullName = "user.full_name"; + +/** + * Unique user hash to correlate information for a user in anonymized form. + *

+ * Useful if @code user.id @endcode or @code user.name @endcode contain confidential information and + * cannot be used. + */ +static constexpr const char *kUserHash = "user.hash"; + +/** + * Unique identifier of the user. + */ +static constexpr const char *kUserId = "user.id"; + +/** + * Short name or login/username of the user. + */ +static constexpr const char *kUserName = "user.name"; + +/** + * Array of user roles at the time of the event. + */ +static constexpr const char *kUserRoles = "user.roles"; + +} // namespace user +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h new file mode 100644 index 0000000000..cc38902e88 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h @@ -0,0 +1,86 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace vcs +{ + +/** + * The ID of the change (pull request/merge request) if applicable. This is usually a unique (within + * repository) identifier generated by the VCS system. + */ +static constexpr const char *kVcsRepositoryChangeId = "vcs.repository.change.id"; + +/** + * The human readable title of the change (pull request/merge request). This title is often a brief + * summary of the change and may get merged in to a ref as the commit summary. + */ +static constexpr const char *kVcsRepositoryChangeTitle = "vcs.repository.change.title"; + +/** + * The name of the reference such as + * branch or tag in the repository. + */ +static constexpr const char *kVcsRepositoryRefName = "vcs.repository.ref.name"; + +/** + * The revision, literally revised + * version, The revision most often refers to a commit object in Git, or a revision number in + * SVN.

The revision can be a full hash value (see glossary), + * of the recorded change to a ref within a repository pointing to a + * commit commit object. It does + * not necessarily have to be a hash; it can simply define a + * revision number + * which is an integer that is monotonically increasing. In cases where + * it is identical to the @code ref.name @endcode, it SHOULD still be included. It is + * up to the implementer to decide which value to set as the revision + * based on the VCS system and situational context. + */ +static constexpr const char *kVcsRepositoryRefRevision = "vcs.repository.ref.revision"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRepositoryRefType = "vcs.repository.ref.type"; + +/** + * The URL of the repository providing the complete + * address in order to locate and identify the repository. + */ +static constexpr const char *kVcsRepositoryUrlFull = "vcs.repository.url.full"; + +namespace VcsRepositoryRefTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRepositoryRefTypeValues + +} // namespace vcs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/webengine_attributes.h b/api/include/opentelemetry/semconv/incubating/webengine_attributes.h new file mode 100644 index 0000000000..16283b43cb --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/webengine_attributes.h @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace webengine +{ + +/** + * Additional description of the web engine (e.g. detailed version and edition information). + */ +static constexpr const char *kWebengineDescription = "webengine.description"; + +/** + * The name of the web engine. + */ +static constexpr const char *kWebengineName = "webengine.name"; + +/** + * The version of the web engine. + */ +static constexpr const char *kWebengineVersion = "webengine.version"; + +} // namespace webengine +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/network_attributes.h b/api/include/opentelemetry/semconv/network_attributes.h new file mode 100644 index 0000000000..7e965e6a6e --- /dev/null +++ b/api/include/opentelemetry/semconv/network_attributes.h @@ -0,0 +1,120 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace network +{ + +/** + * Local address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkLocalAddress = "network.local.address"; + +/** + * Local port number of the network connection. + */ +static constexpr const char *kNetworkLocalPort = "network.local.port"; + +/** + * Peer address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkPeerAddress = "network.peer.address"; + +/** + * Peer port number of the network connection. + */ +static constexpr const char *kNetworkPeerPort = "network.peer.port"; + +/** + * OSI application layer or non-OSI + * equivalent.

The value SHOULD be normalized to lowercase. + */ +static constexpr const char *kNetworkProtocolName = "network.protocol.name"; + +/** + * The actual version of the protocol used for network communication. + *

+ * If protocol version is subject to negotiation (for example using ALPN), this attribute SHOULD be set to the + * negotiated version. If the actual protocol version is not known, this attribute SHOULD NOT be + * set. + */ +static constexpr const char *kNetworkProtocolVersion = "network.protocol.version"; + +/** + * OSI transport layer or inter-process communication + * method.

The value SHOULD be normalized to lowercase.

Consider always setting the + * transport when setting a port number, since a port number is ambiguous without knowing the + * transport. For example different processes could be listening on TCP port 12345 and UDP port + * 12345. + */ +static constexpr const char *kNetworkTransport = "network.transport"; + +/** + * OSI network layer or non-OSI equivalent. + *

+ * The value SHOULD be normalized to lowercase. + */ +static constexpr const char *kNetworkType = "network.type"; + +namespace NetworkTransportValues +{ +/** + * TCP + */ +static constexpr const char *kTcp = "tcp"; + +/** + * UDP + */ +static constexpr const char *kUdp = "udp"; + +/** + * Named or anonymous pipe. + */ +static constexpr const char *kPipe = "pipe"; + +/** + * Unix domain socket + */ +static constexpr const char *kUnix = "unix"; + +/** + * QUIC + */ +static constexpr const char *kQuic = "quic"; + +} // namespace NetworkTransportValues + +namespace NetworkTypeValues +{ +/** + * IPv4 + */ +static constexpr const char *kIpv4 = "ipv4"; + +/** + * IPv6 + */ +static constexpr const char *kIpv6 = "ipv6"; + +} // namespace NetworkTypeValues + +} // namespace network +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/otel_attributes.h b/api/include/opentelemetry/semconv/otel_attributes.h new file mode 100644 index 0000000000..b92eff1dd4 --- /dev/null +++ b/api/include/opentelemetry/semconv/otel_attributes.h @@ -0,0 +1,59 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace otel +{ + +/** + * The name of the instrumentation scope - (@code InstrumentationScope.Name @endcode in OTLP). + */ +static constexpr const char *kOtelScopeName = "otel.scope.name"; + +/** + * The version of the instrumentation scope - (@code InstrumentationScope.Version @endcode in OTLP). + */ +static constexpr const char *kOtelScopeVersion = "otel.scope.version"; + +/** + * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. + */ +static constexpr const char *kOtelStatusCode = "otel.status_code"; + +/** + * Description of the Status if it has a value, otherwise not set. + */ +static constexpr const char *kOtelStatusDescription = "otel.status_description"; + +namespace OtelStatusCodeValues +{ +/** + * The operation has been validated by an Application developer or Operator to have completed + * successfully. + */ +static constexpr const char *kOk = "OK"; + +/** + * The operation contains an error. + */ +static constexpr const char *kError = "ERROR"; + +} // namespace OtelStatusCodeValues + +} // namespace otel +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/schema_url.h b/api/include/opentelemetry/semconv/schema_url.h new file mode 100644 index 0000000000..62d040e40b --- /dev/null +++ b/api/include/opentelemetry/semconv/schema_url.h @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/schema_url-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +/** + * The URL of the OpenTelemetry schema for these keys and values. + */ +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.27.0"; +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/server_attributes.h b/api/include/opentelemetry/semconv/server_attributes.h new file mode 100644 index 0000000000..21cb75d729 --- /dev/null +++ b/api/include/opentelemetry/semconv/server_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace server +{ + +/** + * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain + * socket name.

When observed from the client side, and when communicating through an + * intermediary, @code server.address @endcode SHOULD represent the server address behind any + * intermediaries, for example proxies, if it's available. + */ +static constexpr const char *kServerAddress = "server.address"; + +/** + * Server port number. + *

+ * When observed from the client side, and when communicating through an intermediary, @code + * server.port @endcode SHOULD represent the server port behind any intermediaries, for example + * proxies, if it's available. + */ +static constexpr const char *kServerPort = "server.port"; + +} // namespace server +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/service_attributes.h b/api/include/opentelemetry/semconv/service_attributes.h new file mode 100644 index 0000000000..e4c0dda17a --- /dev/null +++ b/api/include/opentelemetry/semconv/service_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace service +{ + +/** + * Logical name of the service. + *

+ * MUST be the same for all instances of horizontally scaled services. If the value was not + * specified, SDKs MUST fallback to @code unknown_service: @endcode concatenated with @code process.executable.name @endcode, e.g. @code unknown_service:bash + * @endcode. If @code process.executable.name @endcode is not available, the value MUST be set to + * @code unknown_service @endcode. + */ +static constexpr const char *kServiceName = "service.name"; + +/** + * The version string of the service API or implementation. The format is not defined by these + * conventions. + */ +static constexpr const char *kServiceVersion = "service.version"; + +} // namespace service +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/telemetry_attributes.h b/api/include/opentelemetry/semconv/telemetry_attributes.h new file mode 100644 index 0000000000..7aa764cdaa --- /dev/null +++ b/api/include/opentelemetry/semconv/telemetry_attributes.h @@ -0,0 +1,111 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace telemetry +{ + +/** + * The language of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkLanguage = "telemetry.sdk.language"; + +/** + * The name of the telemetry SDK as defined above. + *

+ * The OpenTelemetry SDK MUST set the @code telemetry.sdk.name @endcode attribute to @code + * opentelemetry @endcode. If another SDK, like a fork or a vendor-provided implementation, is used, + * this SDK MUST set the + * @code telemetry.sdk.name @endcode attribute to the fully-qualified class or module name of this + * SDK's main entry point or another suitable identifier depending on the language. The identifier + * @code opentelemetry @endcode is reserved and MUST NOT be used in this case. All custom + * identifiers SHOULD be stable across different versions of an implementation. + */ +static constexpr const char *kTelemetrySdkName = "telemetry.sdk.name"; + +/** + * The version string of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkVersion = "telemetry.sdk.version"; + +namespace TelemetrySdkLanguageValues +{ +/** + * none + */ +static constexpr const char *kCpp = "cpp"; + +/** + * none + */ +static constexpr const char *kDotnet = "dotnet"; + +/** + * none + */ +static constexpr const char *kErlang = "erlang"; + +/** + * none + */ +static constexpr const char *kGo = "go"; + +/** + * none + */ +static constexpr const char *kJava = "java"; + +/** + * none + */ +static constexpr const char *kNodejs = "nodejs"; + +/** + * none + */ +static constexpr const char *kPhp = "php"; + +/** + * none + */ +static constexpr const char *kPython = "python"; + +/** + * none + */ +static constexpr const char *kRuby = "ruby"; + +/** + * none + */ +static constexpr const char *kRust = "rust"; + +/** + * none + */ +static constexpr const char *kSwift = "swift"; + +/** + * none + */ +static constexpr const char *kWebjs = "webjs"; + +} // namespace TelemetrySdkLanguageValues + +} // namespace telemetry +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/url_attributes.h b/api/include/opentelemetry/semconv/url_attributes.h new file mode 100644 index 0000000000..25ed5b03ab --- /dev/null +++ b/api/include/opentelemetry/semconv/url_attributes.h @@ -0,0 +1,66 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace url +{ + +/** + * The URI fragment component + */ +static constexpr const char *kUrlFragment = "url.fragment"; + +/** + * Absolute URL describing a network resource according to RFC3986

For network calls, URL usually has + * @code scheme://host[:port][path][?query][#fragment] @endcode format, where the fragment is not + * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless. + * @code url.full @endcode MUST NOT contain credentials passed via URL in form of @code + * https://username:password@www.example.com/ @endcode. In such case username and password SHOULD be + * redacted and attribute's value SHOULD be @code https://REDACTED:REDACTED@www.example.com/ + * @endcode. + * @code url.full @endcode SHOULD capture the absolute URL when it is available (or can be + * reconstructed). Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when + * instrumentations can identify it. + */ +static constexpr const char *kUrlFull = "url.full"; + +/** + * The URI path component + *

+ * Sensitive content provided in @code url.path @endcode SHOULD be scrubbed when instrumentations + * can identify it. + */ +static constexpr const char *kUrlPath = "url.path"; + +/** + * The URI query component + *

+ * Sensitive content provided in @code url.query @endcode SHOULD be scrubbed when instrumentations + * can identify it. + */ +static constexpr const char *kUrlQuery = "url.query"; + +/** + * The URI scheme component + * identifying the used protocol. + */ +static constexpr const char *kUrlScheme = "url.scheme"; + +} // namespace url +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/user_agent_attributes.h b/api/include/opentelemetry/semconv/user_agent_attributes.h new file mode 100644 index 0000000000..dd1d493278 --- /dev/null +++ b/api/include/opentelemetry/semconv/user_agent_attributes.h @@ -0,0 +1,30 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace user_agent +{ + +/** + * Value of the HTTP + * User-Agent header sent by the client. + */ +static constexpr const char *kUserAgentOriginal = "user_agent.original"; + +} // namespace user_agent +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index fb26385fbc..f99075380f 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -3,6 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +// FIXME, DEBUG +#error "Die" + /* DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index cf8aa1d70c..550689be73 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -15,27 +15,26 @@ ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make SemanticAttributes generation reproducible -# Repository up to 1.20.0: -# https://github.com/open-telemetry/opentelemetry-specification -# Repository from 1.21.0: -# https://github.com/open-telemetry/semantic-conventions +# repository: https://github.com/open-telemetry/semantic-conventions SEMCONV_VERSION=1.27.0 -# repository: https://github.com/open-telemetry/build-tools -GENERATOR_VERSION=0.25.0 +# repository: https://github.com/open-telemetry/weaver +WEAVER_VERSION=0.10.0 -SPEC_VERSION=v$SEMCONV_VERSION -SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION +SEMCONV_VERSION_TAG=v$SEMCONV_VERSION +WEAVER_VERSION_TAG=v$WEAVER_VERSION +SCHEMA_URL="https://opentelemetry.io/schemas/${SEMCONV_VERSION}" +INCUBATING_DIR=incubating cd ${SCRIPT_DIR} -rm -rf tmp-semconv || true -mkdir tmp-semconv -cd tmp-semconv +rm -rf semantic-conventions || true +mkdir semantic-conventions +cd semantic-conventions git init git remote add origin https://github.com/open-telemetry/semantic-conventions.git -git fetch origin "$SPEC_VERSION" +git fetch origin "$SEMCONV_VERSION_TAG" git reset --hard FETCH_HEAD cd ${SCRIPT_DIR} @@ -52,41 +51,60 @@ if [ -x "$(command -v getenforce)" ]; then fi; fi -# echo "Help ..." - -# docker run --rm otel/semconvgen:$GENERATOR_VERSION -h - -echo "Generating semantic conventions for traces ..." - -docker run --rm \ - -v ${SCRIPT_DIR}/tmp-semconv/model:/source${USE_MOUNT_OPTION} \ - -v ${SCRIPT_DIR}/templates:/templates${USE_MOUNT_OPTION} \ - -v ${ROOT_DIR}/api/include/opentelemetry/trace/:/output${USE_MOUNT_OPTION} \ - otel/semconvgen:$GENERATOR_VERSION \ - --only span,event,attribute_group\ - -f /source code \ - --template /templates/SemanticAttributes.h.j2 \ - --output /output/semantic_conventions.h \ - -Dsemconv=trace \ - -Dclass=SemanticConventions \ - -DschemaUrl=$SCHEMA_URL \ - -Dnamespace_open="namespace trace {" \ - -Dnamespace_close="}" - -echo "Generating semantic conventions for resources ..." - -docker run --rm \ - -v ${SCRIPT_DIR}/tmp-semconv/model:/source${USE_MOUNT_OPTION} \ - -v ${SCRIPT_DIR}/templates:/templates${USE_MOUNT_OPTION} \ - -v ${ROOT_DIR}/sdk/include/opentelemetry/sdk/resource/:/output${USE_MOUNT_OPTION} \ - otel/semconvgen:$GENERATOR_VERSION \ - --only resource,attribute_group \ - -f /source code \ - --template /templates/SemanticAttributes.h.j2 \ - --output /output/semantic_conventions.h \ - -Dsemconv=resource \ - -Dclass=SemanticConventions \ - -DschemaUrl=$SCHEMA_URL \ - -Dnamespace_open="namespace sdk { namespace resource {" \ - -Dnamespace_close="} }" +# DOCKER +# ====== +# +# MY_UID=$(id -u) +# MY_GID=$(id -g) +# docker --user ${MY_UID}:${MY_GID} +# +# PODMAN +# ====== +# +# docker --user 0:0 + +MY_UID=$(id -u) +MY_GID=$(id -g) + +if [ -x "$(command -v docker)" ]; then + PODMANSTATUS=$(docker -v | grep -c podman); + if [ "${PODMANSTATUS}" -ge "1" ]; then + echo "Detected PODMAN" + MY_UID="0" + MY_GID="0" + fi; +fi + +generate() { + TARGET=$1 + OUTPUT=$2 + FILTER=$3 + docker run --rm --user ${MY_UID}:${MY_GID} \ + -v ${SCRIPT_DIR}/semantic-conventions/model:/source${USE_MOUNT_OPTION} \ + -v ${SCRIPT_DIR}/templates:/templates${USE_MOUNT_OPTION} \ + -v ${ROOT_DIR}/wip/:/output${USE_MOUNT_OPTION} \ + otel/weaver:$WEAVER_VERSION_TAG \ + registry \ + generate \ + --registry=/source \ + --templates=/templates \ + ${TARGET} \ + /output/${TARGET} \ + --param output=${OUTPUT} \ + --param filter=${FILTER} \ + --param schema_url=${SCHEMA_URL} +} + +# stable attributes and metrics +mkdir -p ${ROOT_DIR}/wip +generate "./" "./" "stable" + +mkdir -p ${ROOT_DIR}/wip/${INCUBATING_DIR} +generate "./" "./${INCUBATING_DIR}/" "any" + +cp -r ${ROOT_DIR}/wip/*.h \ + ${ROOT_DIR}/api/include/opentelemetry/semconv/ + +cp -r ${ROOT_DIR}/wip/${INCUBATING_DIR}/*.h \ + ${ROOT_DIR}/api/include/opentelemetry/semconv/incubating diff --git a/buildscripts/semantic-convention/templates/registry/common.j2 b/buildscripts/semantic-convention/templates/registry/common.j2 new file mode 100644 index 0000000000..1b7eb47e08 --- /dev/null +++ b/buildscripts/semantic-convention/templates/registry/common.j2 @@ -0,0 +1,54 @@ +{# + Copyright The OpenTelemetry Authors + SPDX-License-Identifier: Apache-2.0 + + This file is: + - a Jinja template, + - used to generate semantic conventions, + - using weaver. + + For doc on the template syntax: + https://jinja.palletsprojects.com/en/3.0.x/ + + For doc on the semantic conventions: + https://github.com/open-telemetry/semantic-conventions + + For doc on weaver: + https://github.com/open-telemetry/weaver +#} + + +{%- macro file_header() -%} +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{% endmacro -%} + +{%- macro str_or_empty(str) -%} +{% if str is none %}{{""}}{% else %}{{str}}{% endif %} +{%- endmacro %} + +{%- macro remove_trailing_dots(str) -%} +{%- if str[-1:] == '.' -%}{{ remove_trailing_dots(str[:-1]) }}{%- else -%}{{ str }}{%- endif -%} +{%- endmacro -%} + +{%- macro comment_with_prefix(str, prefix) -%} +{{remove_trailing_dots(str | trim(' \n')) | comment_with_prefix(prefix) | replace("\\", "\\\\")}} +{%- endmacro %} + +{%- macro import_deprecated(semconv) -%} + {%- if (semconv | select("deprecated") | list | count > 0) or (ctx.filter == "any" and semconv | select("stable") | list | count > 0) -%} +from deprecated import deprecated + {%- endif -%} +{%- endmacro-%} diff --git a/buildscripts/semantic-convention/templates/registry/schema_url-h.j2 b/buildscripts/semantic-convention/templates/registry/schema_url-h.j2 new file mode 100644 index 0000000000..b53f0f02be --- /dev/null +++ b/buildscripts/semantic-convention/templates/registry/schema_url-h.j2 @@ -0,0 +1,49 @@ +{# + Copyright The OpenTelemetry Authors + SPDX-License-Identifier: Apache-2.0 + + This file is: + - a Jinja template, + - used to generate semantic conventions, + - using weaver. + + For doc on the template syntax: + https://jinja.palletsprojects.com/en/3.0.x/ + + For doc on the semantic conventions: + https://github.com/open-telemetry/semantic-conventions + + For doc on weaver: + https://github.com/open-telemetry/weaver +#} +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/schema_url-h.j2 + */ +{# ========================================================================== #} + +{{ template.set_file_name("schema_url.h") }} +{% import 'common.j2' as c %} + +{# ========================================================================== #} + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +/** + * The URL of the OpenTelemetry schema for these keys and values. + */ +static constexpr const char *kSchemaUrl = {{ params.schema_url | print_member_value }}; +} +OPENTELEMETRY_END_NAMESPACE + diff --git a/buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 b/buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 new file mode 100644 index 0000000000..206623d87f --- /dev/null +++ b/buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 @@ -0,0 +1,131 @@ +{# + Copyright The OpenTelemetry Authors + SPDX-License-Identifier: Apache-2.0 + + This file is: + - a Jinja template, + - used to generate semantic conventions, + - using weaver. + + For doc on the template syntax: + https://jinja.palletsprojects.com/en/3.0.x/ + + For doc on the semantic conventions: + https://github.com/open-telemetry/semantic-conventions + + For doc on weaver: + https://github.com/open-telemetry/weaver +#} +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ +{# ========================================================================== #} + +{% set debug = false %} + +{% set file_name = ctx.output + (ctx.root_namespace | snake_case) ~ "_attributes.h" %} +{{ template.set_file_name(file_name) }} +{% import 'common.j2' as c %} + +{% set attributes = ctx.attributes | list %} +{% set enum_attributes = attributes | select("enum") | rejectattr("name", "in", ctx.excluded_attributes) | list %} + +{% macro attribute_namespace(ctx) %} +{{ ctx.root_namespace | snake_case }} +{% endmacro %} + +{% macro attribute_name(attribute) %} +k{{ attribute.name | pascal_case }} +{% endmacro %} + +{% macro attribute_type(attribute) %} +{{ attribute.type | enum_type | map_text("cpp_types", "FIXME") }} +{% endmacro %} + +{% macro enum_namespace_name(attribute) %} +{{ attribute.name | pascal_case ~ "Values"}} +{% endmacro %} + +{% macro enum_name(member) %} +k{{ member.id | pascal_case }} +{% endmacro %} + +{% macro stable_class_ref(const_name, separator) %} +{{ctx.stable_package_name}}.{{ctx.root_namespace}}_attributes{{separator}}{{const_name}} +{% endmacro %} + +{% set cpp_attribute_namespace = attribute_namespace(ctx) %} + +{# ========================================================================== #} + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace {{ cpp_attribute_namespace -}} +{ + +{% for attribute in attributes %} + {% if debug %} +// DEBUG: {{ attribute }} + {% endif %} + {% set cpp_attr_name = attribute_name(attribute) %} + {% set excluded = attribute.name in ctx.excluded_attributes %} + {% if excluded %} +#if 0 +// Excluded attribute: + {% endif %} + {% if attribute is deprecated %} +{{ [attribute.brief, "\n", "@deprecated", attribute.deprecated, "\n", attribute.note] | comment(ident=2) }} +OPENTELEMETRY_DEPRECATED + {% else %} +{{ [attribute.brief, "\n", attribute.note] | comment(ident=2) }} + {% endif %} +static constexpr const char *{{cpp_attr_name}} = "{{attribute.name}}"; + {% if excluded %} +#endif + {% endif %} + +{% endfor %} + +{% for attribute in enum_attributes %} + {% set class_name = attribute.name | pascal_case ~ "Values" %} + {% set cpp_enum_name = enum_namespace_name(attribute) %} + {% set cpp_enum_type = attribute_type(attribute) %} + {% if debug %} +// DEBUG: {{ attribute }} + {% endif %} +namespace {{cpp_enum_name -}} +{ + {% for member in attribute.type.members %} + {% set member_name = enum_name(member) %} + {% if debug %} +// DEBUG: {{ member }} + {% endif %} + {% if member is deprecated %} +{{ [member.brief, "\n", "@deprecated", member.deprecated] | comment(ident=2) }} +OPENTELEMETRY_DEPRECATED + {% else %} +{{ member.brief | comment(ident=2) }} + {% endif %} +static constexpr {{ cpp_enum_type }} {{ member_name }} = {{ member.value | print_member_value }}; + + {% endfor %} +} + +{% endfor %} + +} +} +OPENTELEMETRY_END_NAMESPACE + diff --git a/buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 b/buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 new file mode 100644 index 0000000000..ea87c18547 --- /dev/null +++ b/buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 @@ -0,0 +1,167 @@ +{# + Copyright The OpenTelemetry Authors + SPDX-License-Identifier: Apache-2.0 + + This file is: + - a Jinja template, + - used to generate semantic conventions, + - using weaver. + + For doc on the template syntax: + https://jinja.palletsprojects.com/en/3.0.x/ + + For doc on the semantic conventions: + https://github.com/open-telemetry/semantic-conventions + + For doc on weaver: + https://github.com/open-telemetry/weaver +#} +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ +{# ========================================================================== #} + +{% set debug = false %} + +{% set file_name = ctx.output + (ctx.root_namespace | snake_case) ~ "_metrics.h" %} +{{ template.set_file_name(file_name) }} +{% import 'common.j2' as c %} + +{% set metrics = ctx.metrics | list %} + +{% macro metric_namespace(ctx) %} +{{ ctx.root_namespace | snake_case }} +{% endmacro %} + +{% macro func_metric_name(metric) %} +{{ metric.id | pascal_case }} +{% endmacro %} + +{% macro var_metric_name(metric) %} +k{{ metric.id | pascal_case }} +{% endmacro %} + +{% macro descr_metric_name(metric) %} +descr{{ metric.id | pascal_case }} +{% endmacro %} + +{% macro unit_metric_name(metric) %} +unit{{ metric.id | pascal_case }} +{% endmacro %} + +{% macro sync_instrument_support(metric) %} +{{ metric.instrument | map_text("cpp_sync_support", "FIXME") }} +{% endmacro %} + +{% macro sync_instrument_type(metric) %} +{{ metric.instrument | map_text("cpp_sync_instrument_to_type", "FIXME") }} +{% endmacro %} + +{% macro sync_instrument_factory(metric) %} +{{ metric.instrument | map_text("cpp_sync_instrument_to_factory", "FIXME") }} +{% endmacro %} + +{% macro async_instrument_support(metric) %} +{{ metric.instrument | map_text("cpp_async_support", "FIXME") }} +{% endmacro %} + +{% macro async_instrument_type(metric) %} +{{ metric.instrument | map_text("cpp_async_instrument_to_type", "FIXME") }} +{% endmacro %} + +{% macro async_instrument_factory(metric) %} +{{ metric.instrument | map_text("cpp_async_instrument_to_factory", "FIXME") }} +{% endmacro %} + +{% set cpp_metric_namespace = metric_namespace(ctx) %} + +{# ========================================================================== #} + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace {{ cpp_metric_namespace -}} +{ + +{% for metric in ctx.metrics %} + {% if debug %} +// DEBUG: {{ metric }} + {% endif %} + {% set f_metric_name = func_metric_name(metric) %} + {% set v_metric_name = var_metric_name(metric) %} + {% set descr = descr_metric_name(metric) %} + {% set unit = unit_metric_name(metric) %} + {% set sync_support = sync_instrument_support(metric) %} + {% set async_support = async_instrument_support(metric) %} + {% set sync_type = sync_instrument_type(metric) %} + {% set async_type = async_instrument_type(metric) %} + {% set sync_factory = sync_instrument_factory(metric) %} + {% set async_factory = async_instrument_factory(metric) %} + {% set excluded = metric.id in ctx.excluded_attributes %} + {% if excluded %} +#if 0 +// Excluded metric: + {% endif %} + {% if metric is deprecated %} +{{ [metric.brief, "\n", "@deprecated", metric.deprecated, "\n", metric.note, "\n", metric.instrument] | comment(ident=2) }} +OPENTELEMETRY_DEPRECATED + {% else %} +{{ [metric.brief, "\n", metric.note, "\n", metric.instrument] | comment(ident=2) }} + {% endif %} +static constexpr const char *{{v_metric_name}} = "{{metric.id}}"; +static constexpr const char *{{descr}} = "{{metric.brief}}"; +static constexpr const char *{{unit}} = "{{metric.unit}}"; + + {% if not sync_support %} +#if LATER +// Unsupported: + {% endif %} +static nostd::unique_ptr<{{sync_type-}}> +CreateSync{{f_metric_name-}}(metrics::Meter *meter) +{ + return meter->{{sync_factory}}( + {{v_metric_name}}, + {{descr}}, + {{unit}}); +} + {% if not sync_support %} +#endif + {% endif %} + + {% if not async_support %} +#if LATER +// Unsupported: + {% endif %} +static nostd::shared_ptr<{{async_type-}}> +CreateAsync{{f_metric_name-}}(metrics::Meter *meter) +{ + return meter->{{async_factory}}( + {{v_metric_name}}, + {{descr}}, + {{unit}}); +} + {% if not async_support %} +#endif + {% endif %} + + {% if excluded %} +#endif + {% endif %} + +{% endfor %} + +} +} +OPENTELEMETRY_END_NAMESPACE + diff --git a/buildscripts/semantic-convention/templates/registry/weaver.yaml b/buildscripts/semantic-convention/templates/registry/weaver.yaml new file mode 100644 index 0000000000..59236bbeff --- /dev/null +++ b/buildscripts/semantic-convention/templates/registry/weaver.yaml @@ -0,0 +1,122 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +params: + # excluded namespaces will not be generated + excluded_namespaces: [ios, aspnetcore, signalr, android, dotnet, jvm, kestrel, v8js, veightjs, go, nodejs] + + # excluded attributes will be commented out in the generated code + # this behavior is fully controlled by jinja templates + excluded_attributes: ["messaging.client_id"] + + stable_package_name: opentelemetry.semconv + + # "https://opentelemetry.io/schemas/" + # this is provided from the command line + schema_url: "" + +templates: + - pattern: schema_url-h.j2 + filter: . + application_mode: single + - pattern: semantic_attributes-h.j2 + filter: > + semconv_grouped_attributes({ + "exclude_root_namespace": $excluded_namespaces, + "exclude_stability": if $filter == "any" then [] else ["experimental"] end, + }) + | map({ + root_namespace: .root_namespace, + attributes: .attributes, + output: $output, + stable_package_name: $stable_package_name + ".attributes", + filter: $filter, + excluded_attributes: $excluded_attributes[] + }) + application_mode: each + - pattern: semantic_metrics-h.j2 + filter: > + semconv_grouped_metrics({ + "exclude_root_namespace": $excluded_namespaces, + "exclude_stability": if $filter == "any" then [] else ["experimental"] end, + }) + | map({ + root_namespace: .root_namespace, + metrics: .metrics, + output: $output, + stable_package_name: $stable_package_name + ".metrics", + filter: $filter + }) + application_mode: each + +text_maps: + cpp_types: + int: int + double: double + boolean: bool + string: const char * + string[]: const char *[] + template[string]: const char * + template[string[]]: const char *[] + + cpp_sync_support: + counter: true + histogram: true + updowncounter: true + gauge: false + + cpp_sync_instrument_to_type: + counter: metrics::Counter + histogram: metrics::Histogram + updowncounter: metrics::UpDownCounter + # Not supported yet + gauge: metrics::Gauge + + cpp_sync_instrument_to_factory: + counter: CreateUInt64Counter + histogram: CreateUInt64Histogram + updowncounter: CreateInt64UpDownCounter + # Not supported yet + gauge: CreateUInt64Gauge + + cpp_async_support: + counter: true + histogram: false + updowncounter: true + gauge: true + + cpp_async_instrument_to_type: + counter: metrics::ObservableInstrument + # Not supported yet + histogram: metrics::ObservableInstrument + updowncounter: metrics::ObservableInstrument + gauge: metrics::ObservableInstrument + + cpp_async_instrument_to_factory: + counter: CreateInt64ObservableCounter + # Not supported yet + histogram: CreateInt64ObservableHistogram + updowncounter: CreateInt64ObservableUpDownCounter + gauge: CreateInt64ObservableGauge + +comment_formats: + cpp: + format: html + header: "/**" + prefix: " * " + footer: " */" + indent_type: Space + trim: true + remove_trailing_dots: false + enforce_trailing_dots: false + old_style_paragraph: true + omit_closing_li: false + inline_code_snippet: "@code {{code}} @endcode" + block_code_snippet: "@verbatim {{code}} @endverbatim" +default_comment_format: cpp + +whitespace_control: + trim_blocks: true + lstrip_blocks: true + keep_trailing_newline: true + diff --git a/examples/grpc/client.cc b/examples/grpc/client.cc index 9ca41c6958..49be22c155 100644 --- a/examples/grpc/client.cc +++ b/examples/grpc/client.cc @@ -15,7 +15,8 @@ #include #include -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/semconv/incubating/rpc_attributes.h" +#include "opentelemetry/semconv/network_attributes.h" #include "tracer_common.h" using grpc::Channel; @@ -29,6 +30,7 @@ using grpc_example::GreetResponse; namespace { namespace context = opentelemetry::context; +namespace semconv = opentelemetry::semconv; using namespace opentelemetry::trace; class GreeterClient { @@ -47,14 +49,14 @@ class GreeterClient options.kind = SpanKind::kClient; std::string span_name = "GreeterClient/Greet"; - auto span = get_tracer("grpc")->StartSpan( - span_name, - {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "grpc-example.GreetService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kNetworkPeerAddress, ip}, - {SemanticConventions::kNetworkPeerPort, port}}, - options); + auto span = + get_tracer("grpc")->StartSpan(span_name, + {{semconv::rpc::kRpcSystem, "grpc"}, + {semconv::rpc::kRpcService, "grpc-example.GreetService"}, + {semconv::rpc::kRpcMethod, "Greet"}, + {semconv::network::kNetworkPeerAddress, ip}, + {semconv::network::kNetworkPeerPort, port}}, + options); auto scope = get_tracer("grpc-client")->WithActiveSpan(span); @@ -69,7 +71,7 @@ class GreeterClient if (status.ok()) { span->SetStatus(StatusCode::kOk); - span->SetAttribute(SemanticConventions::kRpcGrpcStatusCode, status.error_code()); + span->SetAttribute(semconv::rpc::kRpcGrpcStatusCode, status.error_code()); // Make sure to end your spans! span->End(); return response.response(); @@ -78,7 +80,7 @@ class GreeterClient { std::cout << status.error_code() << ": " << status.error_message() << '\n'; span->SetStatus(StatusCode::kError); - span->SetAttribute(SemanticConventions::kRpcGrpcStatusCode, status.error_code()); + span->SetAttribute(semconv::rpc::kRpcGrpcStatusCode, status.error_code()); // Make sure to end your spans! span->End(); return "RPC failed"; diff --git a/examples/grpc/server.cc b/examples/grpc/server.cc index 3c3fcede4f..6aa543a8a1 100644 --- a/examples/grpc/server.cc +++ b/examples/grpc/server.cc @@ -7,8 +7,8 @@ # include "messages.grpc.pb.h" #endif +#include "opentelemetry/semconv/incubating/rpc_attributes.h" #include "opentelemetry/trace/context.h" -#include "opentelemetry/trace/semantic_conventions.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" #include "tracer_common.h" @@ -38,6 +38,7 @@ using SpanContext = opentelemetry::trace::SpanContext; using namespace opentelemetry::trace; namespace context = opentelemetry::context; +namespace semconv = opentelemetry::semconv; namespace { @@ -67,10 +68,10 @@ class GreeterServer final : public Greeter::Service std::string span_name = "GreeterService/Greet"; auto span = get_tracer("grpc")->StartSpan(span_name, - {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "GreeterService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kRpcGrpcStatusCode, 0}}, + {{semconv::rpc::kRpcSystem, "grpc"}, + {semconv::rpc::kRpcService, "GreeterService"}, + {semconv::rpc::kRpcMethod, "Greet"}, + {semconv::rpc::kRpcGrpcStatusCode, 0}}, options); auto scope = get_tracer("grpc")->WithActiveSpan(span); diff --git a/examples/http/client.cc b/examples/http/client.cc index 3a8486f55f..54f10b2f95 100644 --- a/examples/http/client.cc +++ b/examples/http/client.cc @@ -3,7 +3,8 @@ #include "opentelemetry/ext/http/client/http_client_factory.h" #include "opentelemetry/ext/http/common/url_parser.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/semconv/http_attributes.h" +#include "opentelemetry/semconv/url_attributes.h" #include "tracer_common.h" namespace @@ -13,6 +14,7 @@ using namespace opentelemetry::trace; namespace http_client = opentelemetry::ext::http::client; namespace context = opentelemetry::context; namespace nostd = opentelemetry::nostd; +namespace semconv = opentelemetry::semconv; void sendRequest(const std::string &url) { @@ -26,9 +28,9 @@ void sendRequest(const std::string &url) std::string span_name = url_parser.path_; auto span = get_tracer("http-client") ->StartSpan(span_name, - {{SemanticConventions::kUrlFull, url_parser.url_}, - {SemanticConventions::kUrlScheme, url_parser.scheme_}, - {SemanticConventions::kHttpRequestMethod, "GET"}}, + {{semconv::url::kUrlFull, url_parser.url_}, + {semconv::url::kUrlScheme, url_parser.scheme_}, + {semconv::http::kHttpRequestMethod, "GET"}}, options); auto scope = get_tracer("http-client")->WithActiveSpan(span); @@ -44,7 +46,7 @@ void sendRequest(const std::string &url) { // set span attributes auto status_code = result.GetResponse().GetStatusCode(); - span->SetAttribute(SemanticConventions::kHttpResponseStatusCode, status_code); + span->SetAttribute(semconv::http::kHttpResponseStatusCode, status_code); result.GetResponse().ForEachHeader( [&span](nostd::string_view header_name, nostd::string_view header_value) { span->SetAttribute("http.header." + std::string(header_name.data()), header_value); diff --git a/examples/http/server.cc b/examples/http/server.cc index 85cccc234d..23b37d3ab9 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -2,8 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #include "server.h" +#include "opentelemetry/semconv/client_attributes.h" +#include "opentelemetry/semconv/incubating/http_attributes.h" +#include "opentelemetry/semconv/server_attributes.h" +#include "opentelemetry/semconv/url_attributes.h" #include "opentelemetry/trace/context.h" -#include "opentelemetry/trace/semantic_conventions.h" #include "tracer_common.h" #include @@ -14,6 +17,7 @@ namespace using namespace opentelemetry::trace; namespace context = opentelemetry::context; +namespace semconv = opentelemetry::semconv; uint16_t server_port = 8800; constexpr const char *server_name = "localhost"; @@ -40,13 +44,13 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback // start span with parent context extracted from http header auto span = get_tracer("http-server") ->StartSpan(span_name, - {{SemanticConventions::kServerAddress, server_name}, - {SemanticConventions::kServerPort, server_port}, - {SemanticConventions::kHttpRequestMethod, request.method}, - {SemanticConventions::kUrlScheme, "http"}, - {SemanticConventions::kHttpRequestBodySize, + {{semconv::server::kServerAddress, server_name}, + {semconv::server::kServerPort, server_port}, + {semconv::http::kHttpRequestMethod, request.method}, + {semconv::url::kUrlScheme, "http"}, + {semconv::http::kHttpRequestBodySize, static_cast(request.content.length())}, - {SemanticConventions::kClientAddress, request.client}}, + {semconv::client::kClientAddress, request.client}}, options); auto scope = get_tracer("http_server")->WithActiveSpan(span); diff --git a/exporters/otlp/test/otlp_log_recordable_test.cc b/exporters/otlp/test/otlp_log_recordable_test.cc index bcecbb8d8f..e5d6701e46 100644 --- a/exporters/otlp/test/otlp_log_recordable_test.cc +++ b/exporters/otlp/test/otlp_log_recordable_test.cc @@ -8,7 +8,6 @@ #include "opentelemetry/exporters/otlp/otlp_log_recordable.h" #include "opentelemetry/sdk/logs/read_write_log_record.h" #include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter diff --git a/exporters/prometheus/src/exporter_utils.cc b/exporters/prometheus/src/exporter_utils.cc index 77fcd56ad2..c5de2b2c3f 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -16,12 +16,9 @@ #include "opentelemetry/common/macros.h" #include "opentelemetry/exporters/prometheus/exporter_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/metrics/export/metric_producer.h" #include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" -#include "opentelemetry/trace/semantic_conventions.h" - -#include "opentelemetry/sdk/common/global_log_handler.h" namespace prometheus_client = ::prometheus; namespace metric_sdk = opentelemetry::sdk::metrics; diff --git a/exporters/zipkin/src/recordable.cc b/exporters/zipkin/src/recordable.cc index 69899e7fad..8b60faef71 100644 --- a/exporters/zipkin/src/recordable.cc +++ b/exporters/zipkin/src/recordable.cc @@ -21,7 +21,7 @@ #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/semconv/service_attributes.h" #include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_id.h" #include "opentelemetry/trace/span_metadata.h" @@ -244,9 +244,9 @@ void Recordable::SetResource(const sdk::resource::Resource &resource) noexcept { // only service.name attribute is supported by specs as of now. auto attributes = resource.GetAttributes(); - if (attributes.find(SemanticConventions::kServiceName) != attributes.end()) + if (attributes.find(semconv::service::kServiceName) != attributes.end()) { - service_name_ = nostd::get(attributes[SemanticConventions::kServiceName]); + service_name_ = nostd::get(attributes[semconv::service::kServiceName]); } } diff --git a/opentracing-shim/include/opentelemetry/opentracingshim/shim_utils.h b/opentracing-shim/include/opentelemetry/opentracingshim/shim_utils.h index 871bed590f..a7feb5efc4 100644 --- a/opentracing-shim/include/opentelemetry/opentracingshim/shim_utils.h +++ b/opentracing-shim/include/opentelemetry/opentracingshim/shim_utils.h @@ -7,7 +7,7 @@ #include "opentelemetry/opentracingshim/span_context_shim.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/semconv/incubating/opentracing_attributes.h" #include "opentelemetry/trace/tracer.h" #include "opentracing/tracer.h" @@ -93,7 +93,7 @@ class LinksIterable final : public opentelemetry::trace::SpanContextKeyValueIter callback) const noexcept override { using opentracing::SpanReferenceType; - using namespace opentelemetry::trace::SemanticConventions; + using namespace opentelemetry::semconv; using LinksList = std::initializer_list>; for (const auto &entry : refs_) @@ -102,18 +102,18 @@ class LinksIterable final : public opentelemetry::trace::SpanContextKeyValueIter if (entry.first == SpanReferenceType::ChildOfRef) { - span_kind = OpentracingRefTypeValues::kChildOf; + span_kind = opentracing::OpentracingRefTypeValues::kChildOf; } else if (entry.first == SpanReferenceType::FollowsFromRef) { - span_kind = OpentracingRefTypeValues::kFollowsFrom; + span_kind = opentracing::OpentracingRefTypeValues::kFollowsFrom; } auto context_shim = SpanContextShim::extractFrom(entry.second); if (context_shim && !span_kind.empty() && !callback(context_shim->context(), opentelemetry::common::KeyValueIterableView( - {{kOpentracingRefType, span_kind}}))) + {{opentracing::kOpentracingRefType, span_kind}}))) { return false; } diff --git a/opentracing-shim/src/span_shim.cc b/opentracing-shim/src/span_shim.cc index 7911277f78..1be909f1bd 100644 --- a/opentracing-shim/src/span_shim.cc +++ b/opentracing-shim/src/span_shim.cc @@ -8,7 +8,7 @@ #include "opentelemetry/opentracingshim/span_context_shim.h" #include "opentelemetry/opentracingshim/tracer_shim.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/semconv/exception_attributes.h" #include "opentelemetry/trace/span_metadata.h" #include "opentracing/ext/tags.h" @@ -134,15 +134,15 @@ void SpanShim::logImpl(nostd::span fields, { if (key == "error.kind") // - error.kind maps to exception.type. { - key = opentelemetry::trace::SemanticConventions::kExceptionType; + key = opentelemetry::semconv::exception::kExceptionType; } else if (key == "message") // - message maps to exception.message. { - key = opentelemetry::trace::SemanticConventions::kExceptionMessage; + key = opentelemetry::semconv::exception::kExceptionMessage; } else if (key == "stack") // - stack maps to exception.stacktrace. { - key = opentelemetry::trace::SemanticConventions::kExceptionStacktrace; + key = opentelemetry::semconv::exception::kExceptionStacktrace; } } diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 9ff985be4d..020d9e78f4 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -3,6 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +// FIXME, DEBUG +#error "Die" + /* DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 919624686d..5ae5446e80 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -8,8 +8,10 @@ #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/semconv/incubating/process_attributes.h" +#include "opentelemetry/semconv/service_attributes.h" +#include "opentelemetry/semconv/telemetry_attributes.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -36,16 +38,16 @@ Resource Resource::Create(const ResourceAttributes &attributes, const std::strin auto resource = Resource::GetDefault().Merge(otel_resource).Merge(Resource{attributes, schema_url}); - if (resource.attributes_.find(SemanticConventions::kServiceName) == resource.attributes_.end()) + if (resource.attributes_.find(semconv::service::kServiceName) == resource.attributes_.end()) { std::string default_service_name = "unknown_service"; auto it_process_executable_name = - resource.attributes_.find(SemanticConventions::kProcessExecutableName); + resource.attributes_.find(semconv::process::kProcessExecutableName); if (it_process_executable_name != resource.attributes_.end()) { default_service_name += ":" + nostd::get(it_process_executable_name->second); } - resource.attributes_[SemanticConventions::kServiceName] = default_service_name; + resource.attributes_[semconv::service::kServiceName] = default_service_name; } return resource; } @@ -59,9 +61,9 @@ Resource &Resource::GetEmpty() Resource &Resource::GetDefault() { static Resource default_resource( - {{SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, + {{semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, std::string{}); return default_resource; } diff --git a/sdk/src/resource/resource_detector.cc b/sdk/src/resource/resource_detector.cc index b7c7c7e614..cab8ce748a 100644 --- a/sdk/src/resource/resource_detector.cc +++ b/sdk/src/resource/resource_detector.cc @@ -4,7 +4,7 @@ #include "opentelemetry/sdk/resource/resource_detector.h" #include "opentelemetry/sdk/common/env_variables.h" #include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/semconv/service_attributes.h" #include "opentelemetry/version.h" #include @@ -55,7 +55,7 @@ Resource OTELResourceDetector::Detect() noexcept if (service_name_exists) { - attributes[SemanticConventions::kServiceName] = service_name; + attributes[semconv::service::kServiceName] = service_name; } return Resource(attributes); diff --git a/sdk/test/resource/resource_test.cc b/sdk/test/resource/resource_test.cc index c15087e9b7..a359cb33d4 100644 --- a/sdk/test/resource/resource_test.cc +++ b/sdk/test/resource/resource_test.cc @@ -14,8 +14,9 @@ #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/semconv/service_attributes.h" +#include "opentelemetry/semconv/telemetry_attributes.h" #if defined(_MSC_VER) # include "opentelemetry/sdk/common/env_variables.h" @@ -24,7 +25,8 @@ using opentelemetry::sdk::common::unsetenv; #endif using namespace opentelemetry::sdk::resource; -namespace nostd = opentelemetry::nostd; +namespace nostd = opentelemetry::nostd; +namespace semconv = opentelemetry::semconv; class TestResource : public Resource { @@ -41,10 +43,10 @@ TEST(ResourceTest, create_without_servicename) {"service", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}, - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "unknown_service"}}; + {semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {semconv::service::kServiceName, "unknown_service"}}; ResourceAttributes attributes = { {"service", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}}; @@ -74,10 +76,10 @@ TEST(ResourceTest, create_with_servicename) ResourceAttributes expected_attributes = { {"version", static_cast(1)}, {"cost", 234.23}, - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "backend"}, + {semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {semconv::service::kServiceName, "backend"}, }; ResourceAttributes attributes = { {"service.name", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}}; @@ -105,10 +107,10 @@ TEST(ResourceTest, create_with_servicename) TEST(ResourceTest, create_with_emptyatrributes) { ResourceAttributes expected_attributes = { - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "unknown_service"}, + {semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {semconv::service::kServiceName, "unknown_service"}, }; ResourceAttributes attributes = {}; auto resource = Resource::Create(attributes);