From a369b9ee8ae6daf48b84ee735020878a08784f22 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Wed, 18 Dec 2024 18:43:34 +0100 Subject: [PATCH] deps: update opentelemetry-cpp to 1.18.0 --- deps/opentelemetry-cpp/.bazelrc | 3 + .../opentelemetry/common/spin_lock_mutex.h | 6 +- .../opentelemetry/common/string_util.h | 4 +- .../include/opentelemetry/logs/event_logger.h | 5 +- .../api/include/opentelemetry/logs/logger.h | 5 +- .../opentelemetry/logs/logger_type_traits.h | 4 +- .../api/include/opentelemetry/metrics/meter.h | 24 + .../api/include/opentelemetry/metrics/noop.h | 36 + .../opentelemetry/metrics/sync_instruments.h | 77 + .../nostd/internal/absl/README.md | 4 +- .../nostd/internal/absl/base/config.h | 43 +- .../absl/base/internal/inline_variable.h | 10 +- .../internal/absl/base/internal/invoke.h | 10 +- .../nostd/internal/absl/base/macros.h | 8 +- .../nostd/internal/absl/base/options.h | 50 +- .../nostd/internal/absl/meta/type_traits.h | 44 +- .../internal/absl/types/bad_variant_access.h | 14 +- .../internal/absl/types/internal/variant.h | 258 ++-- .../nostd/internal/absl/types/variant.h | 222 +-- .../nostd/internal/absl/utility/utility.h | 68 +- .../api/include/opentelemetry/nostd/variant.h | 11 +- .../opentelemetry/semconv/client_attributes.h | 41 + .../opentelemetry/semconv/error_attributes.h | 57 + .../semconv/exception_attributes.h | 59 + .../opentelemetry/semconv/http_attributes.h | 153 ++ .../opentelemetry/semconv/http_metrics.h | 79 + .../semconv/incubating/artifact_attributes.h | 81 ++ .../semconv/incubating/aws_attributes.h | 356 +++++ .../semconv/incubating/az_attributes.h | 37 + .../semconv/incubating/browser_attributes.h | 65 + .../semconv/incubating/cicd_attributes.h | 76 + .../semconv/incubating/client_attributes.h | 41 + .../semconv/incubating/cloud_attributes.h | 272 ++++ .../incubating/cloudevents_attributes.h | 58 + .../incubating/cloudfoundry_attributes.h | 138 ++ .../semconv/incubating/code_attributes.h | 60 + .../semconv/incubating/container_attributes.h | 157 ++ .../semconv/incubating/container_metrics.h | 224 +++ .../semconv/incubating/cpu_attributes.h | 73 + .../semconv/incubating/db_attributes.h | 841 +++++++++++ .../semconv/incubating/db_metrics.h | 816 +++++++++++ .../incubating/deployment_attributes.h | 76 + .../incubating/destination_attributes.h | 37 + .../semconv/incubating/device_attributes.h | 66 + .../semconv/incubating/disk_attributes.h | 43 + .../semconv/incubating/dns_attributes.h | 34 + .../semconv/incubating/dns_metrics.h | 49 + .../semconv/incubating/enduser_attributes.h | 51 + .../semconv/incubating/error_attributes.h | 57 + .../semconv/incubating/event_attributes.h | 34 + .../semconv/incubating/exception_attributes.h | 59 + .../semconv/incubating/faas_attributes.h | 232 +++ .../semconv/incubating/faas_metrics.h | 287 ++++ .../incubating/feature_flag_attributes.h | 47 + .../semconv/incubating/file_attributes.h | 144 ++ .../semconv/incubating/gcp_attributes.h | 64 + .../semconv/incubating/gen_ai_attributes.h | 263 ++++ .../semconv/incubating/gen_ai_metrics.h | 158 ++ .../semconv/incubating/graphql_attributes.h | 60 + .../semconv/incubating/heroku_attributes.h | 39 + .../semconv/incubating/host_attributes.h | 159 ++ .../semconv/incubating/http_attributes.h | 365 +++++ .../semconv/incubating/http_metrics.h | 353 +++++ .../semconv/incubating/hw_attributes.h | 148 ++ .../semconv/incubating/hw_metrics.h | 174 +++ .../semconv/incubating/k8s_attributes.h | 234 +++ .../semconv/incubating/k8s_metrics.h | 273 ++++ .../semconv/incubating/linux_attributes.h | 43 + .../semconv/incubating/log_attributes.h | 82 ++ .../semconv/incubating/message_attributes.h | 74 + .../semconv/incubating/messaging_attributes.h | 543 +++++++ .../semconv/incubating/messaging_metrics.h | 449 ++++++ .../semconv/incubating/net_attributes.h | 209 +++ .../semconv/incubating/network_attributes.h | 308 ++++ .../semconv/incubating/oci_attributes.h | 36 + .../incubating/opentracing_attributes.h | 45 + .../semconv/incubating/os_attributes.h | 110 ++ .../semconv/incubating/otel_attributes.h | 77 + .../semconv/incubating/other_attributes.h | 47 + .../semconv/incubating/peer_attributes.h | 31 + .../semconv/incubating/pool_attributes.h | 33 + .../semconv/incubating/process_attributes.h | 264 ++++ .../semconv/incubating/process_metrics.h | 454 ++++++ .../semconv/incubating/profile_attributes.h | 81 ++ .../semconv/incubating/rpc_attributes.h | 355 +++++ .../semconv/incubating/rpc_metrics.h | 312 ++++ .../semconv/incubating/server_attributes.h | 41 + .../semconv/incubating/service_attributes.h | 84 ++ .../semconv/incubating/session_attributes.h | 34 + .../semconv/incubating/source_attributes.h | 37 + .../semconv/incubating/system_attributes.h | 383 +++++ .../semconv/incubating/system_metrics.h | 1284 +++++++++++++++++ .../semconv/incubating/telemetry_attributes.h | 125 ++ .../semconv/incubating/test_attributes.h | 93 ++ .../semconv/incubating/thread_attributes.h | 34 + .../semconv/incubating/tls_attributes.h | 221 +++ .../semconv/incubating/url_attributes.h | 137 ++ .../incubating/user_agent_attributes.h | 51 + .../semconv/incubating/user_attributes.h | 57 + .../semconv/incubating/vcs_attributes.h | 86 ++ .../semconv/incubating/webengine_attributes.h | 39 + .../semconv/network_attributes.h | 120 ++ .../opentelemetry/semconv/otel_attributes.h | 59 + .../opentelemetry/semconv/schema_url.h | 24 + .../opentelemetry/semconv/server_attributes.h | 41 + .../semconv/service_attributes.h | 41 + .../semconv/telemetry_attributes.h | 111 ++ .../opentelemetry/semconv/url_attributes.h | 66 + .../semconv/user_agent_attributes.h | 30 + .../opentelemetry/trace/default_span.h | 4 +- .../trace/propagation/http_trace_context.h | 42 +- .../opentelemetry/trace/propagation/jaeger.h | 6 +- .../trace/semantic_conventions.h | 10 +- .../include/opentelemetry/trace/trace_state.h | 3 +- .../api/include/opentelemetry/version.h | 4 +- .../opentelemetry-cpp/api/test/CMakeLists.txt | 5 +- .../api/test/common/spinlock_benchmark.cc | 6 +- .../api/test/common/string_util_test.cc | 8 +- .../api/test/trace/propagation/CMakeLists.txt | 16 +- .../api/test/trace/propagation/detail/BUILD | 16 + .../trace/propagation/detail/CMakeLists.txt | 2 +- .../trace/propagation/detail/string_test.cc | 62 + .../elasticsearch/es_log_recordable.h | 16 +- .../src/es_log_record_exporter.cc | 12 +- .../elasticsearch/src/es_log_recordable.cc | 105 +- .../test/es_log_record_exporter_test.cc | 92 +- .../opentelemetry-cpp/exporters/etw/README.md | 214 +-- .../memory/src/in_memory_metric_data.cc | 7 +- .../src/in_memory_metric_exporter_factory.cc | 7 +- .../memory/test/in_memory_metric_data_test.cc | 8 +- deps/opentelemetry-cpp/exporters/otlp/BUILD | 2 + .../exporters/otlp/CMakeLists.txt | 8 +- .../exporters/otlp/otlp_grpc_client.h | 55 +- .../exporters/otlp/otlp_grpc_client_factory.h | 36 + .../exporters/otlp/otlp_grpc_exporter.h | 40 +- .../otlp/otlp_grpc_exporter_factory.h | 10 + .../otlp/otlp_grpc_log_record_exporter.h | 43 +- .../otlp_grpc_log_record_exporter_factory.h | 12 +- .../otlp/otlp_grpc_metric_exporter.h | 42 +- .../otlp/otlp_grpc_metric_exporter_factory.h | 12 +- .../exporters/otlp/src/otlp_grpc_client.cc | 170 ++- .../otlp/src/otlp_grpc_client_factory.cc | 27 + .../exporters/otlp/src/otlp_grpc_exporter.cc | 108 +- .../otlp/src/otlp_grpc_exporter_factory.cc | 9 + .../otlp/src/otlp_grpc_log_record_exporter.cc | 113 +- .../otlp_grpc_log_record_exporter_factory.cc | 9 + .../otlp/src/otlp_grpc_metric_exporter.cc | 110 +- .../src/otlp_grpc_metric_exporter_factory.cc | 9 + .../exporters/otlp/src/otlp_http_client.cc | 1 + .../exporters/otlp/src/otlp_metric_utils.cc | 2 + .../test/otlp_grpc_exporter_factory_test.cc | 22 + ...p_grpc_log_record_exporter_factory_test.cc | 24 + .../otlp_grpc_log_record_exporter_test.cc | 132 ++ .../otlp_grpc_metric_exporter_factory_test.cc | 24 + .../otlp/test/otlp_log_recordable_test.cc | 1 - .../exporters/prometheus/exporter_options.h | 6 + .../exporters/prometheus/exporter_utils.h | 12 +- .../prometheus/src/exporter_options.cc | 25 +- .../prometheus/src/exporter_utils.cc | 67 +- .../prometheus/test/exporter_utils_test.cc | 94 +- .../exporters/zipkin/src/recordable.cc | 6 +- .../ext/http/client/curl/http_client_curl.h | 3 + .../http/client/curl/http_operation_curl.h | 11 +- .../ext/http/client/http_client.h | 2 + .../ext/http/common/url_parser.h | 92 +- .../ext/http/server/http_server.h | 10 +- .../ext/src/http/client/curl/CMakeLists.txt | 5 + .../src/http/client/curl/http_client_curl.cc | 10 +- .../http/client/curl/http_operation_curl.cc | 91 +- .../opentelemetry-cpp/ext/test/CMakeLists.txt | 2 +- .../ext/test/http/CMakeLists.txt | 6 +- .../ext/test/http/url_parser_test.cc | 312 ++-- .../BUILD | 2 +- .../CMakeLists.txt | 7 +- .../Dockerfile | 0 .../README.md | 13 +- .../main.cc | 52 +- deps/opentelemetry-cpp/otlp-http-exporter.gyp | 1 + .../sdk/common/empty_attributes.h | 6 +- .../metrics/aggregation/default_aggregation.h | 1 + .../opentelemetry/sdk/metrics/instruments.h | 1 + .../include/opentelemetry/sdk/metrics/meter.h | 12 + .../sdk/metrics/sync_instruments.h | 34 + .../sdk/resource/semantic_conventions.h | 10 +- .../opentelemetry/sdk/trace/span_data.h | 2 +- .../opentelemetry/sdk/version/version.h | 2 +- .../sdk/src/common/CMakeLists.txt | 2 +- deps/opentelemetry-cpp/sdk/src/logs/BUILD | 1 - deps/opentelemetry-cpp/sdk/src/metrics/BUILD | 1 - .../sdk/src/metrics/meter.cc | 44 + .../sdk/src/metrics/state/metric_collector.cc | 13 +- .../sdk/src/metrics/sync_instruments.cc | 121 ++ deps/opentelemetry-cpp/sdk/src/resource/BUILD | 1 - .../sdk/src/resource/resource.cc | 16 +- .../sdk/src/resource/resource_detector.cc | 4 +- .../sdk/src/version/version.cc | 8 +- .../sdk/test/metrics/CMakeLists.txt | 1 + .../sdk/test/metrics/sync_instruments_test.cc | 39 + .../metrics/sync_metric_storage_gauge_test.cc | 189 +++ .../sdk/test/resource/resource_test.cc | 30 +- .../profiles_service.proto | 12 +- .../profiles_service_http.yaml | 4 +- .../proto/metrics/v1/metrics.proto | 27 +- .../profiles.proto} | 327 +++-- .../profiles/v1experimental/profiles.proto | 191 --- deps/opentelemetry-cpp/third_party_release | 4 +- 206 files changed, 16890 insertions(+), 1555 deletions(-) create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/client_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/error_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/exception_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/artifact_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/aws_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/az_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/browser_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cicd_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/client_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloud_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/code_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cpu_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/deployment_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/destination_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/device_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/disk_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/enduser_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/error_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/event_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/exception_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/file_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gcp_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/graphql_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/heroku_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/host_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/linux_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/log_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/message_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/net_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/network_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/oci_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/os_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/otel_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/other_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/peer_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/pool_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/profile_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/server_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/service_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/session_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/source_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_metrics.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/test_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/thread_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/tls_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/url_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/vcs_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/webengine_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/network_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/otel_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/schema_url.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/server_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/service_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/telemetry_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/url_attributes.h create mode 100644 deps/opentelemetry-cpp/api/include/opentelemetry/semconv/user_agent_attributes.h create mode 100644 deps/opentelemetry-cpp/api/test/trace/propagation/detail/string_test.cc create mode 100644 deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h create mode 100644 deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client_factory.cc rename deps/opentelemetry-cpp/ext/test/{w3c_tracecontext_test => w3c_tracecontext_http_test_server}/BUILD (92%) rename deps/opentelemetry-cpp/ext/test/{w3c_tracecontext_test => w3c_tracecontext_http_test_server}/CMakeLists.txt (66%) rename deps/opentelemetry-cpp/ext/test/{w3c_tracecontext_test => w3c_tracecontext_http_test_server}/Dockerfile (100%) rename deps/opentelemetry-cpp/ext/test/{w3c_tracecontext_test => w3c_tracecontext_http_test_server}/README.md (80%) rename deps/opentelemetry-cpp/ext/test/{w3c_tracecontext_test => w3c_tracecontext_http_test_server}/main.cc (86%) create mode 100644 deps/opentelemetry-cpp/sdk/test/metrics/sync_metric_storage_gauge_test.cc rename deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/{v1experimental => v1development}/profiles_service.proto (91%) rename deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/{v1experimental => v1development}/profiles_service_http.yaml (63%) rename deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/{v1experimental/pprofextended.proto => v1development/profiles.proto} (56%) delete mode 100644 deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto diff --git a/deps/opentelemetry-cpp/.bazelrc b/deps/opentelemetry-cpp/.bazelrc index f1693476474..57cd0a2fa0c 100644 --- a/deps/opentelemetry-cpp/.bazelrc +++ b/deps/opentelemetry-cpp/.bazelrc @@ -7,6 +7,9 @@ # Enable automatic configs based on platform common --enable_platform_specific_config +# Make globs that don't match anything fail +common --incompatible_disallow_empty_glob + # Needed by gRPC to build on some platforms. build --copt -DGRPC_BAZEL_BUILD diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/common/spin_lock_mutex.h b/deps/opentelemetry-cpp/api/include/opentelemetry/common/spin_lock_mutex.h index 369183b953b..7031fa4d23f 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/common/spin_lock_mutex.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/common/spin_lock_mutex.h @@ -68,8 +68,10 @@ class SpinLockMutex # else __builtin_ia32_pause(); # endif -#elif defined(__arm__) - __asm__ volatile("yield" ::: "memory"); +#elif defined(__armel__) || defined(__ARMEL__) + asm volatile("nop" ::: "memory"); +#elif defined(__arm__) || defined(__aarch64__) // arm big endian / arm64 + __asm__ __volatile__("yield" ::: "memory"); #else // TODO: Issue PAGE/YIELD on other architectures. #endif diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/common/string_util.h b/deps/opentelemetry-cpp/api/include/opentelemetry/common/string_util.h index a7070a0acde..273a65272ba 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/common/string_util.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/common/string_util.h @@ -15,11 +15,11 @@ class StringUtil public: static nostd::string_view Trim(nostd::string_view str, size_t left, size_t right) noexcept { - while (left <= right && str[static_cast(left)] == ' ') + while (left <= right && isspace(str[left])) { left++; } - while (left <= right && str[static_cast(right)] == ' ') + while (left <= right && isspace(str[right])) { right--; } diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/event_logger.h b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/event_logger.h index b5c94a7067f..d3049953bc3 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/event_logger.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/event_logger.h @@ -65,9 +65,8 @@ class EventLogger } nostd::unique_ptr log_record = delegate_logger->CreateLogRecord(); - IgnoreTraitResult( - detail::LogRecordSetterTrait::type>::template Set( - log_record.get(), std::forward(args))...); + IgnoreTraitResult(detail::LogRecordSetterTrait::type>::Set( + log_record.get(), std::forward(args))...); EmitEvent(event_name, std::move(log_record)); } diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger.h b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger.h index dc09a0c2b47..519516f2979 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger.h @@ -72,9 +72,8 @@ class Logger return; } - IgnoreTraitResult( - detail::LogRecordSetterTrait::type>::template Set( - log_record.get(), std::forward(args))...); + IgnoreTraitResult(detail::LogRecordSetterTrait::type>::Set( + log_record.get(), std::forward(args))...); EmitLogRecord(std::move(log_record)); } diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger_type_traits.h b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger_type_traits.h index 486135137d5..d88a6ffbdc6 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger_type_traits.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/logs/logger_type_traits.h @@ -166,8 +166,8 @@ struct LogRecordSetterTrait * = nullptr> inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept { - return LogRecordSetterTrait::template Set( - log_record, std::forward(arg)); + return LogRecordSetterTrait::Set(log_record, + std::forward(arg)); } template class UpDownCounter; +template +class Gauge; + class ObservableInstrument; /** @@ -91,6 +94,27 @@ class Meter nostd::string_view description = "", nostd::string_view unit = "") noexcept = 0; +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + /** + * Creates a Gauge with the passed characteristics and returns a unique_ptr to that Gauge. + * + * @param name the name of the new Gauge. + * @param description a brief description of what the Gauge is used for. + * @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html. + * @return a unique pointer to the created Gauge. + */ + + virtual nostd::unique_ptr> CreateInt64Gauge( + nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept = 0; + + virtual nostd::unique_ptr> CreateDoubleGauge( + nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept = 0; +#endif + /** * Creates a Asynchronous (Observable) Gauge with the passed characteristics and returns a * shared_ptr to that Observable Gauge diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/noop.h b/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/noop.h index d34a0e681b6..1d508b93877 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/noop.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/noop.h @@ -71,6 +71,26 @@ class NoopUpDownCounter : public UpDownCounter {} }; +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +template +class NoopGauge : public Gauge +{ +public: + NoopGauge(nostd::string_view /* name */, + nostd::string_view /* description */, + nostd::string_view /* unit */) noexcept + {} + ~NoopGauge() override = default; + void Record(T /* value */) noexcept override {} + void Record(T /* value */, const context::Context & /* context */) noexcept override {} + void Record(T /* value */, const common::KeyValueIterable & /* attributes */) noexcept override {} + void Record(T /* value */, + const common::KeyValueIterable & /* attributes */, + const context::Context & /* context */) noexcept override + {} +}; +#endif + class NoopObservableInstrument : public ObservableInstrument { public: @@ -140,6 +160,22 @@ class NoopMeter final : public Meter return nostd::unique_ptr>{new NoopHistogram(name, description, unit)}; } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + nostd::unique_ptr> CreateInt64Gauge(nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept override + { + return nostd::unique_ptr>{new NoopGauge(name, description, unit)}; + } + + nostd::unique_ptr> CreateDoubleGauge(nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept override + { + return nostd::unique_ptr>{new NoopGauge(name, description, unit)}; + } +#endif + nostd::shared_ptr CreateInt64ObservableGauge( nostd::string_view name, nostd::string_view description = "", diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/sync_instruments.h b/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/sync_instruments.h index 44716774338..9eaec3352f2 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/sync_instruments.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/metrics/sync_instruments.h @@ -247,5 +247,82 @@ class UpDownCounter : public SynchronousInstrument } }; +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +/* A Gauge instrument that records values. */ +template +class Gauge : public SynchronousInstrument +{ + +public: + /** + * Record a value + * + * @param value The measurement value. May be positive, negative or zero. + */ + virtual void Record(T value) noexcept = 0; + + /** + * Record a value + * + * @param value The measurement value. May be positive, negative or zero. + * @param context The explicit context to associate with this measurement. + */ + virtual void Record(T value, const context::Context &context) noexcept = 0; + + /** + * Record a value with a set of attributes. + * + * @param value The measurement value. May be positive, negative or zero. + * @param attributes A set of attributes to associate with the value. + */ + + virtual void Record(T value, const common::KeyValueIterable &attributes) noexcept = 0; + + /** + * Record a value with a set of attributes. + * + * @param value The measurement value. May be positive, negative or zero. + * @param attributes A set of attributes to associate with the value. + * @param context The explicit context to associate with this measurement. + */ + virtual void Record(T value, + const common::KeyValueIterable &attributes, + const context::Context &context) noexcept = 0; + + template ::value> * = nullptr> + void Record(T value, const U &attributes) noexcept + { + this->Record(value, common::KeyValueIterableView{attributes}); + } + + template ::value> * = nullptr> + void Record(T value, const U &attributes, const context::Context &context) noexcept + { + this->Record(value, common::KeyValueIterableView{attributes}, context); + } + + void Record(T value, + std::initializer_list> + attributes) noexcept + { + this->Record(value, nostd::span>{ + attributes.begin(), attributes.end()}); + } + + void Record( + T value, + std::initializer_list> attributes, + const context::Context &context) noexcept + { + this->Record(value, + nostd::span>{ + attributes.begin(), attributes.end()}, + context); + } +}; +#endif + } // namespace metrics OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/README.md b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/README.md index 6a408557046..5dd661971f5 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/README.md +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/README.md @@ -1,4 +1,4 @@ # Notes on Abseil Variant implementation -This is a snapshot of Abseil Variant `absl::variant` from Abseil -`v2020-03-03#8`. +This is a snapshot of Abseil Variant +`absl::OTABSL_OPTION_NAMESPACE_NAME::variant` from Abseil `v2020-03-03#8`. diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/config.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/config.h index 3f78df3d985..e0836b9b3f9 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/config.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/config.h @@ -84,7 +84,7 @@ // namespace absl { // OTABSL_NAMESPACE_BEGIN // -// void Foo(); // absl::Foo(). +// void Foo(); // absl::OTABSL_OPTION_NAMESPACE_NAME::Foo(). // // OTABSL_NAMESPACE_END // } // namespace absl @@ -94,40 +94,32 @@ // not support forward declarations of its own types, nor does it support // user-provided specialization of Abseil templates. Code that violates these // rules may be broken without warning.) -#if !defined(OTABSL_OPTION_USE_INLINE_NAMESPACE) || \ - !defined(OTABSL_OPTION_INLINE_NAMESPACE_NAME) +#if !defined(OTABSL_OPTION_NAMESPACE_NAME) #error options.h is misconfigured. #endif -// Check that OTABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor "" -#if defined(__cplusplus) && OTABSL_OPTION_USE_INLINE_NAMESPACE == 1 +// Check that OTABSL_OPTION_NAMESPACE_NAME is neither "head" nor "" +#if defined(__cplusplus) #define OTABSL_INTERNAL_INLINE_NAMESPACE_STR \ - OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME) + OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME) static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0', - "options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must " + "options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must " "not be empty."); static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || OTABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' || OTABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' || OTABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' || OTABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0', - "options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must " + "options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must " "be changed to a new, unique identifier name."); #endif -#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0 -#define OTABSL_NAMESPACE_BEGIN -#define OTABSL_NAMESPACE_END -#elif OTABSL_OPTION_USE_INLINE_NAMESPACE == 1 -#define OTABSL_NAMESPACE_BEGIN \ - inline namespace OTABSL_OPTION_INLINE_NAMESPACE_NAME { + +#define OTABSL_NAMESPACE_BEGIN namespace OTABSL_OPTION_NAMESPACE_NAME { #define OTABSL_NAMESPACE_END } -#else -#error options.h is misconfigured. -#endif // ----------------------------------------------------------------------------- // Compiler Feature Checks @@ -217,7 +209,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // OTABSL_HAVE_SOURCE_LOCATION_CURRENT // -// Indicates whether `absl::SourceLocation::current()` will return useful +// Indicates whether `absl::OTABSL_OPTION_NAMESPACE_NAME::SourceLocation::current()` will return useful // information in some contexts. #ifndef OTABSL_HAVE_SOURCE_LOCATION_CURRENT #if OTABSL_INTERNAL_HAS_KEYWORD(__builtin_LINE) && \ @@ -570,7 +562,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // OTABSL_USES_STD_ANY // -// Indicates whether absl::any is an alias for std::any. +// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::any is an alias for std::any. #if !defined(OTABSL_OPTION_USE_STD_ANY) #error options.h is misconfigured. #elif OTABSL_OPTION_USE_STD_ANY == 0 || \ @@ -585,7 +577,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // OTABSL_USES_STD_OPTIONAL // -// Indicates whether absl::optional is an alias for std::optional. +// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::optional is an alias for std::optional. #if !defined(OTABSL_OPTION_USE_STD_OPTIONAL) #error options.h is misconfigured. #elif OTABSL_OPTION_USE_STD_OPTIONAL == 0 || \ @@ -600,7 +592,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // OTABSL_USES_STD_VARIANT // -// Indicates whether absl::variant is an alias for std::variant. +// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::variant is an alias for std::variant. #if !defined(OTABSL_OPTION_USE_STD_VARIANT) #error options.h is misconfigured. #elif OTABSL_OPTION_USE_STD_VARIANT == 0 || \ @@ -615,7 +607,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // OTABSL_USES_STD_STRING_VIEW // -// Indicates whether absl::string_view is an alias for std::string_view. +// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::string_view is an alias for std::string_view. #if !defined(OTABSL_OPTION_USE_STD_STRING_VIEW) #error options.h is misconfigured. #elif OTABSL_OPTION_USE_STD_STRING_VIEW == 0 || \ @@ -650,15 +642,10 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // the proper count to skip past the CCTZ fork namespace names. (This number // is one larger when there is an inline namespace name to skip.) #if defined(_MSC_VER) -#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0 -#define OTABSL_INTERNAL_MANGLED_NS "absl" -#define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "5" -#else #define OTABSL_INTERNAL_MANGLED_NS \ - OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl" + OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME) "@absl" #define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "6" #endif -#endif #undef OTABSL_INTERNAL_HAS_KEYWORD diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h index 9d024a2d91e..dd66e9f223f 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h @@ -68,7 +68,7 @@ // types, etc.. #if defined(__clang__) #define OTABSL_INTERNAL_EXTERN_DECL(type, name) \ - extern const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t name; + extern const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t name; #else // Otherwise, just define the macro to do nothing. #define OTABSL_INTERNAL_EXTERN_DECL(type, name) #endif // defined(__clang__) @@ -76,7 +76,7 @@ // See above comment at top of file for details. #define OTABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \ OTABSL_INTERNAL_EXTERN_DECL(type, name) \ - inline constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t name = init + inline constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t name = init #else @@ -89,14 +89,14 @@ #define OTABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \ template \ struct AbslInternalInlineVariableHolder##name { \ - static constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t kInstance = init; \ + static constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t kInstance = init; \ }; \ \ template \ - constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t \ + constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t \ AbslInternalInlineVariableHolder##name::kInstance; \ \ - static constexpr const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t& \ + static constexpr const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t& \ name = /* NOLINT */ \ AbslInternalInlineVariableHolder##name<>::kInstance; \ static_assert(sizeof(void (*)(decltype(name))) != 0, \ diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h index 99c37ba24ad..c37f43cfc89 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// absl::base_internal::Invoke(f, args...) is an implementation of +// absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke(f, args...) is an implementation of // INVOKE(f, args...) from section [func.require] of the C++ standard. // // [func.require] @@ -73,7 +73,7 @@ struct MemFunAndRef : StrippedAccept { template struct AcceptImpl : std::integral_constant::value && - absl::is_function::value> { + absl::OTABSL_OPTION_NAMESPACE_NAME::is_function::value> { }; template @@ -94,7 +94,7 @@ struct MemFunAndPtr : StrippedAccept { template struct AcceptImpl : std::integral_constant::value && - absl::is_function::value> { + absl::OTABSL_OPTION_NAMESPACE_NAME::is_function::value> { }; template @@ -116,7 +116,7 @@ struct DataMemAndRef : StrippedAccept { template struct AcceptImpl : std::integral_constant::value && - !absl::is_function::value> {}; + !absl::OTABSL_OPTION_NAMESPACE_NAME::is_function::value> {}; template static decltype(std::declval().*std::declval()) Invoke( @@ -134,7 +134,7 @@ struct DataMemAndPtr : StrippedAccept { template struct AcceptImpl : std::integral_constant::value && - !absl::is_function::value> {}; + !absl::OTABSL_OPTION_NAMESPACE_NAME::is_function::value> {}; template static decltype((*std::declval()).*std::declval()) Invoke( diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/macros.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/macros.h index 7b4f427d30f..707c375ed10 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/macros.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/macros.h @@ -41,7 +41,7 @@ // can be used in defining new arrays. If you use this macro on a pointer by // mistake, you will get a compile-time error. #define OTABSL_ARRAYSIZE(array) \ - (sizeof(::absl::macros_internal::ArraySizeHelper(array))) + (sizeof(::absl::OTABSL_OPTION_NAMESPACE_NAME::macros_internal::ArraySizeHelper(array))) namespace absl { OTABSL_NAMESPACE_BEGIN @@ -60,7 +60,7 @@ OTABSL_NAMESPACE_END // static storage duration, and that the constructor should do nothing to its // state. Use of this macro indicates to the reader that it is legal to // declare a static instance of the class, provided the constructor is given -// the absl::base_internal::kLinkerInitialized argument. +// the absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized argument. // // Normally, it is unsafe to declare a static variable that has a constructor or // a destructor because invocation order is undefined. However, if the type can @@ -70,10 +70,10 @@ OTABSL_NAMESPACE_END // // Example: // // Declaration -// explicit MyClass(absl::base_internal:LinkerInitialized x) {} +// explicit MyClass(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal:LinkerInitialized x) {} // // // Invocation -// static MyClass my_global(absl::base_internal::kLinkerInitialized); +// static MyClass my_global(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized); namespace absl { OTABSL_NAMESPACE_BEGIN namespace base_internal { diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/options.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/options.h index 3632b74f64a..26665b151e8 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/options.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/base/options.h @@ -79,7 +79,7 @@ // // OTABSL_OPTION_USE_STD_ANY // -// This option controls whether absl::any is implemented as an alias to +// This option controls whether absl::OTABSL_OPTION_NAMESPACE_NAME::any is implemented as an alias to // std::any, or as an independent implementation. // // A value of 0 means to use Abseil's implementation. This requires only C++11 @@ -93,19 +93,19 @@ // useful when you are building your entire program, including all of its // dependencies, from source. It should not be used otherwise -- for example, // if you are distributing Abseil in a binary package manager -- since in -// mode 2, absl::any will name a different type, with a different mangled name +// mode 2, absl::OTABSL_OPTION_NAMESPACE_NAME::any will name a different type, with a different mangled name // and binary layout, depending on the compiler flags passed by the end user. // For more info, see https://abseil.io/about/design/dropin-types. // // User code should not inspect this macro. To check in the preprocessor if -// absl::any is a typedef of std::any, use the feature macro OTABSL_USES_STD_ANY. +// absl::OTABSL_OPTION_NAMESPACE_NAME::any is a typedef of std::any, use the feature macro OTABSL_USES_STD_ANY. #define OTABSL_OPTION_USE_STD_ANY 0 // OTABSL_OPTION_USE_STD_OPTIONAL // -// This option controls whether absl::optional is implemented as an alias to +// This option controls whether absl::OTABSL_OPTION_NAMESPACE_NAME::optional is implemented as an alias to // std::optional, or as an independent implementation. // // A value of 0 means to use Abseil's implementation. This requires only C++11 @@ -118,13 +118,13 @@ // and use an alias only if a working std::optional is available. This option // is useful when you are building your program from source. It should not be // used otherwise -- for example, if you are distributing Abseil in a binary -// package manager -- since in mode 2, absl::optional will name a different +// package manager -- since in mode 2, absl::OTABSL_OPTION_NAMESPACE_NAME::optional will name a different // type, with a different mangled name and binary layout, depending on the // compiler flags passed by the end user. For more info, see // https://abseil.io/about/design/dropin-types. // User code should not inspect this macro. To check in the preprocessor if -// absl::optional is a typedef of std::optional, use the feature macro +// absl::OTABSL_OPTION_NAMESPACE_NAME::optional is a typedef of std::optional, use the feature macro // OTABSL_USES_STD_OPTIONAL. #define OTABSL_OPTION_USE_STD_OPTIONAL 0 @@ -132,7 +132,7 @@ // OTABSL_OPTION_USE_STD_STRING_VIEW // -// This option controls whether absl::string_view is implemented as an alias to +// This option controls whether absl::OTABSL_OPTION_NAMESPACE_NAME::string_view is implemented as an alias to // std::string_view, or as an independent implementation. // // A value of 0 means to use Abseil's implementation. This requires only C++11 @@ -145,20 +145,20 @@ // and use an alias only if a working std::string_view is available. This // option is useful when you are building your program from source. It should // not be used otherwise -- for example, if you are distributing Abseil in a -// binary package manager -- since in mode 2, absl::string_view will name a +// binary package manager -- since in mode 2, absl::OTABSL_OPTION_NAMESPACE_NAME::string_view will name a // different type, with a different mangled name and binary layout, depending on // the compiler flags passed by the end user. For more info, see // https://abseil.io/about/design/dropin-types. // // User code should not inspect this macro. To check in the preprocessor if -// absl::string_view is a typedef of std::string_view, use the feature macro +// absl::OTABSL_OPTION_NAMESPACE_NAME::string_view is a typedef of std::string_view, use the feature macro // OTABSL_USES_STD_STRING_VIEW. #define OTABSL_OPTION_USE_STD_STRING_VIEW 0 // OTABSL_OPTION_USE_STD_VARIANT // -// This option controls whether absl::variant is implemented as an alias to +// This option controls whether absl::OTABSL_OPTION_NAMESPACE_NAME::variant is implemented as an alias to // std::variant, or as an independent implementation. // // A value of 0 means to use Abseil's implementation. This requires only C++11 @@ -171,41 +171,23 @@ // and use an alias only if a working std::variant is available. This option // is useful when you are building your program from source. It should not be // used otherwise -- for example, if you are distributing Abseil in a binary -// package manager -- since in mode 2, absl::variant will name a different +// package manager -- since in mode 2, absl::OTABSL_OPTION_NAMESPACE_NAME::variant will name a different // type, with a different mangled name and binary layout, depending on the // compiler flags passed by the end user. For more info, see // https://abseil.io/about/design/dropin-types. // // User code should not inspect this macro. To check in the preprocessor if -// absl::variant is a typedef of std::variant, use the feature macro +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant is a typedef of std::variant, use the feature macro // OTABSL_USES_STD_VARIANT. #define OTABSL_OPTION_USE_STD_VARIANT 0 -// OTABSL_OPTION_USE_INLINE_NAMESPACE -// OTABSL_OPTION_INLINE_NAMESPACE_NAME +// OTABSL_OPTION_NAMESPACE_NAME // -// These options controls whether all entities in the absl namespace are -// contained within an inner inline namespace. This does not affect the -// user-visible API of Abseil, but it changes the mangled names of all symbols. -// -// This can be useful as a version tag if you are distributing Abseil in -// precompiled form. This will prevent a binary library build of Abseil with -// one inline namespace being used with headers configured with a different -// inline namespace name. Binary packagers are reminded that Abseil does not -// guarantee any ABI stability in Abseil, so any update of Abseil or -// configuration change in such a binary package should be combined with a -// new, unique value for the inline namespace name. -// -// A value of 0 means not to use inline namespaces. -// -// A value of 1 means to use an inline namespace with the given name inside -// namespace absl. If this is set, OTABSL_OPTION_INLINE_NAMESPACE_NAME must also -// be changed to a new, unique identifier name. In particular "head" is not -// allowed. +// All codes in otabsl are under OTABSL_OPTION_NAMESPACE_NAME, we do not use inline namespace to avoid +// conlict with external Abseil. -#define OTABSL_OPTION_USE_INLINE_NAMESPACE 1 -#define OTABSL_OPTION_INLINE_NAMESPACE_NAME otel_v1 +#define OTABSL_OPTION_NAMESPACE_NAME otel_v1 #endif // OTABSL_BASE_OPTIONS_H_ diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h index 00c90f82d15..dbd03488714 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h @@ -81,43 +81,31 @@ struct IsTriviallyMoveConstructibleObject : std::integral_constant< bool, std::is_move_constructible< type_traits_internal::SingleMemberUnion>::value && - absl::is_trivially_destructible::value> {}; + absl::OTABSL_OPTION_NAMESPACE_NAME::is_trivially_destructible::value> {}; template struct IsTriviallyCopyConstructibleObject : std::integral_constant< bool, std::is_copy_constructible< type_traits_internal::SingleMemberUnion>::value && - absl::is_trivially_destructible::value> {}; + absl::OTABSL_OPTION_NAMESPACE_NAME::is_trivially_destructible::value> {}; template struct IsTriviallyMoveAssignableReference : std::false_type {}; template struct IsTriviallyMoveAssignableReference - : absl::is_trivially_move_assignable::type {}; + : absl::OTABSL_OPTION_NAMESPACE_NAME::is_trivially_move_assignable::type {}; template struct IsTriviallyMoveAssignableReference - : absl::is_trivially_move_assignable::type {}; + : absl::OTABSL_OPTION_NAMESPACE_NAME::is_trivially_move_assignable::type {}; template struct VoidTImpl { using type = void; }; -// This trick to retrieve a default alignment is necessary for our -// implementation of aligned_storage_t to be consistent with any implementation -// of std::aligned_storage. -template > -struct default_alignment_of_aligned_storage; - -template -struct default_alignment_of_aligned_storage> { - static constexpr size_t value = Align; -}; - //////////////////////////////// // Library Fundamentals V2 TS // //////////////////////////////// @@ -203,7 +191,7 @@ struct is_move_assignable : type_traits_internal::is_detected< // This metafunction is designed to be a drop-in replacement for the C++17 // `std::void_t` metafunction. // -// NOTE: `absl::void_t` does not use the standard-specified implementation so +// NOTE: `absl::OTABSL_OPTION_NAMESPACE_NAME::void_t` does not use the standard-specified implementation so // that it can remain compatible with gcc < 5.1. This can introduce slightly // different behavior, such as when ordering partial specializations. template @@ -505,7 +493,7 @@ struct is_trivially_copy_assignable #else : std::integral_constant< bool, __has_trivial_assign(typename std::remove_reference::type) && - absl::is_copy_assignable::value> { + absl::OTABSL_OPTION_NAMESPACE_NAME::is_copy_assignable::value> { #endif #ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE private: @@ -549,8 +537,8 @@ class is_trivially_copyable_impl { std::is_copy_constructible::value || std::is_move_constructible::value; static constexpr bool kIsCopyOrMoveAssignable = - absl::is_copy_assignable::value || - absl::is_move_assignable::value; + absl::OTABSL_OPTION_NAMESPACE_NAME::is_copy_assignable::value || + absl::OTABSL_OPTION_NAMESPACE_NAME::is_move_assignable::value; public: static constexpr bool kValue = @@ -619,10 +607,6 @@ using remove_extent_t = typename std::remove_extent::type; template using remove_all_extents_t = typename std::remove_all_extents::type; -template ::value> -using aligned_storage_t = typename std::aligned_storage::type; - template using decay_t = typename std::decay::type; @@ -677,7 +661,7 @@ struct IsHashable : std::false_type {}; template struct IsHashable< Key, - absl::enable_if_t&>()(std::declval())), std::size_t>::value>> : std::true_type {}; #endif // !OTABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ @@ -703,7 +687,7 @@ struct AssertHashEnabledHelper { static_assert( std::is_copy_constructible>::value, "std::hash must be copy constructible when it is enabled"); - static_assert(absl::is_copy_assignable>::value, + static_assert(absl::OTABSL_OPTION_NAMESPACE_NAME::is_copy_assignable>::value, "std::hash must be copy assignable when it is enabled"); // is_destructible is unchecked as it's implied by each of the // is_constructible checks. @@ -733,7 +717,7 @@ namespace swap_internal { // Necessary for the traits. using std::swap; -// This declaration prevents global `swap` and `absl::swap` overloads from being +// This declaration prevents global `swap` and `absl::OTABSL_OPTION_NAMESPACE_NAME::swap` overloads from being // considered unless ADL picks them up. void swap(); @@ -752,7 +736,7 @@ using IsNothrowSwappableImpl = typename std::enable_if::type; // arguments of type `T`. template struct IsSwappable - : absl::type_traits_internal::is_detected {}; + : absl::OTABSL_OPTION_NAMESPACE_NAME::type_traits_internal::is_detected {}; // IsNothrowSwappable // @@ -760,13 +744,13 @@ struct IsSwappable // arguments of type `T` and is noexcept. template struct IsNothrowSwappable - : absl::type_traits_internal::is_detected {}; + : absl::OTABSL_OPTION_NAMESPACE_NAME::type_traits_internal::is_detected {}; // Swap() // // Performs the swap idiom from a namespace where valid candidates may only be // found in `std` or via ADL. -template ::value, int> = 0> +template ::value, int> = 0> void Swap(T& lhs, T& rhs) noexcept(IsNothrowSwappable::value) { swap(lhs, rhs); } diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h index 81caa0d75c2..89fe750dbd0 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h @@ -16,7 +16,7 @@ // bad_variant_access.h // ----------------------------------------------------------------------------- // -// This header file defines the `absl::bad_variant_access` type. +// This header file defines the `absl::OTABSL_OPTION_NAMESPACE_NAME::bad_variant_access` type. #ifndef OTABSL_TYPES_BAD_VARIANT_ACCESS_H_ #define OTABSL_TYPES_BAD_VARIANT_ACCESS_H_ @@ -44,21 +44,21 @@ OTABSL_NAMESPACE_BEGIN // bad_variant_access // ----------------------------------------------------------------------------- // -// An `absl::bad_variant_access` type is an exception type that is thrown in +// An `absl::OTABSL_OPTION_NAMESPACE_NAME::bad_variant_access` type is an exception type that is thrown in // the following cases: // -// * Calling `absl::get(absl::variant) with an index or type that does not +// * Calling `absl::OTABSL_OPTION_NAMESPACE_NAME::get(absl::OTABSL_OPTION_NAMESPACE_NAME::variant) with an index or type that does not // match the currently selected alternative type -// * Calling `absl::visit on an `absl::variant` that is in the +// * Calling `absl::OTABSL_OPTION_NAMESPACE_NAME::visit on an `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` that is in the // `variant::valueless_by_exception` state. // // Example: // -// absl::variant v; +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant v; // v = 1; // try { -// absl::get(v); -// } catch(const absl::bad_variant_access& e) { +// absl::OTABSL_OPTION_NAMESPACE_NAME::get(v); +// } catch(const absl::OTABSL_OPTION_NAMESPACE_NAME::bad_variant_access& e) { // std::cout << "Bad variant access: " << e.what() << '\n'; // } class bad_variant_access : public std::exception { diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h index ee42da7c930..fc73cf5328b 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h @@ -136,24 +136,24 @@ struct VariantAccessResultImpl; template class Variantemplate, class... T> struct VariantAccessResultImpl&> { - using type = typename absl::variant_alternative>::type&; + using type = typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type&; }; template class Variantemplate, class... T> struct VariantAccessResultImpl&> { using type = - const typename absl::variant_alternative>::type&; + const typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type&; }; template class Variantemplate, class... T> struct VariantAccessResultImpl&&> { - using type = typename absl::variant_alternative>::type&&; + using type = typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type&&; }; template class Variantemplate, class... T> struct VariantAccessResultImpl&&> { using type = - const typename absl::variant_alternative>::type&&; + const typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type&&; }; template @@ -198,7 +198,7 @@ using AlwaysZero = SizeT<0>; template struct VisitIndicesResultImpl { - using type = absl::result_of_t...)>; + using type = absl::OTABSL_OPTION_NAMESPACE_NAME::result_of_t...)>; }; template @@ -214,7 +214,7 @@ constexpr ReturnType call_with_indices(FunctionObject&& function) { std::is_same()( SizeT()...))>::value, "Not all visitation overloads have the same return type."); - return absl::forward(function)(SizeT()...); + return absl::OTABSL_OPTION_NAMESPACE_NAME::forward(function)(SizeT()...); } template @@ -265,7 +265,7 @@ struct MakeVisitationMatrix> : MakeVisitationMatrixImpl, - absl::make_index_sequence, + absl::OTABSL_OPTION_NAMESPACE_NAME::make_index_sequence, index_sequence> {}; struct UnreachableSwitchCase { @@ -284,7 +284,7 @@ struct UnreachableSwitchCase { assert(false); // NOLINT // Hack to silence potential no return warning -- cause an infinite loop. - return Run(absl::forward(op)); + return Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); #endif // Checks for __builtin_unreachable } }; @@ -292,7 +292,7 @@ struct UnreachableSwitchCase { template struct ReachableSwitchCase { static VisitIndicesResultT Run(Op&& op) { - return absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke(absl::forward(op), SizeT()); + return absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op), SizeT()); } }; @@ -326,7 +326,7 @@ using PickCase = typename PickCaseImpl<(I < EndIndex)>::template Apply; template [[noreturn]] ReturnType TypedThrowBadVariantAccess() { - absl::variant_internal::ThrowBadVariantAccess(); + absl::OTABSL_OPTION_NAMESPACE_NAME::variant_internal::ThrowBadVariantAccess(); } // Given N variant sizes, determine the number of cases there would need to be @@ -357,74 +357,74 @@ struct VisitIndicesSwitch { static VisitIndicesResultT Run(Op&& op, std::size_t i) { switch (i) { case 0: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 1: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 2: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 3: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 4: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 5: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 6: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 7: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 8: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 9: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 10: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 11: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 12: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 13: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 14: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 15: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 16: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 17: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 18: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 19: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 20: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 21: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 22: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 23: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 24: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 25: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 26: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 27: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 28: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 29: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 30: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 31: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); case 32: - return PickCase::Run(absl::forward(op)); + return PickCase::Run(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); default: OTABSL_ASSERT(i == variant_npos); - return absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke(absl::forward(op), NPos()); + return absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op), NPos()); } } }; @@ -437,7 +437,7 @@ struct VisitIndicesFallback { MakeVisitationMatrix, Op, index_sequence<(EndIndices + 1)...>, index_sequence<>>::Run(), - (indices + 1)...)(absl::forward(op)); + (indices + 1)...)(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)); } }; @@ -479,7 +479,7 @@ template struct VisitIndicesVariadicImpl; template -struct VisitIndicesVariadicImpl, EndIndices...> { +struct VisitIndicesVariadicImpl, EndIndices...> { // A type that can take an N-ary function object and converts it to a unary // function object that takes a single, flattened index, and "unflattens" it // into its individual dimensions when forwarding to the wrapped object. @@ -488,8 +488,8 @@ struct VisitIndicesVariadicImpl, EndIndices...> { template VisitIndicesResultT operator()( SizeT /*index*/) && { - return OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke( - absl::forward(op), + return absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke( + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op), SizeT::value - std::size_t{1}>()...); } @@ -501,7 +501,7 @@ struct VisitIndicesVariadicImpl, EndIndices...> { static VisitIndicesResultT Run( Op&& op, SizeType... i) { return VisitIndicesSwitch::value>::Run( - FlattenedOp{absl::forward(op)}, + FlattenedOp{absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op)}, FlattenIndices<(EndIndices + std::size_t{1})...>::Run( (i + std::size_t{1})...)); } @@ -509,7 +509,7 @@ struct VisitIndicesVariadicImpl, EndIndices...> { template struct VisitIndicesVariadic - : VisitIndicesVariadicImpl, + : VisitIndicesVariadicImpl, EndIndices...> {}; // This implementation will flatten N-ary visit operations into a single switch @@ -522,14 +522,14 @@ struct VisitIndicesVariadic // size. template struct VisitIndices - : absl::conditional_t<(NumCasesOfSwitch::value <= + : absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t<(NumCasesOfSwitch::value <= MaxUnrolledVisitCases), VisitIndicesVariadic, VisitIndicesFallback> {}; template struct VisitIndices - : absl::conditional_t<(EndIndex <= MaxUnrolledVisitCases), + : absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t<(EndIndex <= MaxUnrolledVisitCases), VisitIndicesSwitch, VisitIndicesFallback> {}; @@ -577,7 +577,7 @@ struct VariantCoreAccess { template static void Destroy(VariantType& self) { // NOLINT Derived(self).destroy(); - self.index_ = absl::variant_npos; + self.index_ = absl::OTABSL_OPTION_NAMESPACE_NAME::variant_npos; } template @@ -587,7 +587,7 @@ struct VariantCoreAccess { template static void InitFrom(Variant& self, Variant&& other) { // NOLINT - VisitIndices::value>::Run( + VisitIndices::value>::Run( InitFromVisitor{&self, std::forward(other)}, other.index()); @@ -612,7 +612,7 @@ struct VariantCoreAccess { TypedThrowBadVariantAccess>(); } - return Access(absl::forward(self)); + return Access(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(self)); } // The implementation of the move-assignment operation for a variant. @@ -629,7 +629,7 @@ struct VariantCoreAccess { } } - void operator()(SizeT /*new_i*/) const { + void operator()(SizeT /*new_i*/) const { Destroy(*left); } @@ -650,7 +650,7 @@ struct VariantCoreAccess { template void operator()(SizeT /*new_i*/) const { using New = - typename absl::variant_alternative::type; + typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative::type; if (left->index_ == NewIndex) { Access(*left) = Access(*right); @@ -662,7 +662,7 @@ struct VariantCoreAccess { } } - void operator()(SizeT /*new_i*/) const { + void operator()(SizeT /*new_i*/) const { Destroy(*left); } @@ -684,24 +684,24 @@ struct VariantCoreAccess { void operator()(SizeT /*old_i*/ ) const { - Access(*left) = absl::forward(other); + Access(*left) = absl::OTABSL_OPTION_NAMESPACE_NAME::forward(other); } template void operator()(SizeT /*old_i*/ ) const { using New = - typename absl::variant_alternative::type; + typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative::type; if (std::is_nothrow_constructible::value || !std::is_nothrow_move_constructible::value) { left->template emplace( - absl::forward(other)); + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(other)); } else { // the standard says "equivalent to // operator=(variant(std::forward(t)))", but we use `emplace` here // because the variant's move assignment operator could be deleted. left->template emplace( - New(absl::forward(other))); + New(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(other))); } } @@ -712,18 +712,18 @@ struct VariantCoreAccess { template static ConversionAssignVisitor MakeConversionAssignVisitor(Left* left, QualifiedNew&& qual) { - return {left, absl::forward(qual)}; + return {left, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(qual)}; } // Backend for operations for `emplace()` which destructs `*self` then // construct a new alternative with `Args...`. template - static typename absl::variant_alternative::type& Replace( + static typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative::type& Replace( Self* self, Args&&... args) { Destroy(*self); - using New = typename absl::variant_alternative::type; + using New = typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative::type; New* const result = ::new (static_cast(&self->state_)) - New(absl::forward(args)...); + New(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...); self->index_ = NewIndex; return *result; } @@ -738,7 +738,7 @@ struct VariantCoreAccess { Access(std::forward(right))); } - void operator()(SizeT /*new_i*/) const { + void operator()(SizeT /*new_i*/) const { // This space intentionally left blank. } LeftVariant* left; @@ -888,13 +888,13 @@ struct IndexOfConstructedType< template struct ContainsVariantNPos - : absl::negation, - absl::integer_sequence>> {}; + : absl::OTABSL_OPTION_NAMESPACE_NAME::negation, + absl::OTABSL_OPTION_NAMESPACE_NAME::integer_sequence>> {}; template using RawVisitResult = - absl::result_of_t...)>; + absl::OTABSL_OPTION_NAMESPACE_NAME::result_of_t...)>; // NOTE: The spec requires that all return-paths yield the same type and is not // SFINAE-friendly, so we can deduce the return type by examining the first @@ -905,7 +905,7 @@ using RawVisitResult = template struct VisitResultImpl { using type = - absl::result_of_t...)>; + absl::OTABSL_OPTION_NAMESPACE_NAME::result_of_t...)>; }; // Done in two steps intentionally so that we don't cause substitution to fail. @@ -919,7 +919,7 @@ struct PerformVisitation { template constexpr ReturnType operator()(SizeT... indices) const { return Run(typename ContainsVariantNPos::type{}, - absl::index_sequence_for(), indices...); + absl::OTABSL_OPTION_NAMESPACE_NAME::index_sequence_for(), indices...); } template @@ -927,19 +927,19 @@ struct PerformVisitation { index_sequence, SizeT...) const { static_assert( std::is_same...)>>::value, "All visitation overloads must have the same return type."); - return absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke( - absl::forward(op), + return absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke( + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(op), VariantCoreAccess::Access( - absl::forward(std::get(variant_tup)))...); + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(std::get(variant_tup)))...); } template [[noreturn]] ReturnType Run(std::true_type /*has_valueless*/, index_sequence, SizeT...) const { - absl::variant_internal::ThrowBadVariantAccess(); + absl::OTABSL_OPTION_NAMESPACE_NAME::variant_internal::ThrowBadVariantAccess(); } // TODO(calabrese) Avoid using a tuple, which causes lots of instantiations @@ -981,11 +981,11 @@ union Union { template explicit constexpr Union(EmplaceTag<0>, P&&... args) - : head(absl::forward

(args)...) {} + : head(absl::OTABSL_OPTION_NAMESPACE_NAME::forward

(args)...) {} template explicit constexpr Union(EmplaceTag, P&&... args) - : tail(EmplaceTag{}, absl::forward

(args)...) {} + : tail(EmplaceTag{}, absl::OTABSL_OPTION_NAMESPACE_NAME::forward

(args)...) {} Head head; TailUnion tail; @@ -1013,11 +1013,11 @@ union DestructibleUnionImpl { template explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args) - : head(absl::forward

(args)...) {} + : head(absl::OTABSL_OPTION_NAMESPACE_NAME::forward

(args)...) {} template explicit constexpr DestructibleUnionImpl(EmplaceTag, P&&... args) - : tail(EmplaceTag{}, absl::forward

(args)...) {} + : tail(EmplaceTag{}, absl::OTABSL_OPTION_NAMESPACE_NAME::forward

(args)...) {} ~DestructibleUnionImpl() {} @@ -1030,7 +1030,7 @@ union DestructibleUnionImpl { // this resultant type. template using DestructibleUnion = - absl::conditional_t>::value, Union, + absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t>::value, Union, DestructibleUnionImpl>; // Deepest base, containing the actual union and the discriminator @@ -1040,7 +1040,7 @@ class VariantStateBase { using Variant = variant; template ::value, LazyH>> constexpr VariantStateBase() noexcept( std::is_nothrow_default_constructible::value) @@ -1048,7 +1048,7 @@ class VariantStateBase { template explicit constexpr VariantStateBase(EmplaceTag tag, P&&... args) - : state_(tag, absl::forward

(args)...), index_(I) {} + : state_(tag, absl::OTABSL_OPTION_NAMESPACE_NAME::forward

(args)...), index_(I) {} explicit constexpr VariantStateBase(NoopConstructorTag) : state_(NoopConstructorTag()), index_(variant_npos) {} @@ -1059,7 +1059,7 @@ class VariantStateBase { std::size_t index_; }; -using absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity; +using absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity; // OverloadSet::Overload() is a unary function which is overloaded to // take any of the element types of the variant, by reference-to-const. @@ -1106,37 +1106,37 @@ using NotEqualResult = decltype(std::declval() != std::declval()); using type_traits_internal::is_detected_convertible; template -using RequireAllHaveEqualT = absl::enable_if_t< - absl::conjunction...>::value, +using RequireAllHaveEqualT = absl::OTABSL_OPTION_NAMESPACE_NAME::enable_if_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction...>::value, bool>; template using RequireAllHaveNotEqualT = - absl::enable_if_t...>::value, bool>; template using RequireAllHaveLessThanT = - absl::enable_if_t...>::value, bool>; template using RequireAllHaveLessThanOrEqualT = - absl::enable_if_t...>::value, bool>; template using RequireAllHaveGreaterThanOrEqualT = - absl::enable_if_t...>::value, bool>; template using RequireAllHaveGreaterThanT = - absl::enable_if_t...>::value, bool>; @@ -1171,7 +1171,7 @@ struct VariantHelper> { template struct CanConvertFrom> - : public absl::conjunction...> {}; + : public absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction...> {}; }; // A type with nontrivial copy ctor and trivial move ctor. @@ -1220,7 +1220,7 @@ class VariantCopyAssignBaseNontrivial; // Base that is dependent on whether or not the destructor can be trivial. template using VariantStateBaseDestructor = - absl::conditional_t>::value, + absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t>::value, VariantStateBase, VariantStateBaseDestructorNontrivial>; @@ -1232,44 +1232,44 @@ using VariantStateBaseDestructor = // So we have to use a different approach (i.e. `HasTrivialMoveConstructor`) to // work around the bug. template -using VariantMoveBase = absl::conditional_t< - absl::disjunction< - absl::negation...>>, - absl::conjunction...>>::value, +using VariantMoveBase = absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::disjunction< + absl::OTABSL_OPTION_NAMESPACE_NAME::negation...>>, + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction...>>::value, VariantStateBaseDestructor, VariantMoveBaseNontrivial>; // Base that is dependent on whether or not the copy-constructor can be trivial. template -using VariantCopyBase = absl::conditional_t< - absl::disjunction< - absl::negation...>>, +using VariantCopyBase = absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::disjunction< + absl::OTABSL_OPTION_NAMESPACE_NAME::negation...>>, std::is_copy_constructible>>::value, VariantMoveBase, VariantCopyBaseNontrivial>; // Base that is dependent on whether or not the move-assign can be trivial. template -using VariantMoveAssignBase = absl::conditional_t< - absl::disjunction< - absl::conjunction>, +using VariantMoveAssignBase = absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::disjunction< + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction>, std::is_move_constructible>, std::is_destructible>>, - absl::negation..., + absl::OTABSL_OPTION_NAMESPACE_NAME::negation..., // Note: We're not qualifying this with - // absl:: because it doesn't compile + // absl::OTABSL_OPTION_NAMESPACE_NAME:: because it doesn't compile // under MSVC. is_move_assignable...>>>::value, VariantCopyBase, VariantMoveAssignBaseNontrivial>; // Base that is dependent on whether or not the copy-assign can be trivial. template -using VariantCopyAssignBase = absl::conditional_t< - absl::disjunction< - absl::conjunction>, +using VariantCopyAssignBase = absl::OTABSL_OPTION_NAMESPACE_NAME::conditional_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::disjunction< + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction>, std::is_copy_constructible>, std::is_destructible>>, - absl::negation..., + absl::OTABSL_OPTION_NAMESPACE_NAME::negation..., // Note: We're not qualifying this with - // absl:: because it doesn't compile + // absl::OTABSL_OPTION_NAMESPACE_NAME:: because it doesn't compile // under MSVC. is_copy_assignable...>>>::value, VariantMoveAssignBase, VariantCopyAssignBaseNontrivial>; @@ -1299,11 +1299,11 @@ class VariantStateBaseDestructorNontrivial : protected VariantStateBase { template void operator()(SizeT i) const { using Alternative = - typename absl::variant_alternative>::type; + typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type; variant_internal::AccessUnion(self->state_, i).~Alternative(); } - void operator()(SizeT /*i*/) const { + void operator()(SizeT /*i*/) const { // This space intentionally left blank } @@ -1331,12 +1331,12 @@ class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor { template void operator()(SizeT i) const { using Alternative = - typename absl::variant_alternative>::type; + typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type; ::new (static_cast(&self->state_)) Alternative( - variant_internal::AccessUnion(absl::move(other->state_), i)); + variant_internal::AccessUnion(absl::OTABSL_OPTION_NAMESPACE_NAME::move(other->state_), i)); } - void operator()(SizeT /*i*/) const {} + void operator()(SizeT /*i*/) const {} VariantMoveBaseNontrivial* self; VariantMoveBaseNontrivial* other; @@ -1344,7 +1344,7 @@ class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor { VariantMoveBaseNontrivial() = default; VariantMoveBaseNontrivial(VariantMoveBaseNontrivial&& other) noexcept( - absl::conjunction...>::value) + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction...>::value) : Base(NoopConstructorTag()) { VisitIndices::Run(Construct{this, &other}, other.index_); index_ = other.index_; @@ -1376,12 +1376,12 @@ class VariantCopyBaseNontrivial : protected VariantMoveBase { template void operator()(SizeT i) const { using Alternative = - typename absl::variant_alternative>::type; + typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative>::type; ::new (static_cast(&self->state_)) Alternative(variant_internal::AccessUnion(other->state_, i)); } - void operator()(SizeT /*i*/) const {} + void operator()(SizeT /*i*/) const {} VariantCopyBaseNontrivial* self; const VariantCopyBaseNontrivial* other; @@ -1421,7 +1421,7 @@ class VariantMoveAssignBaseNontrivial : protected VariantCopyBase { VariantMoveAssignBaseNontrivial& operator=(VariantMoveAssignBaseNontrivial&& other) noexcept( - absl::conjunction..., + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction..., std::is_nothrow_move_assignable...>::value) { VisitIndices::Run( VariantCoreAccess::MakeMoveAssignVisitor(this, &other), other.index_); @@ -1471,7 +1471,7 @@ struct EqualsOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return true; } @@ -1486,7 +1486,7 @@ struct NotEqualsOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return false; } @@ -1501,7 +1501,7 @@ struct LessThanOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return false; } @@ -1516,7 +1516,7 @@ struct GreaterThanOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return false; } @@ -1531,7 +1531,7 @@ struct LessThanOrEqualsOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return true; } @@ -1546,7 +1546,7 @@ struct GreaterThanOrEqualsOp { const variant* v; const variant* w; - constexpr bool operator()(SizeT /*v_i*/) const { + constexpr bool operator()(SizeT /*v_i*/) const { return true; } @@ -1584,7 +1584,7 @@ struct Swap { VariantCoreAccess::InitFrom(*v, std::move(tmp)); } - void operator()(SizeT /*w_i*/) const { + void operator()(SizeT /*w_i*/) const { if (!v->valueless_by_exception()) { generic_swap(); } @@ -1618,7 +1618,7 @@ struct VariantHashVisitor { template struct VariantHashBase...>::value>, Ts...> { using argument_type = Variant; diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/variant.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/variant.h index 2649a29ce3c..cbce326c26d 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/variant.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/types/variant.h @@ -16,26 +16,26 @@ // variant.h // ----------------------------------------------------------------------------- // -// This header file defines an `absl::variant` type for holding a type-safe +// This header file defines an `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` type for holding a type-safe // value of some prescribed set of types (noted as alternative types), and // associated functions for managing variants. // -// The `absl::variant` type is a form of type-safe union. An `absl::variant` +// The `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` type is a form of type-safe union. An `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` // should always hold a value of one of its alternative types (except in the // "valueless by exception state" -- see below). A default-constructed -// `absl::variant` will hold the value of its first alternative type, provided +// `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` will hold the value of its first alternative type, provided // it is default-constructible. // -// In exceptional cases due to error, an `absl::variant` can hold no +// In exceptional cases due to error, an `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` can hold no // value (known as a "valueless by exception" state), though this is not the // norm. // -// As with `absl::optional`, an `absl::variant` -- when it holds a value -- +// As with `absl::OTABSL_OPTION_NAMESPACE_NAME::optional`, an `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` -- when it holds a value -- // allocates a value of that type directly within the `variant` itself; it // cannot hold a reference, array, or the type `void`; it can, however, hold a // pointer to externally managed memory. // -// `absl::variant` is a C++11 compatible version of the C++17 `std::variant` +// `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` is a C++11 compatible version of the C++17 `std::variant` // abstraction and is designed to be a drop-in replacement for code compliant // with C++17. @@ -82,10 +82,10 @@ namespace absl { OTABSL_NAMESPACE_BEGIN // ----------------------------------------------------------------------------- -// absl::variant +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant // ----------------------------------------------------------------------------- // -// An `absl::variant` type is a form of type-safe union. An `absl::variant` -- +// An `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` type is a form of type-safe union. An `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` -- // except in exceptional cases -- always holds a value of one of its alternative // types. // @@ -93,29 +93,29 @@ OTABSL_NAMESPACE_BEGIN // // // Construct a variant that holds either an integer or a std::string and // // assign it to a std::string. -// absl::variant v = std::string("abc"); +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant v = std::string("abc"); // // // A default-constructed variant will hold a value-initialized value of // // the first alternative type. -// auto a = absl::variant(); // Holds an int of value '0'. +// auto a = absl::OTABSL_OPTION_NAMESPACE_NAME::variant(); // Holds an int of value '0'. // // // variants are assignable. // // // copy assignment -// auto v1 = absl::variant("abc"); -// auto v2 = absl::variant(10); +// auto v1 = absl::OTABSL_OPTION_NAMESPACE_NAME::variant("abc"); +// auto v2 = absl::OTABSL_OPTION_NAMESPACE_NAME::variant(10); // v2 = v1; // copy assign // // // move assignment -// auto v1 = absl::variant("abc"); -// v1 = absl::variant(10); +// auto v1 = absl::OTABSL_OPTION_NAMESPACE_NAME::variant("abc"); +// v1 = absl::OTABSL_OPTION_NAMESPACE_NAME::variant(10); // // // assignment through type conversion // a = 128; // variant contains int // a = "128"; // variant contains std::string // -// An `absl::variant` holding a value of one of its alternative types `T` holds -// an allocation of `T` directly within the variant itself. An `absl::variant` +// An `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` holding a value of one of its alternative types `T` holds +// an allocation of `T` directly within the variant itself. An `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` // is not allowed to allocate additional storage, such as dynamic memory, to // allocate the contained value. The contained value shall be allocated in a // region of the variant storage suitably aligned for all alternative types. @@ -124,8 +124,8 @@ class variant; // swap() // -// Swaps two `absl::variant` values. This function is equivalent to `v.swap(w)` -// where `v` and `w` are `absl::variant` types. +// Swaps two `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` values. This function is equivalent to `v.swap(w)` +// where `v` and `w` are `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` types. // // Note that this function requires all alternative types to be both swappable // and move-constructible, because any two variants may refer to either the same @@ -134,8 +134,8 @@ class variant; // template < typename... Ts, - absl::enable_if_t< - absl::conjunction..., + absl::OTABSL_OPTION_NAMESPACE_NAME::enable_if_t< + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction..., type_traits_internal::IsSwappable...>::value, int> = 0> void swap(variant& v, variant& w) noexcept(noexcept(v.swap(w))) { @@ -144,25 +144,25 @@ void swap(variant& v, variant& w) noexcept(noexcept(v.swap(w))) { // variant_size // -// Returns the number of alternative types available for a given `absl::variant` +// Returns the number of alternative types available for a given `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` // type as a compile-time constant expression. As this is a class template, it // is not generally useful for accessing the number of alternative types of -// any given `absl::variant` instance. +// any given `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` instance. // // Example: // -// auto a = absl::variant; +// auto a = absl::OTABSL_OPTION_NAMESPACE_NAME::variant; // constexpr int num_types = -// absl::variant_size>(); +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size>(); // // // You can also use the member constant `value`. // constexpr int num_types = -// absl::variant_size>::value; +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size>::value; // -// // `absl::variant_size` is more valuable for use in generic code: +// // `absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size` is more valuable for use in generic code: // template // constexpr bool IsVariantMultivalue() { -// return absl::variant_size() > 1; +// return absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size() > 1; // } // // Note that the set of cv-qualified specializations of `variant_size` are @@ -189,20 +189,20 @@ struct variant_size : variant_size::type {}; // variant_alternative // -// Returns the alternative type for a given `absl::variant` at the passed +// Returns the alternative type for a given `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` at the passed // index value as a compile-time constant expression. As this is a class // template resulting in a type, it is not useful for access of the run-time -// value of any given `absl::variant` variable. +// value of any given `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` variable. // // Example: // // // The type of the 0th alternative is "int". // using alternative_type_0 -// = absl::variant_alternative<0, absl::variant>::type; +// = absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative<0, absl::OTABSL_OPTION_NAMESPACE_NAME::variant>::type; // // static_assert(std::is_same::value, ""); // -// // `absl::variant_alternative` is more valuable for use in generic code: +// // `absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative` is more valuable for use in generic code: // template // constexpr bool IsFirstElementTrivial() { // return std::is_trivial_v::type>; @@ -244,7 +244,7 @@ struct variant_alternative { // Example: // // using alternative_type_0 -// = absl::variant_alternative_t<0, absl::variant>; +// = absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t<0, absl::OTABSL_OPTION_NAMESPACE_NAME::variant>; // static_assert(std::is_same::value, ""); template using variant_alternative_t = typename variant_alternative::type; @@ -256,8 +256,8 @@ using variant_alternative_t = typename variant_alternative::type; // // Example: // -// absl::variant foo = 42; -// if (absl::holds_alternative(foo)) { +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant foo = 42; +// if (absl::OTABSL_OPTION_NAMESPACE_NAME::holds_alternative(foo)) { // std::cout << "The variant holds an integer"; // } template @@ -278,22 +278,22 @@ constexpr bool holds_alternative(const variant& v) noexcept { // using a type that is not unique within the variant's set of alternative types // is a compile-time error. If the index of the alternative being specified is // different from the index of the alternative that is currently stored, throws -// `absl::bad_variant_access`. +// `absl::OTABSL_OPTION_NAMESPACE_NAME::bad_variant_access`. // // Example: // -// auto a = absl::variant; +// auto a = absl::OTABSL_OPTION_NAMESPACE_NAME::variant; // // // Get the value by type (if unique). -// int i = absl::get(a); +// int i = absl::OTABSL_OPTION_NAMESPACE_NAME::get(a); // -// auto b = absl::variant; +// auto b = absl::OTABSL_OPTION_NAMESPACE_NAME::variant; // // // Getting the value by a type that is not unique is ill-formed. -// int j = absl::get(b); // Compile Error! +// int j = absl::OTABSL_OPTION_NAMESPACE_NAME::get(b); // Compile Error! // // // Getting value by index not ambiguous and allowed. -// int k = absl::get<1>(b); +// int k = absl::OTABSL_OPTION_NAMESPACE_NAME::get<1>(b); // Overload for getting a variant's lvalue by type. template @@ -303,11 +303,11 @@ constexpr T& get(variant& v) { // NOLINT } // Overload for getting a variant's rvalue by type. -// Note: `absl::move()` is required to allow use of constexpr in C++11. +// Note: `absl::OTABSL_OPTION_NAMESPACE_NAME::move()` is required to allow use of constexpr in C++11. template constexpr T&& get(variant&& v) { return variant_internal::VariantCoreAccess::CheckedAccess< - variant_internal::IndexOf::value>(absl::move(v)); + variant_internal::IndexOf::value>(absl::OTABSL_OPTION_NAMESPACE_NAME::move(v)); } // Overload for getting a variant's const lvalue by type. @@ -318,11 +318,11 @@ constexpr const T& get(const variant& v) { } // Overload for getting a variant's const rvalue by type. -// Note: `absl::move()` is required to allow use of constexpr in C++11. +// Note: `absl::OTABSL_OPTION_NAMESPACE_NAME::move()` is required to allow use of constexpr in C++11. template constexpr const T&& get(const variant&& v) { return variant_internal::VariantCoreAccess::CheckedAccess< - variant_internal::IndexOf::value>(absl::move(v)); + variant_internal::IndexOf::value>(absl::OTABSL_OPTION_NAMESPACE_NAME::move(v)); } // Overload for getting a variant's lvalue by index. @@ -333,11 +333,11 @@ constexpr variant_alternative_t>& get( } // Overload for getting a variant's rvalue by index. -// Note: `absl::move()` is required to allow use of constexpr in C++11. +// Note: `absl::OTABSL_OPTION_NAMESPACE_NAME::move()` is required to allow use of constexpr in C++11. template constexpr variant_alternative_t>&& get( variant&& v) { - return variant_internal::VariantCoreAccess::CheckedAccess(absl::move(v)); + return variant_internal::VariantCoreAccess::CheckedAccess(absl::OTABSL_OPTION_NAMESPACE_NAME::move(v)); } // Overload for getting a variant's const lvalue by index. @@ -348,11 +348,11 @@ constexpr const variant_alternative_t>& get( } // Overload for getting a variant's const rvalue by index. -// Note: `absl::move()` is required to allow use of constexpr in C++11. +// Note: `absl::OTABSL_OPTION_NAMESPACE_NAME::move()` is required to allow use of constexpr in C++11. template constexpr const variant_alternative_t>&& get( const variant&& v) { - return variant_internal::VariantCoreAccess::CheckedAccess(absl::move(v)); + return variant_internal::VariantCoreAccess::CheckedAccess(absl::OTABSL_OPTION_NAMESPACE_NAME::move(v)); } // get_if() @@ -368,7 +368,7 @@ constexpr const variant_alternative_t>&& get( // Overload for getting a pointer to the value stored in the given variant by // index. template -constexpr absl::add_pointer_t>> +constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::add_pointer_t>> get_if(variant* v) noexcept { return (v != nullptr && v->index() == I) ? std::addressof( @@ -379,7 +379,7 @@ get_if(variant* v) noexcept { // Overload for getting a pointer to the const value stored in the given // variant by index. template -constexpr absl::add_pointer_t>> +constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::add_pointer_t>> get_if(const variant* v) noexcept { return (v != nullptr && v->index() == I) ? std::addressof( @@ -390,21 +390,21 @@ get_if(const variant* v) noexcept { // Overload for getting a pointer to the value stored in the given variant by // type. template -constexpr absl::add_pointer_t get_if(variant* v) noexcept { - return absl::get_if::value>(v); +constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::add_pointer_t get_if(variant* v) noexcept { + return absl::OTABSL_OPTION_NAMESPACE_NAME::get_if::value>(v); } // Overload for getting a pointer to the const value stored in the given variant // by type. template -constexpr absl::add_pointer_t get_if( +constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::add_pointer_t get_if( const variant* v) noexcept { - return absl::get_if::value>(v); + return absl::OTABSL_OPTION_NAMESPACE_NAME::get_if::value>(v); } // visit() // -// Calls a provided functor on a given set of variants. `absl::visit()` is +// Calls a provided functor on a given set of variants. `absl::OTABSL_OPTION_NAMESPACE_NAME::visit()` is // commonly used to conditionally inspect the state of a given variant (or set // of variants). // @@ -421,19 +421,19 @@ constexpr absl::add_pointer_t get_if( // } // }; // -// // Declare our variant, and call `absl::visit()` on it. +// // Declare our variant, and call `absl::OTABSL_OPTION_NAMESPACE_NAME::visit()` on it. // // Note that `GetVariant()` returns void in either case. -// absl::variant foo = std::string("foo"); +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant foo = std::string("foo"); // GetVariant visitor; -// absl::visit(visitor, foo); // Prints `The variant's value is: foo' +// absl::OTABSL_OPTION_NAMESPACE_NAME::visit(visitor, foo); // Prints `The variant's value is: foo' template variant_internal::VisitResult visit(Visitor&& vis, Variants&&... vars) { return variant_internal:: - VisitIndices >::value...>::Run( + VisitIndices >::value...>::Run( variant_internal::PerformVisitation{ - std::forward_as_tuple(absl::forward(vars)...), - absl::forward(vis)}, + std::forward_as_tuple(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(vars)...), + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(vis)}, vars.index()...); } @@ -443,7 +443,7 @@ variant_internal::VisitResult visit(Visitor&& vis, // which the first variant type is otherwise not default-constructible. struct monostate {}; -// `absl::monostate` Relational Operators +// `absl::OTABSL_OPTION_NAMESPACE_NAME::monostate` Relational Operators constexpr bool operator<(monostate, monostate) noexcept { return false; } constexpr bool operator>(monostate, monostate) noexcept { return false; } @@ -454,20 +454,20 @@ constexpr bool operator!=(monostate, monostate) noexcept { return false; } //------------------------------------------------------------------------------ -// `absl::variant` Template Definition +// `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` Template Definition //------------------------------------------------------------------------------ template class variant : private variant_internal::VariantBase { - static_assert(absl::conjunction, + static_assert(absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction, std::is_object...>::value, "Attempted to instantiate a variant containing a non-object " "type."); - // Intentionally not qualifying `negation` with `absl::` to work around a bug + // Intentionally not qualifying `negation` with `absl::OTABSL_OPTION_NAMESPACE_NAME::` to work around a bug // in MSVC 2015 with inline namespace and variadic template. - static_assert(absl::conjunction >, + static_assert(absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction >, negation >...>::value, "Attempted to instantiate a variant containing an array type."); - static_assert(absl::conjunction, + static_assert(absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction, std::is_nothrow_destructible...>::value, "Attempted to instantiate a variant containing a non-nothrow " "destructible type."); @@ -499,18 +499,18 @@ class variant : private variant_internal::VariantBase { // // NOTE: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0608r1.html // has been voted passed the design phase in the C++ standard meeting in Mar - // 2018. It will be implemented and integrated into `absl::variant`. + // 2018. It will be implemented and integrated into `absl::OTABSL_OPTION_NAMESPACE_NAME::variant`. template < class T, std::size_t I = std::enable_if< variant_internal::IsNeitherSelfNorInPlace>::value, + absl::OTABSL_OPTION_NAMESPACE_NAME::decay_t>::value, variant_internal::IndexOfConstructedType>::type::value, - class Tj = absl::variant_alternative_t, - absl::enable_if_t::value>* = + class Tj = absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t, + absl::OTABSL_OPTION_NAMESPACE_NAME::enable_if_t::value>* = nullptr> constexpr variant(T&& t) noexcept(std::is_nothrow_constructible::value) - : Base(variant_internal::EmplaceTag(), absl::forward(t)) {} + : Base(variant_internal::EmplaceTag(), absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t)) {} // Constructs a variant of an alternative type from the arguments through // direct-initialization. @@ -524,7 +524,7 @@ class variant : private variant_internal::VariantBase { constexpr explicit variant(in_place_type_t, Args&&... args) : Base(variant_internal::EmplaceTag< variant_internal::UnambiguousIndexOf::value>(), - absl::forward(args)...) {} + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...) {} // Constructs a variant of an alternative type from an initializer list // and other arguments through direct-initialization. @@ -539,7 +539,7 @@ class variant : private variant_internal::VariantBase { Args&&... args) : Base(variant_internal::EmplaceTag< variant_internal::UnambiguousIndexOf::value>(), - il, absl::forward(args)...) {} + il, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...) {} // Constructs a variant of an alternative type from a provided index, // through value-initialization using the provided forwarded arguments. @@ -548,7 +548,7 @@ class variant : private variant_internal::VariantBase { variant_internal::VariantAlternativeSfinaeT, Args...>::value>::type* = nullptr> constexpr explicit variant(in_place_index_t, Args&&... args) - : Base(variant_internal::EmplaceTag(), absl::forward(args)...) {} + : Base(variant_internal::EmplaceTag(), absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...) {} // Constructs a variant of an alternative type from a provided index, // through value-initialization of an initializer list and the provided @@ -560,12 +560,12 @@ class variant : private variant_internal::VariantBase { constexpr explicit variant(in_place_index_t, std::initializer_list il, Args&&... args) : Base(variant_internal::EmplaceTag(), il, - absl::forward(args)...) {} + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...) {} // Destructors // Destroys the variant's currently contained value, provided that - // `absl::valueless_by_exception()` is false. + // `absl::OTABSL_OPTION_NAMESPACE_NAME::valueless_by_exception()` is false. ~variant() = default; // Assignment Operators @@ -580,13 +580,13 @@ class variant : private variant_internal::VariantBase { // // NOTE: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0608r1.html // has been voted passed the design phase in the C++ standard meeting in Mar - // 2018. It will be implemented and integrated into `absl::variant`. + // 2018. It will be implemented and integrated into `absl::OTABSL_OPTION_NAMESPACE_NAME::variant`. template < class T, std::size_t I = std::enable_if< - !std::is_same, variant>::value, + !std::is_same, variant>::value, variant_internal::IndexOfConstructedType>::type::value, - class Tj = absl::variant_alternative_t, + class Tj = absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t, typename std::enable_if::value && std::is_constructible::value>::type* = nullptr> @@ -595,7 +595,7 @@ class variant : private variant_internal::VariantBase { std::is_nothrow_constructible::value) { variant_internal::VisitIndices::Run( variant_internal::VariantCoreAccess::MakeConversionAssignVisitor( - this, absl::forward(t)), + this, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t)), index()); return *this; @@ -606,89 +606,89 @@ class variant : private variant_internal::VariantBase { // Constructs a value of the given alternative type T within the variant. The // existing value of the variant is destroyed first (provided that - // `absl::valueless_by_exception()` is false). Requires that T is unambiguous + // `absl::OTABSL_OPTION_NAMESPACE_NAME::valueless_by_exception()` is false). Requires that T is unambiguous // in the variant. // // Example: // - // absl::variant, int, std::string> v; + // absl::OTABSL_OPTION_NAMESPACE_NAME::variant, int, std::string> v; // v.emplace(99); // v.emplace("abc"); template < class T, class... Args, typename std::enable_if::value, variant>, Args...>::value>::type* = nullptr> T& emplace(Args&&... args) { return variant_internal::VariantCoreAccess::Replace< variant_internal::UnambiguousIndexOf::value>( - this, absl::forward(args)...); + this, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...); } // Constructs a value of the given alternative type T within the variant using // an initializer list. The existing value of the variant is destroyed first - // (provided that `absl::valueless_by_exception()` is false). Requires that T + // (provided that `absl::OTABSL_OPTION_NAMESPACE_NAME::valueless_by_exception()` is false). Requires that T // is unambiguous in the variant. // // Example: // - // absl::variant, int, std::string> v; + // absl::OTABSL_OPTION_NAMESPACE_NAME::variant, int, std::string> v; // v.emplace>({0, 1, 2}); template < class T, class U, class... Args, typename std::enable_if::value, variant>, std::initializer_list&, Args...>::value>::type* = nullptr> T& emplace(std::initializer_list il, Args&&... args) { return variant_internal::VariantCoreAccess::Replace< variant_internal::UnambiguousIndexOf::value>( - this, il, absl::forward(args)...); + this, il, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...); } // Destroys the current value of the variant (provided that - // `absl::valueless_by_exception()` is false) and constructs a new value at + // `absl::OTABSL_OPTION_NAMESPACE_NAME::valueless_by_exception()` is false) and constructs a new value at // the given index. // // Example: // - // absl::variant, int, int> v; + // absl::OTABSL_OPTION_NAMESPACE_NAME::variant, int, int> v; // v.emplace<1>(99); // v.emplace<2>(98); // v.emplace(99); // Won't compile. 'int' isn't a unique type. template , + std::is_constructible, Args...>::value>::type* = nullptr> - absl::variant_alternative_t& emplace(Args&&... args) { + absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t& emplace(Args&&... args) { return variant_internal::VariantCoreAccess::Replace( - this, absl::forward(args)...); + this, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...); } // Destroys the current value of the variant (provided that - // `absl::valueless_by_exception()` is false) and constructs a new value at + // `absl::OTABSL_OPTION_NAMESPACE_NAME::valueless_by_exception()` is false) and constructs a new value at // the given index using an initializer list and the provided arguments. // // Example: // - // absl::variant, int, int> v; + // absl::OTABSL_OPTION_NAMESPACE_NAME::variant, int, int> v; // v.emplace<0>({0, 1, 2}); template , + absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t, std::initializer_list&, Args...>::value>::type* = nullptr> - absl::variant_alternative_t& emplace(std::initializer_list il, + absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t& emplace(std::initializer_list il, Args&&... args) { return variant_internal::VariantCoreAccess::Replace( - this, il, absl::forward(args)...); + this, il, absl::OTABSL_OPTION_NAMESPACE_NAME::forward(args)...); } // variant::valueless_by_exception() // // Returns false if and only if the variant currently holds a valid value. constexpr bool valueless_by_exception() const noexcept { - return this->index_ == absl::variant_npos; + return this->index_ == absl::OTABSL_OPTION_NAMESPACE_NAME::variant_npos; } // variant::index() @@ -702,7 +702,7 @@ class variant : private variant_internal::VariantBase { // Swaps the values of two variant objects. // void swap(variant& rhs) noexcept( - absl::conjunction< + absl::OTABSL_OPTION_NAMESPACE_NAME::conjunction< std::is_nothrow_move_constructible, std::is_nothrow_move_constructible..., type_traits_internal::IsNothrowSwappable, @@ -810,14 +810,14 @@ namespace std { // hash() template <> // NOLINT -struct hash { - std::size_t operator()(absl::monostate) const { return 0; } +struct hash { + std::size_t operator()(absl::OTABSL_OPTION_NAMESPACE_NAME::monostate) const { return 0; } }; template // NOLINT -struct hash> - : absl::variant_internal::VariantHashBase, void, - absl::remove_const_t...> {}; +struct hash> + : absl::OTABSL_OPTION_NAMESPACE_NAME::variant_internal::VariantHashBase, void, + absl::OTABSL_OPTION_NAMESPACE_NAME::remove_const_t...> {}; } // namespace std @@ -841,22 +841,22 @@ struct ConversionVisitor { // ConvertVariantTo() // -// Helper functions to convert an `absl::variant` to a variant of another set of +// Helper functions to convert an `absl::OTABSL_OPTION_NAMESPACE_NAME::variant` to a variant of another set of // types, provided that the alternative type of the new variant type can be // converted from any type in the source variant. // // Example: // -// absl::variant InternalReq(const Req&); +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant InternalReq(const Req&); // // // name1 and name2 are convertible to name -// absl::variant ExternalReq(const Req& req) { -// return absl::ConvertVariantTo>( +// absl::OTABSL_OPTION_NAMESPACE_NAME::variant ExternalReq(const Req& req) { +// return absl::OTABSL_OPTION_NAMESPACE_NAME::ConvertVariantTo>( // InternalReq(req)); // } template To ConvertVariantTo(Variant&& variant) { - return absl::visit(variant_internal::ConversionVisitor{}, + return absl::OTABSL_OPTION_NAMESPACE_NAME::visit(variant_internal::ConversionVisitor{}, std::forward(variant)); } diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/utility/utility.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/utility/utility.h index 8c15e2b8c10..62580cc5afd 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/utility/utility.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/internal/absl/utility/utility.h @@ -58,7 +58,7 @@ OTABSL_NAMESPACE_BEGIN // Class template representing a compile-time integer sequence. An instantiation // of `integer_sequence` has a sequence of integers encoded in its // type through its template arguments (which is a common need when -// working with C++11 variadic templates). `absl::integer_sequence` is designed +// working with C++11 variadic templates). `absl::OTABSL_OPTION_NAMESPACE_NAME::integer_sequence` is designed // to be a drop-in replacement for C++14's `std::integer_sequence`. // // Example: @@ -81,7 +81,7 @@ struct integer_sequence { // index_sequence // // A helper template for an `integer_sequence` of `size_t`, -// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `absl::OTABSL_OPTION_NAMESPACE_NAME::index_sequence` is designed to be a drop-in replacement for C++14's // `std::index_sequence`. template using index_sequence = integer_sequence; @@ -169,7 +169,7 @@ using std::in_place; // in_place_t // // Tag type used to specify in-place construction, such as with -// `absl::optional`, designed to be a drop-in replacement for C++17's +// `absl::OTABSL_OPTION_NAMESPACE_NAME::optional`, designed to be a drop-in replacement for C++17's // `std::in_place_t`. struct in_place_t {}; @@ -185,7 +185,7 @@ using std::in_place_type_t; // in_place_type_t // // Tag type used for in-place construction when the type to construct needs to -// be specified, such as with `absl::any`, designed to be a drop-in replacement +// be specified, such as with `absl::OTABSL_OPTION_NAMESPACE_NAME::any`, designed to be a drop-in replacement // for C++17's `std::in_place_type_t`. template using in_place_type_t = void (*)(utility_internal::InPlaceTypeTag); @@ -202,7 +202,7 @@ using std::in_place_index_t; // in_place_index_t // // Tag type used for in-place construction when the type to construct needs to -// be specified, such as with `absl::any`, designed to be a drop-in replacement +// be specified, such as with `absl::OTABSL_OPTION_NAMESPACE_NAME::any`, designed to be a drop-in replacement // for C++17's `std::in_place_index_t`. template using in_place_index_t = void (*)(utility_internal::InPlaceIndexTag); @@ -218,8 +218,8 @@ void in_place_index(utility_internal::InPlaceIndexTag) {} // A constexpr version of `std::move()`, designed to be a drop-in replacement // for C++14's `std::move()`. template -constexpr absl::remove_reference_t&& move(T&& t) noexcept { - return static_cast&&>(t); +constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::remove_reference_t&& move(T&& t) noexcept { + return static_cast&&>(t); } // forward() @@ -228,7 +228,7 @@ constexpr absl::remove_reference_t&& move(T&& t) noexcept { // for C++14's `std::forward()`. template constexpr T&& forward( - absl::remove_reference_t& t) noexcept { // NOLINT(runtime/references) + absl::OTABSL_OPTION_NAMESPACE_NAME::remove_reference_t& t) noexcept { // NOLINT(runtime/references) return static_cast(t); } @@ -236,12 +236,12 @@ namespace utility_internal { // Helper method for expanding tuple into a called method. template auto apply_helper(Functor&& functor, Tuple&& t, index_sequence) - -> decltype(absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke( - absl::forward(functor), - std::get(absl::forward(t))...)) { - return absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::base_internal::Invoke( - absl::forward(functor), - std::get(absl::forward(t))...); + -> decltype(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke( + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(functor), + std::get(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t))...)) { + return absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke( + absl::OTABSL_OPTION_NAMESPACE_NAME::forward(functor), + std::get(absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t))...); } } // namespace utility_internal @@ -252,7 +252,7 @@ auto apply_helper(Functor&& functor, Tuple&& t, index_sequence) // Each element of the tuple corresponds to an argument of the call (in order). // Both the Callable argument and the tuple argument are perfect-forwarded. // For member-function Callables, the first tuple element acts as the `this` -// pointer. `absl::apply` is designed to be a drop-in replacement for C++17's +// pointer. `absl::OTABSL_OPTION_NAMESPACE_NAME::apply` is designed to be a drop-in replacement for C++17's // `std::apply`. Unlike C++17's `std::apply`, this is not currently `constexpr`. // // Example: @@ -269,57 +269,57 @@ auto apply_helper(Functor&& functor, Tuple&& t, index_sequence) // { // std::tuple tuple1(42, "bar"); // // Invokes the first user function on int, std::string. -// absl::apply(&user_function1, tuple1); +// absl::OTABSL_OPTION_NAMESPACE_NAME::apply(&user_function1, tuple1); // -// std::tuple> tuple2(absl::make_unique()); +// std::tuple> tuple2(absl::OTABSL_OPTION_NAMESPACE_NAME::make_unique()); // // Invokes the user function that takes ownership of the unique // // pointer. -// absl::apply(&user_function2, std::move(tuple2)); +// absl::OTABSL_OPTION_NAMESPACE_NAME::apply(&user_function2, std::move(tuple2)); // -// auto foo = absl::make_unique(); +// auto foo = absl::OTABSL_OPTION_NAMESPACE_NAME::make_unique(); // std::tuple tuple3(foo.get(), 42); // // Invokes the method Bar on foo with one argument, 42. -// absl::apply(&Foo::Bar, tuple3); +// absl::OTABSL_OPTION_NAMESPACE_NAME::apply(&Foo::Bar, tuple3); // // std::tuple tuple4(8, 9); // // Invokes a lambda. -// absl::apply(user_lambda, tuple4); +// absl::OTABSL_OPTION_NAMESPACE_NAME::apply(user_lambda, tuple4); // } template auto apply(Functor&& functor, Tuple&& t) -> decltype(utility_internal::apply_helper( - absl::forward(functor), absl::forward(t), - absl::make_index_sequence(functor), absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t), + absl::OTABSL_OPTION_NAMESPACE_NAME::make_index_sequence::type>::value>{})) { return utility_internal::apply_helper( - absl::forward(functor), absl::forward(t), - absl::make_index_sequence(functor), absl::OTABSL_OPTION_NAMESPACE_NAME::forward(t), + absl::OTABSL_OPTION_NAMESPACE_NAME::make_index_sequence::type>::value>{}); } // exchange // // Replaces the value of `obj` with `new_value` and returns the old value of -// `obj`. `absl::exchange` is designed to be a drop-in replacement for C++14's +// `obj`. `absl::OTABSL_OPTION_NAMESPACE_NAME::exchange` is designed to be a drop-in replacement for C++14's // `std::exchange`. // // Example: // // Foo& operator=(Foo&& other) { -// ptr1_ = absl::exchange(other.ptr1_, nullptr); -// int1_ = absl::exchange(other.int1_, -1); +// ptr1_ = absl::OTABSL_OPTION_NAMESPACE_NAME::exchange(other.ptr1_, nullptr); +// int1_ = absl::OTABSL_OPTION_NAMESPACE_NAME::exchange(other.int1_, -1); // return *this; // } template T exchange(T& obj, U&& new_value) { - T old_value = absl::move(obj); - obj = absl::forward(new_value); + T old_value = absl::OTABSL_OPTION_NAMESPACE_NAME::move(obj); + obj = absl::OTABSL_OPTION_NAMESPACE_NAME::forward(new_value); return old_value; } namespace utility_internal { template -T make_from_tuple_impl(Tuple&& tup, absl::index_sequence) { +T make_from_tuple_impl(Tuple&& tup, absl::OTABSL_OPTION_NAMESPACE_NAME::index_sequence) { return T(std::get(std::forward(tup))...); } } // namespace utility_internal @@ -333,15 +333,15 @@ T make_from_tuple_impl(Tuple&& tup, absl::index_sequence) { // Example: // // std::tuple args("hello world", 5); -// auto s = absl::make_from_tuple(args); +// auto s = absl::OTABSL_OPTION_NAMESPACE_NAME::make_from_tuple(args); // assert(s == "hello"); // template constexpr T make_from_tuple(Tuple&& tup) { return utility_internal::make_from_tuple_impl( std::forward(tup), - absl::make_index_sequence< - std::tuple_size>::value>{}); + absl::OTABSL_OPTION_NAMESPACE_NAME::make_index_sequence< + std::tuple_size>::value>{}); } OTABSL_NAMESPACE_END diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/variant.h b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/variant.h index 6f3837c5883..02df092d0f0 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/variant.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/nostd/variant.h @@ -66,7 +66,6 @@ namespace nostd { # ifdef HAVE_ABSEIL using absl::bad_variant_access; -# endif using absl::get; using absl::get_if; using absl::holds_alternative; @@ -75,6 +74,16 @@ using absl::variant; using absl::variant_alternative_t; using absl::variant_size; using absl::visit; +# else +using absl::OTABSL_OPTION_NAMESPACE_NAME::get; +using absl::OTABSL_OPTION_NAMESPACE_NAME::get_if; +using absl::OTABSL_OPTION_NAMESPACE_NAME::holds_alternative; +using absl::OTABSL_OPTION_NAMESPACE_NAME::monostate; +using absl::OTABSL_OPTION_NAMESPACE_NAME::variant; +using absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative_t; +using absl::OTABSL_OPTION_NAMESPACE_NAME::variant_size; +using absl::OTABSL_OPTION_NAMESPACE_NAME::visit; +# endif } // namespace nostd OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/client_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/client_attributes.h new file mode 100644 index 00000000000..ec984cc4061 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/error_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/error_attributes.h new file mode 100644 index 00000000000..1b711ff112d --- /dev/null +++ b/deps/opentelemetry-cpp/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:

  • Use a domain-specific attribute
  • Set + * @code error.type @endcode to capture all errors, regardless of whether they are defined within + * the domain-specific set or not.
  • + *
+ */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/exception_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/exception_attributes.h new file mode 100644 index 00000000000..fdc19ac6d0e --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_attributes.h new file mode 100644 index 00000000000..6011674e842 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_metrics.h new file mode 100644 index 00000000000..f83172e80ec --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/http_metrics.h @@ -0,0 +1,79 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientRequestDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientRequestDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/artifact_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/artifact_attributes.h new file mode 100644 index 00000000000..d3bb99f6e5b --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/aws_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/aws_attributes.h new file mode 100644 index 00000000000..d0eaa6d08a0 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/az_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/az_attributes.h new file mode 100644 index 00000000000..2ce360d870c --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/az_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 az +{ + +/** + * Azure + * Resource Provider Namespace as recognized by the client. + */ +static constexpr const char *kAzNamespace = "az.namespace"; + +/** + * 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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/browser_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/browser_attributes.h new file mode 100644 index 00000000000..5ddb61eae54 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cicd_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cicd_attributes.h new file mode 100644 index 00000000000..246563a8e8d --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/client_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/client_attributes.h new file mode 100644 index 00000000000..ec984cc4061 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloud_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloud_attributes.h new file mode 100644 index 00000000000..6720eb3edf8 --- /dev/null +++ b/deps/opentelemetry-cpp/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:

  • AWS Lambda: The function ARN. Take + * care not to use the "invoked ARN" directly but replace any alias suffix + * with the resolved function version, as the same runtime instance may be invocable with + * multiple different aliases.
  • + *
  • GCP: The URI of the resource
  • + *
  • Azure: The Fully Qualified Resource + * ID of the invoked function, not the function app, having the form + * @code + * /subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/ + * @endcode. This means that a span attribute MUST be used, as an Azure function app can host + * multiple functions that would usually share a TracerProvider.
  • + *
+ */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h new file mode 100644 index 00000000000..363feed1570 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h new file mode 100644 index 00000000000..0eda006baa6 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h @@ -0,0 +1,138 @@ +/* + * 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 cloudfoundry +{ + +/** + * The guid of the application. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.application_id @endcode. This is the same value as + * reported by @code cf app --guid @endcode. + */ +static constexpr const char *kCloudfoundryAppId = "cloudfoundry.app.id"; + +/** + * The index of the application instance. 0 when just one instance is active. + *

+ * CloudFoundry defines the @code instance_id @endcode in the Loggegator v2 envelope. It + * is used for logs and metrics emitted by CloudFoundry. It is supposed to contain the application + * instance index for applications deployed on the runtime.

Application instrumentation should + * use the value from environment variable @code CF_INSTANCE_INDEX @endcode. + */ +static constexpr const char *kCloudfoundryAppInstanceId = "cloudfoundry.app.instance.id"; + +/** + * The name of the application. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.application_name @endcode. This is the same value + * as reported by @code cf apps @endcode. + */ +static constexpr const char *kCloudfoundryAppName = "cloudfoundry.app.name"; + +/** + * The guid of the CloudFoundry org the application is running in. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.org_id @endcode. This is the same value as + * reported by @code cf org --guid @endcode. + */ +static constexpr const char *kCloudfoundryOrgId = "cloudfoundry.org.id"; + +/** + * The name of the CloudFoundry organization the app is running in. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.org_name @endcode. This is the same value as + * reported by @code cf orgs @endcode. + */ +static constexpr const char *kCloudfoundryOrgName = "cloudfoundry.org.name"; + +/** + * The UID identifying the process. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.process_id @endcode. It is supposed to be equal to + * @code VCAP_APPLICATION.app_id @endcode for applications deployed to the runtime. + * For system components, this could be the actual PID. + */ +static constexpr const char *kCloudfoundryProcessId = "cloudfoundry.process.id"; + +/** + * The type of process. + *

+ * CloudFoundry applications can consist of multiple jobs. Usually the + * main process will be of type @code web @endcode. There can be additional background + * tasks or side-cars with different process types. + */ +static constexpr const char *kCloudfoundryProcessType = "cloudfoundry.process.type"; + +/** + * The guid of the CloudFoundry space the application is running in. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.space_id @endcode. This is the same value as + * reported by @code cf space --guid @endcode. + */ +static constexpr const char *kCloudfoundrySpaceId = "cloudfoundry.space.id"; + +/** + * The name of the CloudFoundry space the application is running in. + *

+ * Application instrumentation should use the value from environment + * variable @code VCAP_APPLICATION.space_name @endcode. This is the same value as + * reported by @code cf spaces @endcode. + */ +static constexpr const char *kCloudfoundrySpaceName = "cloudfoundry.space.name"; + +/** + * A guid or another name describing the event source. + *

+ * CloudFoundry defines the @code source_id @endcode in the Loggregator v2 envelope. + * It is used for logs and metrics emitted by CloudFoundry. It is + * supposed to contain the component name, e.g. "gorouter", for + * CloudFoundry components. + *

+ * When system components are instrumented, values from the + * Bosh spec + * should be used. The @code system.id @endcode should be set to + * @code spec.deployment/spec.name @endcode. + */ +static constexpr const char *kCloudfoundrySystemId = "cloudfoundry.system.id"; + +/** + * A guid describing the concrete instance of the event source. + *

+ * CloudFoundry defines the @code instance_id @endcode in the Loggregator v2 envelope. + * It is used for logs and metrics emitted by CloudFoundry. It is + * supposed to contain the vm id for CloudFoundry components. + *

+ * When system components are instrumented, values from the + * Bosh spec + * should be used. The @code system.instance.id @endcode should be set to @code spec.id @endcode. + */ +static constexpr const char *kCloudfoundrySystemInstanceId = "cloudfoundry.system.instance.id"; + +} // namespace cloudfoundry +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/code_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/code_attributes.h new file mode 100644 index 00000000000..f2715e87b66 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_attributes.h new file mode 100644 index 00000000000..2ea7810b308 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_attributes.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_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. + */ +static constexpr const char *kContainerCommandArgs = "container.command_args"; + +/** + * The full command run by the container as a single string representing the full command. + */ +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"; + +/** + * The name of the CSI (Container + * Storage Interface) plugin used by the volume.

This can sometimes be referred to as a + * "driver" in CSI implementations. This should represent the @code name @endcode field of the + * GetPluginInfo RPC. + */ +static constexpr const char *kContainerCsiPluginName = "container.csi.plugin.name"; + +/** + * The unique volume ID returned by the CSI (Container Storage Interface) + * plugin.

This can sometimes be referred to as a "volume handle" in CSI implementations. This + * should represent the @code Volume.volume_id @endcode field in CSI spec. + */ +static constexpr const char *kContainerCsiVolumeId = "container.csi.volume.id"; + +/** + * 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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_metrics.h new file mode 100644 index 00000000000..8fa2541b329 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/container_metrics.h @@ -0,0 +1,224 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> CreateSyncInt64MetricContainerCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerCpuTime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerCpuTime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricContainerCpuTime, descrMetricContainerCpuTime, + unitMetricContainerCpuTime); +} + +/** + * Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs + *

+ * CPU usage of the specific container on all available CPU cores, averaged over the sample window + *

+ * gauge + */ +static constexpr const char *kMetricContainerCpuUsage = "metric.container.cpu.usage"; +static constexpr const char *descrMetricContainerCpuUsage = + "Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs"; +static constexpr const char *unitMetricContainerCpuUsage = "{cpu}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricContainerCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage, + unitMetricContainerCpuUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage, + unitMetricContainerCpuUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerCpuUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage, + unitMetricContainerCpuUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerCpuUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage, + unitMetricContainerCpuUsage); +} + +/** + * 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 inline nostd::unique_ptr> CreateSyncInt64MetricContainerDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerDiskIo, descrMetricContainerDiskIo, + unitMetricContainerDiskIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerDiskIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricContainerDiskIo, descrMetricContainerDiskIo, + unitMetricContainerDiskIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerDiskIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricContainerDiskIo, descrMetricContainerDiskIo, + unitMetricContainerDiskIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerDiskIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricContainerMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, + unitMetricContainerMemoryUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricContainerMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, + unitMetricContainerMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, unitMetricContainerMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> CreateSyncInt64MetricContainerNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerNetworkIo, descrMetricContainerNetworkIo, + unitMetricContainerNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricContainerNetworkIo, descrMetricContainerNetworkIo, + unitMetricContainerNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricContainerNetworkIo, descrMetricContainerNetworkIo, unitMetricContainerNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricContainerNetworkIo, descrMetricContainerNetworkIo, unitMetricContainerNetworkIo); +} + +} // namespace container +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cpu_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/cpu_attributes.h new file mode 100644 index 00000000000..b5ca637e312 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_attributes.h new file mode 100644 index 00000000000..7c5d3304bbd --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_attributes.h @@ -0,0 +1,841 @@ +/* + * 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. This attribute has stability level + * RELEASE CANDIDATE. + */ +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"; + +/** + * Cosmos DB 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"; + +/** + * Deprecated, use @code db.response.status_code @endcode instead. + *

+ * @deprecated + * Replaced by @code db.response.status_code @endcode. + */ +OPENTELEMETRY_DEPRECATED +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. This attribute has stability + * level RELEASE CANDIDATE. + */ +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. This attribute has stability + * level RELEASE CANDIDATE. + */ +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. This attribute has stability level + * RELEASE CANDIDATE. + */ +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. This attribute has stability level RELEASE CANDIDATE. + */ +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. This attribute has stability + * level RELEASE CANDIDATE. + */ +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"; + +/** + * Database response status code. + *

+ * The status code returned by the database. Usually it represents an error code, but may also + * represent partial success, warning, or differentiate between various types of successful + * outcomes. Semantic conventions for individual database systems SHOULD document what @code + * db.response.status_code @endcode means in the context of that system. This attribute has + * stability level RELEASE CANDIDATE. + */ +static constexpr const char *kDbResponseStatusCode = "db.response.status_code"; + +/** + * 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. This attribute has + * stability level RELEASE CANDIDATE. + */ +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 *kBatch = "batch"; + +/** + * none + */ +static constexpr const char *kCreate = "create"; + +/** + * none + */ +static constexpr const char *kDelete = "delete"; + +/** + * none + */ +static constexpr const char *kExecute = "execute"; + +/** + * none + */ +static constexpr const char *kExecuteJavascript = "execute_javascript"; + +/** + * none + */ +static constexpr const char *kInvalid = "invalid"; + +/** + * none + */ +static constexpr const char *kHead = "head"; + +/** + * none + */ +static constexpr const char *kHeadFeed = "head_feed"; + +/** + * none + */ +static constexpr const char *kPatch = "patch"; + +/** + * none + */ +static constexpr const char *kQuery = "query"; + +/** + * none + */ +static constexpr const char *kQueryPlan = "query_plan"; + +/** + * none + */ +static constexpr const char *kRead = "read"; + +/** + * none + */ +static constexpr const char *kReadFeed = "read_feed"; + +/** + * none + */ +static constexpr const char *kReplace = "replace"; + +/** + * none + */ +static constexpr const char *kUpsert = "upsert"; + +} // 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 (This value has stability level RELEASE CANDIDATE) + */ +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 (This value has stability level RELEASE CANDIDATE) + */ +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 (This value has stability level RELEASE CANDIDATE) + */ +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 (This value has stability level RELEASE CANDIDATE) + */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_metrics.h new file mode 100644 index 00000000000..d3dd52190e5 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/db_metrics.h @@ -0,0 +1,816 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionCount, + descrMetricDbClientConnectionCount, + unitMetricDbClientConnectionCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionCount, + descrMetricDbClientConnectionCount, + unitMetricDbClientConnectionCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionCount, + descrMetricDbClientConnectionCount, + unitMetricDbClientConnectionCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionCreateTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionCreateTime, + descrMetricDbClientConnectionCreateTime, + unitMetricDbClientConnectionCreateTime); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionCreateTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionIdleMax(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionIdleMax, + descrMetricDbClientConnectionIdleMax, + unitMetricDbClientConnectionIdleMax); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionIdleMax(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionIdleMax, + descrMetricDbClientConnectionIdleMax, + unitMetricDbClientConnectionIdleMax); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionIdleMax(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionIdleMax, + descrMetricDbClientConnectionIdleMax, + unitMetricDbClientConnectionIdleMax); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionIdleMax(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionIdleMin(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionIdleMin, + descrMetricDbClientConnectionIdleMin, + unitMetricDbClientConnectionIdleMin); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionIdleMin(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionIdleMin, + descrMetricDbClientConnectionIdleMin, + unitMetricDbClientConnectionIdleMin); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionIdleMin(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionIdleMin, + descrMetricDbClientConnectionIdleMin, + unitMetricDbClientConnectionIdleMin); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionIdleMin(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionMax(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionMax(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionMax(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionMax(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionMax, + descrMetricDbClientConnectionMax, + unitMetricDbClientConnectionMax); +} + +/** + * The number of current pending requests for an open connection + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientConnectionPendingRequests = + "metric.db.client.connection.pending_requests"; +static constexpr const char *descrMetricDbClientConnectionPendingRequests = + "The number of current pending requests for an open connection"; +static constexpr const char *unitMetricDbClientConnectionPendingRequests = "{request}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionPendingRequests, + descrMetricDbClientConnectionPendingRequests, + unitMetricDbClientConnectionPendingRequests); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionPendingRequests, + descrMetricDbClientConnectionPendingRequests, + unitMetricDbClientConnectionPendingRequests); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionPendingRequests, + descrMetricDbClientConnectionPendingRequests, + unitMetricDbClientConnectionPendingRequests); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionPendingRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionTimeouts(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricDbClientConnectionTimeouts, + descrMetricDbClientConnectionTimeouts, + unitMetricDbClientConnectionTimeouts); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionTimeouts(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricDbClientConnectionTimeouts, + descrMetricDbClientConnectionTimeouts, + unitMetricDbClientConnectionTimeouts); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionTimeouts(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionTimeouts, + descrMetricDbClientConnectionTimeouts, + unitMetricDbClientConnectionTimeouts); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionTimeouts(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionUseTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionUseTime, + descrMetricDbClientConnectionUseTime, + unitMetricDbClientConnectionUseTime); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionUseTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionWaitTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionWaitTime, + descrMetricDbClientConnectionWaitTime, + unitMetricDbClientConnectionWaitTime); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionWaitTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsCreateTimeDeprecated = + "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsCreateTimeDeprecated = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsCreateTimeDeprecated, + descrMetricDbClientConnectionsCreateTimeDeprecated, + unitMetricDbClientConnectionsCreateTimeDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsIdleMaxDeprecated = + "Deprecated, use `db.client.connection.idle.max` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsIdleMaxDeprecated = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, + descrMetricDbClientConnectionsIdleMaxDeprecated, + unitMetricDbClientConnectionsIdleMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, + descrMetricDbClientConnectionsIdleMaxDeprecated, + unitMetricDbClientConnectionsIdleMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, + descrMetricDbClientConnectionsIdleMaxDeprecated, + unitMetricDbClientConnectionsIdleMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsIdleMinDeprecated = + "Deprecated, use `db.client.connection.idle.min` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsIdleMinDeprecated = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, + descrMetricDbClientConnectionsIdleMinDeprecated, + unitMetricDbClientConnectionsIdleMinDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, + descrMetricDbClientConnectionsIdleMinDeprecated, + unitMetricDbClientConnectionsIdleMinDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, + descrMetricDbClientConnectionsIdleMinDeprecated, + unitMetricDbClientConnectionsIdleMinDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsMaxDeprecated = + "Deprecated, use `db.client.connection.max` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsMaxDeprecated = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsMaxDeprecated, + descrMetricDbClientConnectionsMaxDeprecated, + unitMetricDbClientConnectionsMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, + descrMetricDbClientConnectionsMaxDeprecated, + unitMetricDbClientConnectionsMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, + descrMetricDbClientConnectionsMaxDeprecated, + unitMetricDbClientConnectionsMaxDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsPendingRequestsDeprecated = + "Deprecated, use `db.client.connection.pending_requests` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsPendingRequestsDeprecated = "{request}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsPendingRequestsDeprecated, + descrMetricDbClientConnectionsPendingRequestsDeprecated, + unitMetricDbClientConnectionsPendingRequestsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsPendingRequestsDeprecated, + descrMetricDbClientConnectionsPendingRequestsDeprecated, + unitMetricDbClientConnectionsPendingRequestsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricDbClientConnectionsPendingRequestsDeprecated, + descrMetricDbClientConnectionsPendingRequestsDeprecated, + unitMetricDbClientConnectionsPendingRequestsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsTimeoutsDeprecated = + "Deprecated, use `db.client.connection.timeouts` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsTimeoutsDeprecated = "{timeout}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricDbClientConnectionsTimeoutsDeprecated, + descrMetricDbClientConnectionsTimeoutsDeprecated, + unitMetricDbClientConnectionsTimeoutsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricDbClientConnectionsTimeoutsDeprecated, + descrMetricDbClientConnectionsTimeoutsDeprecated, + unitMetricDbClientConnectionsTimeoutsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionsTimeoutsDeprecated, + descrMetricDbClientConnectionsTimeoutsDeprecated, + unitMetricDbClientConnectionsTimeoutsDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsCountDeprecated = + "Deprecated, use `db.client.connection.count` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsCountDeprecated = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsCountDeprecated, + descrMetricDbClientConnectionsCountDeprecated, + unitMetricDbClientConnectionsCountDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsCountDeprecated, + descrMetricDbClientConnectionsCountDeprecated, + unitMetricDbClientConnectionsCountDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsCountDeprecated, + descrMetricDbClientConnectionsCountDeprecated, + unitMetricDbClientConnectionsCountDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsUseTimeDeprecated = + "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsUseTimeDeprecated = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsUseTimeDeprecated, + descrMetricDbClientConnectionsUseTimeDeprecated, + unitMetricDbClientConnectionsUseTimeDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsWaitTimeDeprecated = + "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsWaitTimeDeprecated = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsWaitTimeDeprecated, + descrMetricDbClientConnectionsWaitTimeDeprecated, + unitMetricDbClientConnectionsWaitTimeDeprecated); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientOperationDuration, + descrMetricDbClientOperationDuration, + unitMetricDbClientOperationDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientOperationDuration, + descrMetricDbClientOperationDuration, + unitMetricDbClientOperationDuration); +} + +} // namespace db +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/deployment_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/deployment_attributes.h new file mode 100644 index 00000000000..9c4594b7f3b --- /dev/null +++ b/deps/opentelemetry-cpp/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:

    + *
  • @code service.name=frontend @endcode, @code deployment.environment.name=production + * @endcode
  • @code service.name=frontend @endcode, @code deployment.environment.name=staging + * @endcode.
  • + *
+ */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/destination_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/destination_attributes.h new file mode 100644 index 00000000000..5069fc03b7d --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/device_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/device_attributes.h new file mode 100644 index 00000000000..c2c80f5fd2f --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/disk_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/disk_attributes.h new file mode 100644 index 00000000000..ff938a96121 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_attributes.h new file mode 100644 index 00000000000..b835e2a73ad --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_metrics.h new file mode 100644 index 00000000000..7f3915870bd --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/dns_metrics.h @@ -0,0 +1,49 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricDnsLookupDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDnsLookupDuration, descrMetricDnsLookupDuration, + unitMetricDnsLookupDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricDnsLookupDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDnsLookupDuration, descrMetricDnsLookupDuration, + unitMetricDnsLookupDuration); +} + +} // namespace dns +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/enduser_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/enduser_attributes.h new file mode 100644 index 00000000000..217d5dd414b --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/error_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/error_attributes.h new file mode 100644 index 00000000000..1b711ff112d --- /dev/null +++ b/deps/opentelemetry-cpp/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:

  • Use a domain-specific attribute
  • Set + * @code error.type @endcode to capture all errors, regardless of whether they are defined within + * the domain-specific set or not.
  • + *
+ */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/event_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/event_attributes.h new file mode 100644 index 00000000000..c2faa437cf5 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/exception_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/exception_attributes.h new file mode 100644 index 00000000000..fdc19ac6d0e --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_attributes.h new file mode 100644 index 00000000000..ed9076ec39b --- /dev/null +++ b/deps/opentelemetry-cpp/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.

  • AWS Lambda: Use the (full) + * log stream name.
  • + *
+ */ +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:

    + *
  • Azure: The full name @code / @endcode, i.e., function app + * name followed by a forward slash followed by the function name (this form can also be seen in the + * resource JSON for the function). This means that a span attribute MUST be used, as an Azure + * function app can host multiple functions that would usually share a TracerProvider (see also the + * @code cloud.resource_id @endcode attribute).
  • + *
+ */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_metrics.h new file mode 100644 index 00000000000..73dc2989a62 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/faas_metrics.h @@ -0,0 +1,287 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasColdstarts( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasColdstarts, descrMetricFaasColdstarts, + unitMetricFaasColdstarts); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasColdstarts( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricFaasColdstarts, descrMetricFaasColdstarts, + unitMetricFaasColdstarts); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricFaasColdstarts( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasColdstarts, descrMetricFaasColdstarts, + unitMetricFaasColdstarts); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricFaasColdstarts(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasCpuUsage, descrMetricFaasCpuUsage, + unitMetricFaasCpuUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasErrors, descrMetricFaasErrors, unitMetricFaasErrors); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricFaasErrors, descrMetricFaasErrors, unitMetricFaasErrors); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasErrors, descrMetricFaasErrors, + unitMetricFaasErrors); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricFaasErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasInitDuration( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasInitDuration, descrMetricFaasInitDuration, + unitMetricFaasInitDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasInitDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasInvocations( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasInvocations, descrMetricFaasInvocations, + unitMetricFaasInvocations); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasInvocations( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricFaasInvocations, descrMetricFaasInvocations, + unitMetricFaasInvocations); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricFaasInvocations(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasInvocations, descrMetricFaasInvocations, + unitMetricFaasInvocations); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricFaasInvocations(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricFaasInvokeDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasInvokeDuration, descrMetricFaasInvokeDuration, + unitMetricFaasInvokeDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricFaasInvokeDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasMemUsage( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasMemUsage, descrMetricFaasMemUsage, + unitMetricFaasMemUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasMemUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasNetIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricFaasNetIo, descrMetricFaasNetIo, unitMetricFaasNetIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasNetIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> CreateSyncInt64MetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricFaasTimeouts( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricFaasTimeouts, descrMetricFaasTimeouts, + unitMetricFaasTimeouts); +} + +} // namespace faas +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h new file mode 100644 index 00000000000..3cd8b8eb2c1 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/file_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/file_attributes.h new file mode 100644 index 00000000000..2ac4fc4b55d --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/file_attributes.h @@ -0,0 +1,144 @@ +/* + * 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 +{ + +/** + * Time when the file was last accessed, in ISO 8601 format. + *

+ * This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc. + */ +static constexpr const char *kFileAccessed = "file.accessed"; + +/** + * Array of file attributes. + *

+ * Attributes names depend on the OS or file system. Here’s a non-exhaustive list of values expected + * for this attribute: @code archive @endcode, @code compressed @endcode, @code directory @endcode, + * @code encrypted @endcode, @code execute @endcode, @code hidden @endcode, @code immutable + * @endcode, @code journaled @endcode, @code read @endcode, @code readonly @endcode, @code symbolic + * link @endcode, @code system @endcode, @code temporary @endcode, @code write @endcode. + */ +static constexpr const char *kFileAttributes = "file.attributes"; + +/** + * Time when the file attributes or metadata was last changed, in ISO 8601 format. + *

+ * @code file.changed @endcode captures the time when any of the file's properties or attributes + * (including the content) are changed, while @code file.modified @endcode captures the timestamp + * when the file content is modified. + */ +static constexpr const char *kFileChanged = "file.changed"; + +/** + * Time when the file was created, in ISO 8601 format. + *

+ * This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc. + */ +static constexpr const char *kFileCreated = "file.created"; + +/** + * 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 fork. A fork is additional data associated with a filesystem object. + *

+ * On Linux, a resource fork is used to store additional data with a filesystem object. A file + * always has at least one fork for the data portion, and additional forks may exist. On NTFS, this + * is analogous to an Alternate Data Stream (ADS), and the default data stream for a file is just + * called $DATA. Zone.Identifier is commonly used by Windows to track contents downloaded from the + * Internet. An ADS is typically of the form: C:\path\to\filename.extension:some_fork_name, and + * some_fork_name is the value that should populate @code fork_name @endcode. @code + * filename.extension @endcode should populate @code file.name @endcode, and @code extension + * @endcode should populate @code file.extension @endcode. The full path, @code file.path @endcode, + * will include the fork name. + */ +static constexpr const char *kFileForkName = "file.fork_name"; + +/** + * Primary Group ID (GID) of the file. + */ +static constexpr const char *kFileGroupId = "file.group.id"; + +/** + * Primary group name of the file. + */ +static constexpr const char *kFileGroupName = "file.group.name"; + +/** + * Inode representing the file in the filesystem. + */ +static constexpr const char *kFileInode = "file.inode"; + +/** + * Mode of the file in octal representation. + */ +static constexpr const char *kFileMode = "file.mode"; + +/** + * Time when the file content was last modified, in ISO 8601 format. + */ +static constexpr const char *kFileModified = "file.modified"; + +/** + * Name of the file including the extension, without the directory. + */ +static constexpr const char *kFileName = "file.name"; + +/** + * The user ID (UID) or security identifier (SID) of the file owner. + */ +static constexpr const char *kFileOwnerId = "file.owner.id"; + +/** + * Username of the file owner. + */ +static constexpr const char *kFileOwnerName = "file.owner.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"; + +/** + * Path to the target of a symbolic link. + *

+ * This attribute is only applicable to symbolic links. + */ +static constexpr const char *kFileSymbolicLinkTargetPath = "file.symbolic_link.target_path"; + +} // namespace file +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gcp_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gcp_attributes.h new file mode 100644 index 00000000000..53518251bbf --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h new file mode 100644 index 00000000000..ce4a939d07e --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h @@ -0,0 +1,263 @@ +/* + * 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 +{ + +/** + * Deprecated, use Event API to report completions contents. + *

+ * @deprecated + * Removed, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiCompletion = "gen_ai.completion"; + +/** + * The response format that is requested. + */ +static constexpr const char *kGenAiOpenaiRequestResponseFormat = + "gen_ai.openai.request.response_format"; + +/** + * Requests with same seed value more likely to return same result. + */ +static constexpr const char *kGenAiOpenaiRequestSeed = "gen_ai.openai.request.seed"; + +/** + * The service tier requested. May be a specific tier, detault, or auto. + */ +static constexpr const char *kGenAiOpenaiRequestServiceTier = "gen_ai.openai.request.service_tier"; + +/** + * The service tier used for the response. + */ +static constexpr const char *kGenAiOpenaiResponseServiceTier = + "gen_ai.openai.response.service_tier"; + +/** + * 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"; + +/** + * Deprecated, use Event API to report prompt contents. + *

+ * @deprecated + * Removed, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +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 GenAiOpenaiRequestResponseFormatValues +{ +/** + * Text response format + */ +static constexpr const char *kText = "text"; + +/** + * JSON object response format + */ +static constexpr const char *kJsonObject = "json_object"; + +/** + * JSON schema response format + */ +static constexpr const char *kJsonSchema = "json_schema"; + +} // namespace GenAiOpenaiRequestResponseFormatValues + +namespace GenAiOpenaiRequestServiceTierValues +{ +/** + * The system will utilize scale tier credits until they are exhausted. + */ +static constexpr const char *kAuto = "auto"; + +/** + * The system will utilize the default scale tier. + */ +static constexpr const char *kDefault = "default"; + +} // namespace GenAiOpenaiRequestServiceTierValues + +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h new file mode 100644 index 00000000000..6a9064c3e72 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h @@ -0,0 +1,158 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricGenAiClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiClientOperationDuration, + descrMetricGenAiClientOperationDuration, + unitMetricGenAiClientOperationDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricGenAiClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricGenAiClientTokenUsage(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiClientTokenUsage, + descrMetricGenAiClientTokenUsage, + unitMetricGenAiClientTokenUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricGenAiClientTokenUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricGenAiServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerRequestDuration, + descrMetricGenAiServerRequestDuration, + unitMetricGenAiServerRequestDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricGenAiServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricGenAiServerTimePerOutputToken(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerTimePerOutputToken, + descrMetricGenAiServerTimePerOutputToken, + unitMetricGenAiServerTimePerOutputToken); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricGenAiServerTimePerOutputToken(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricGenAiServerTimeToFirstToken(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricGenAiServerTimeToFirstToken, + descrMetricGenAiServerTimeToFirstToken, + unitMetricGenAiServerTimeToFirstToken); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricGenAiServerTimeToFirstToken(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricGenAiServerTimeToFirstToken, + descrMetricGenAiServerTimeToFirstToken, + unitMetricGenAiServerTimeToFirstToken); +} + +} // namespace gen_ai +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/graphql_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/graphql_attributes.h new file mode 100644 index 00000000000..fe899d1c69b --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/heroku_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/heroku_attributes.h new file mode 100644 index 00000000000..a16bd331617 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/host_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/host_attributes.h new file mode 100644 index 00000000000..e608bd5d460 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_attributes.h new file mode 100644 index 00000000000..8f909f5297e --- /dev/null +++ b/deps/opentelemetry-cpp/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. @endcode instead. + *

+ * @deprecated + * Replaced by @code http.request.header. @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. @endcode instead. + *

+ * @deprecated + * Replaced by @code http.response.header. @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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_metrics.h new file mode 100644 index 00000000000..9142b6c44f5 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/http_metrics.h @@ -0,0 +1,353 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientActiveRequests(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpClientActiveRequests, + descrMetricHttpClientActiveRequests, + unitMetricHttpClientActiveRequests); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientActiveRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricHttpClientActiveRequests, + descrMetricHttpClientActiveRequests, + unitMetricHttpClientActiveRequests); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricHttpClientActiveRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpClientActiveRequests, + descrMetricHttpClientActiveRequests, + unitMetricHttpClientActiveRequests); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricHttpClientActiveRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientConnectionDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientConnectionDuration, + descrMetricHttpClientConnectionDuration, + unitMetricHttpClientConnectionDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientConnectionDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientOpenConnections(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpClientOpenConnections, + descrMetricHttpClientOpenConnections, + unitMetricHttpClientOpenConnections); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientOpenConnections(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricHttpClientOpenConnections, + descrMetricHttpClientOpenConnections, + unitMetricHttpClientOpenConnections); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricHttpClientOpenConnections(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpClientOpenConnections, + descrMetricHttpClientOpenConnections, + unitMetricHttpClientOpenConnections); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricHttpClientOpenConnections(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientRequestBodySize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestBodySize, + descrMetricHttpClientRequestBodySize, + unitMetricHttpClientRequestBodySize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientRequestBodySize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientRequestDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientRequestDuration, + descrMetricHttpClientRequestDuration, + unitMetricHttpClientRequestDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientRequestDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpClientResponseBodySize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpClientResponseBodySize, + descrMetricHttpClientResponseBodySize, + unitMetricHttpClientResponseBodySize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpClientResponseBodySize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpServerActiveRequests(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHttpServerActiveRequests, + descrMetricHttpServerActiveRequests, + unitMetricHttpServerActiveRequests); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpServerActiveRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricHttpServerActiveRequests, + descrMetricHttpServerActiveRequests, + unitMetricHttpServerActiveRequests); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricHttpServerActiveRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHttpServerActiveRequests, + descrMetricHttpServerActiveRequests, + unitMetricHttpServerActiveRequests); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricHttpServerActiveRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpServerRequestBodySize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestBodySize, + descrMetricHttpServerRequestBodySize, + unitMetricHttpServerRequestBodySize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpServerRequestBodySize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerRequestDuration, + descrMetricHttpServerRequestDuration, + unitMetricHttpServerRequestDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpServerRequestDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricHttpServerResponseBodySize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricHttpServerResponseBodySize, + descrMetricHttpServerResponseBodySize, + unitMetricHttpServerResponseBodySize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricHttpServerResponseBodySize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricHttpServerResponseBodySize, + descrMetricHttpServerResponseBodySize, + unitMetricHttpServerResponseBodySize); +} + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_attributes.h new file mode 100644 index 00000000000..d87fe1f3db1 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_attributes.h @@ -0,0 +1,148 @@ +/* + * 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 hw +{ + +/** + * An identifier for the hardware component, unique within the monitored host + */ +static constexpr const char *kHwId = "hw.id"; + +/** + * An easily-recognizable name for the hardware component + */ +static constexpr const char *kHwName = "hw.name"; + +/** + * Unique identifier of the parent component (typically the @code hw.id @endcode attribute of the + * enclosure, or disk controller) + */ +static constexpr const char *kHwParent = "hw.parent"; + +/** + * The current state of the component + */ +static constexpr const char *kHwState = "hw.state"; + +/** + * Type of the component + *

+ * Describes the category of the hardware component for which @code hw.state @endcode is being + * reported. For example, @code hw.type=temperature @endcode along with @code hw.state=degraded + * @endcode would indicate that the temperature of the hardware component has been reported as @code + * degraded @endcode. + */ +static constexpr const char *kHwType = "hw.type"; + +namespace HwStateValues +{ +/** + * Ok + */ +static constexpr const char *kOk = "ok"; + +/** + * Degraded + */ +static constexpr const char *kDegraded = "degraded"; + +/** + * Failed + */ +static constexpr const char *kFailed = "failed"; + +} // namespace HwStateValues + +namespace HwTypeValues +{ +/** + * Battery + */ +static constexpr const char *kBattery = "battery"; + +/** + * CPU + */ +static constexpr const char *kCpu = "cpu"; + +/** + * Disk controller + */ +static constexpr const char *kDiskController = "disk_controller"; + +/** + * Enclosure + */ +static constexpr const char *kEnclosure = "enclosure"; + +/** + * Fan + */ +static constexpr const char *kFan = "fan"; + +/** + * GPU + */ +static constexpr const char *kGpu = "gpu"; + +/** + * Logical disk + */ +static constexpr const char *kLogicalDisk = "logical_disk"; + +/** + * Memory + */ +static constexpr const char *kMemory = "memory"; + +/** + * Network + */ +static constexpr const char *kNetwork = "network"; + +/** + * Physical disk + */ +static constexpr const char *kPhysicalDisk = "physical_disk"; + +/** + * Power supply + */ +static constexpr const char *kPowerSupply = "power_supply"; + +/** + * Tape drive + */ +static constexpr const char *kTapeDrive = "tape_drive"; + +/** + * Temperature + */ +static constexpr const char *kTemperature = "temperature"; + +/** + * Voltage + */ +static constexpr const char *kVoltage = "voltage"; + +} // namespace HwTypeValues + +} // namespace hw +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_metrics.h new file mode 100644 index 00000000000..3a87fd25064 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/hw_metrics.h @@ -0,0 +1,174 @@ +/* + * 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/metrics/meter.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace hw +{ + +/** + * Energy consumed by the component + *

+ * counter + */ +static constexpr const char *kMetricHwEnergy = "metric.hw.energy"; +static constexpr const char *descrMetricHwEnergy = "Energy consumed by the component"; +static constexpr const char *unitMetricHwEnergy = "J"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricHwEnergy( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricHwEnergy, descrMetricHwEnergy, unitMetricHwEnergy); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricHwEnergy( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricHwEnergy, descrMetricHwEnergy, unitMetricHwEnergy); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricHwEnergy( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricHwEnergy, descrMetricHwEnergy, + unitMetricHwEnergy); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricHwEnergy( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricHwEnergy, descrMetricHwEnergy, + unitMetricHwEnergy); +} + +/** + * Number of errors encountered by the component + *

+ * counter + */ +static constexpr const char *kMetricHwErrors = "metric.hw.errors"; +static constexpr const char *descrMetricHwErrors = "Number of errors encountered by the component"; +static constexpr const char *unitMetricHwErrors = "{error}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricHwErrors( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricHwErrors, descrMetricHwErrors, unitMetricHwErrors); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricHwErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricHwErrors, descrMetricHwErrors, unitMetricHwErrors); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricHwErrors( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricHwErrors, descrMetricHwErrors, + unitMetricHwErrors); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricHwErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricHwErrors, descrMetricHwErrors, + unitMetricHwErrors); +} + +/** + * Instantaneous power consumed by the component + *

+ * It is recommended to report @code hw.energy @endcode instead of @code hw.power @endcode when + * possible.

gauge + */ +static constexpr const char *kMetricHwPower = "metric.hw.power"; +static constexpr const char *descrMetricHwPower = "Instantaneous power consumed by the component"; +static constexpr const char *unitMetricHwPower = "W"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricHwPower( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricHwPower, descrMetricHwPower, unitMetricHwPower); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricHwPower( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricHwPower, descrMetricHwPower, unitMetricHwPower); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricHwPower( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricHwPower, descrMetricHwPower, unitMetricHwPower); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricHwPower( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricHwPower, descrMetricHwPower, unitMetricHwPower); +} + +/** + * Operational status: @code 1 @endcode (true) or @code 0 @endcode (false) for each of the possible + * states

+ * @code hw.status @endcode is currently specified as an UpDownCounter but would ideally be + * represented using a StateSet + * as defined in OpenMetrics. This semantic convention will be updated once StateSet is + * specified in OpenTelemetry. This planned change is not expected to have any consequence on the + * way users query their timeseries backend to retrieve the values of @code hw.status @endcode over + * time.

updowncounter + */ +static constexpr const char *kMetricHwStatus = "metric.hw.status"; +static constexpr const char *descrMetricHwStatus = + "Operational status: `1` (true) or `0` (false) for each of the possible states"; +static constexpr const char *unitMetricHwStatus = "1"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricHwStatus( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricHwStatus, descrMetricHwStatus, unitMetricHwStatus); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricHwStatus( + metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricHwStatus, descrMetricHwStatus, unitMetricHwStatus); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricHwStatus( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricHwStatus, descrMetricHwStatus, + unitMetricHwStatus); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricHwStatus( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricHwStatus, descrMetricHwStatus, + unitMetricHwStatus); +} + +} // namespace hw +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_attributes.h new file mode 100644 index 00000000000..ba40b454098 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_attributes.h @@ -0,0 +1,234 @@ +/* + * 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"; + +/** + * The name of the K8s volume. + */ +static constexpr const char *kK8sVolumeName = "k8s.volume.name"; + +/** + * The type of the K8s volume. + */ +static constexpr const char *kK8sVolumeType = "k8s.volume.type"; + +namespace K8sVolumeTypeValues +{ +/** + * A persistentVolumeClaim + * volume + */ +static constexpr const char *kPersistentVolumeClaim = "persistentVolumeClaim"; + +/** + * A configMap + * volume + */ +static constexpr const char *kConfigMap = "configMap"; + +/** + * A downwardAPI + * volume + */ +static constexpr const char *kDownwardApi = "downwardAPI"; + +/** + * An emptyDir + * volume + */ +static constexpr const char *kEmptyDir = "emptyDir"; + +/** + * A secret + * volume + */ +static constexpr const char *kSecret = "secret"; + +/** + * A local + * volume + */ +static constexpr const char *kLocal = "local"; + +} // namespace K8sVolumeTypeValues + +} // namespace k8s +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_metrics.h new file mode 100644 index 00000000000..2753ba4be13 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/k8s_metrics.h @@ -0,0 +1,273 @@ +/* + * 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/metrics/meter.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace k8s +{ + +/** + * Total CPU time consumed + *

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

+ * counter + */ +static constexpr const char *kMetricK8sNodeCpuTime = "metric.k8s.node.cpu.time"; +static constexpr const char *descrMetricK8sNodeCpuTime = "Total CPU time consumed"; +static constexpr const char *unitMetricK8sNodeCpuTime = "s"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeCpuTime, descrMetricK8sNodeCpuTime, + unitMetricK8sNodeCpuTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeCpuTime, descrMetricK8sNodeCpuTime, + unitMetricK8sNodeCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sNodeCpuTime, descrMetricK8sNodeCpuTime, + unitMetricK8sNodeCpuTime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeCpuTime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sNodeCpuTime, descrMetricK8sNodeCpuTime, + unitMetricK8sNodeCpuTime); +} + +/** + * Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs + *

+ * CPU usage of the specific Node on all available CPU cores, averaged over the sample window + *

+ * gauge + */ +static constexpr const char *kMetricK8sNodeCpuUsage = "metric.k8s.node.cpu.usage"; +static constexpr const char *descrMetricK8sNodeCpuUsage = + "Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs"; +static constexpr const char *unitMetricK8sNodeCpuUsage = "{cpu}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sNodeCpuUsage, descrMetricK8sNodeCpuUsage, + unitMetricK8sNodeCpuUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sNodeCpuUsage, descrMetricK8sNodeCpuUsage, + unitMetricK8sNodeCpuUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeCpuUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sNodeCpuUsage, descrMetricK8sNodeCpuUsage, + unitMetricK8sNodeCpuUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeCpuUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sNodeCpuUsage, descrMetricK8sNodeCpuUsage, + unitMetricK8sNodeCpuUsage); +} + +/** + * Memory usage of the Node + *

+ * Total memory usage of the Node + *

+ * gauge + */ +static constexpr const char *kMetricK8sNodeMemoryUsage = "metric.k8s.node.memory.usage"; +static constexpr const char *descrMetricK8sNodeMemoryUsage = "Memory usage of the Node"; +static constexpr const char *unitMetricK8sNodeMemoryUsage = "By"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, unitMetricK8sNodeMemoryUsage); +} + +/** + * Total CPU time consumed + *

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

+ * counter + */ +static constexpr const char *kMetricK8sPodCpuTime = "metric.k8s.pod.cpu.time"; +static constexpr const char *descrMetricK8sPodCpuTime = "Total CPU time consumed"; +static constexpr const char *unitMetricK8sPodCpuTime = "s"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodCpuTime, descrMetricK8sPodCpuTime, + unitMetricK8sPodCpuTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodCpuTime, descrMetricK8sPodCpuTime, + unitMetricK8sPodCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sPodCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sPodCpuTime, descrMetricK8sPodCpuTime, + unitMetricK8sPodCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sPodCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sPodCpuTime, descrMetricK8sPodCpuTime, + unitMetricK8sPodCpuTime); +} + +/** + * Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs + *

+ * CPU usage of the specific Pod on all available CPU cores, averaged over the sample window + *

+ * gauge + */ +static constexpr const char *kMetricK8sPodCpuUsage = "metric.k8s.pod.cpu.usage"; +static constexpr const char *descrMetricK8sPodCpuUsage = + "Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs"; +static constexpr const char *unitMetricK8sPodCpuUsage = "{cpu}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sPodCpuUsage, descrMetricK8sPodCpuUsage, + unitMetricK8sPodCpuUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sPodCpuUsage, descrMetricK8sPodCpuUsage, + unitMetricK8sPodCpuUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sPodCpuUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sPodCpuUsage, descrMetricK8sPodCpuUsage, + unitMetricK8sPodCpuUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodCpuUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sPodCpuUsage, descrMetricK8sPodCpuUsage, + unitMetricK8sPodCpuUsage); +} + +/** + * Memory usage of the Pod + *

+ * Total memory usage of the Pod + *

+ * gauge + */ +static constexpr const char *kMetricK8sPodMemoryUsage = "metric.k8s.pod.memory.usage"; +static constexpr const char *descrMetricK8sPodMemoryUsage = "Memory usage of the Pod"; +static constexpr const char *unitMetricK8sPodMemoryUsage = "By"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sPodMemoryUsage, descrMetricK8sPodMemoryUsage, + unitMetricK8sPodMemoryUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sPodMemoryUsage, descrMetricK8sPodMemoryUsage, + unitMetricK8sPodMemoryUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sPodMemoryUsage, descrMetricK8sPodMemoryUsage, + unitMetricK8sPodMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sPodMemoryUsage, descrMetricK8sPodMemoryUsage, + unitMetricK8sPodMemoryUsage); +} + +} // namespace k8s +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/linux_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/linux_attributes.h new file mode 100644 index 00000000000..024e2b60e6f --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/log_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/log_attributes.h new file mode 100644 index 00000000000..f9224f1bba4 --- /dev/null +++ b/deps/opentelemetry-cpp/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 original 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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/message_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/message_attributes.h new file mode 100644 index 00000000000..508a1e58f64 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_attributes.h new file mode 100644 index 00000000000..4cf20365ab6 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_attributes.h @@ -0,0 +1,543 @@ +/* + * 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.destination.subscription.name @endcode instead. + *

+ * @deprecated + * Replaced by @code messaging.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 +{ +/** + * 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 sending scenarios. + */ +static constexpr const char *kCreate = "create"; + +/** + * One or more messages are provided for sending to an intermediary. If a single message is sent, + * the context of the "Send" span can be used as the creation context and no "Create" span needs to + * be created. + */ +static constexpr const char *kSend = "send"; + +/** + * 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"; + +/** + * Deprecated. Use @code send @endcode instead. + *

+ * @deprecated + * Replaced by @code send @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kPublish = "publish"; + +} // 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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_metrics.h new file mode 100644 index 00000000000..9c29fb86b34 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/messaging_metrics.h @@ -0,0 +1,449 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingClientConsumedMessages, + descrMetricMessagingClientConsumedMessages, + unitMetricMessagingClientConsumedMessages); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingClientConsumedMessages, + descrMetricMessagingClientConsumedMessages, + unitMetricMessagingClientConsumedMessages); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingClientConsumedMessages, + descrMetricMessagingClientConsumedMessages, + unitMetricMessagingClientConsumedMessages); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingClientConsumedMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingClientOperationDuration, + descrMetricMessagingClientOperationDuration, + unitMetricMessagingClientOperationDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingClientOperationDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricMessagingClientOperationDuration, + descrMetricMessagingClientOperationDuration, + unitMetricMessagingClientOperationDuration); +} + +/** + * Deprecated. Use @code messaging.client.sent.messages @endcode instead. + *

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

+ * counter + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMetricMessagingClientPublishedMessages = + "metric.messaging.client.published.messages"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingClientPublishedMessages = + "Deprecated. Use `messaging.client.sent.messages` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingClientPublishedMessages = "{message}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingClientPublishedMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricMessagingClientPublishedMessages, + descrMetricMessagingClientPublishedMessages, + unitMetricMessagingClientPublishedMessages); +} + +/** + * Number of messages producer attempted to send to the broker. + *

+ * This metric MUST NOT count messages that were created but haven't yet been sent. + *

+ * counter + */ +static constexpr const char *kMetricMessagingClientSentMessages = + "metric.messaging.client.sent.messages"; +static constexpr const char *descrMetricMessagingClientSentMessages = + "Number of messages producer attempted to send to the broker."; +static constexpr const char *unitMetricMessagingClientSentMessages = "{message}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingClientSentMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingClientSentMessages, + descrMetricMessagingClientSentMessages, + unitMetricMessagingClientSentMessages); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingClientSentMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingClientSentMessages, + descrMetricMessagingClientSentMessages, + unitMetricMessagingClientSentMessages); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingClientSentMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingClientSentMessages, + descrMetricMessagingClientSentMessages, + unitMetricMessagingClientSentMessages); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingClientSentMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricMessagingClientSentMessages, + descrMetricMessagingClientSentMessages, + unitMetricMessagingClientSentMessages); +} + +/** + * 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 inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingProcessDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingProcessDuration, + descrMetricMessagingProcessDuration, + unitMetricMessagingProcessDuration); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingProcessDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingProcessMessages = + "Deprecated. Use `messaging.client.consumed.messages` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingProcessMessages = "{message}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingProcessMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingProcessMessages, + descrMetricMessagingProcessMessages, + unitMetricMessagingProcessMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingProcessMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingProcessMessages, + descrMetricMessagingProcessMessages, + unitMetricMessagingProcessMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingProcessMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingProcessMessages, + descrMetricMessagingProcessMessages, + unitMetricMessagingProcessMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingProcessMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingPublishDuration = + "Deprecated. Use `messaging.client.operation.duration` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingPublishDuration = "s"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingPublishDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingPublishDuration, + descrMetricMessagingPublishDuration, + unitMetricMessagingPublishDuration); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingPublishDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingPublishMessages = + "Deprecated. Use `messaging.client.produced.messages` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingPublishMessages = "{message}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingPublishMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingPublishMessages, + descrMetricMessagingPublishMessages, + unitMetricMessagingPublishMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingPublishMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingPublishMessages, + descrMetricMessagingPublishMessages, + unitMetricMessagingPublishMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingPublishMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingPublishMessages, + descrMetricMessagingPublishMessages, + unitMetricMessagingPublishMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingPublishMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingReceiveDuration = + "Deprecated. Use `messaging.client.operation.duration` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingReceiveDuration = "s"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingReceiveDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricMessagingReceiveDuration, + descrMetricMessagingReceiveDuration, + unitMetricMessagingReceiveDuration); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingReceiveDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricMessagingReceiveMessages = + "Deprecated. Use `messaging.client.consumed.messages` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricMessagingReceiveMessages = "{message}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricMessagingReceiveMessages(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricMessagingReceiveMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricMessagingReceiveMessages(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricMessagingReceiveMessages(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricMessagingReceiveMessages, + descrMetricMessagingReceiveMessages, + unitMetricMessagingReceiveMessages); +} + +} // namespace messaging +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/net_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/net_attributes.h new file mode 100644 index 00000000000..95622992235 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/network_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/network_attributes.h new file mode 100644 index 00000000000..ea855c57354 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/oci_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/oci_attributes.h new file mode 100644 index 00000000000..ade92d35c89 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/opentracing_attributes.h new file mode 100644 index 00000000000..159645e76b4 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/os_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/os_attributes.h new file mode 100644 index 00000000000..807deaaf92e --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/otel_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/otel_attributes.h new file mode 100644 index 00000000000..e3a32510050 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/otel_attributes.h @@ -0,0 +1,77 @@ +/* + * 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 + *

+ * @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. + *

+ * @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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/other_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/other_attributes.h new file mode 100644 index 00000000000..bc6d26ef164 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/peer_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/peer_attributes.h new file mode 100644 index 00000000000..6215d913f51 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/pool_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/pool_attributes.h new file mode 100644 index 00000000000..6c26b22c239 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_attributes.h new file mode 100644 index 00000000000..de81b12c380 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_attributes.h @@ -0,0 +1,264 @@ +/* + * 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 +{ + +/** + * Length of the process.command_args array + *

+ * This field can be useful for querying or performing bucket analysis on how many arguments were + * provided to start a process. More arguments may be an indication of suspicious activity. + */ +static constexpr const char *kProcessArgsCount = "process.args_count"; + +/** + * 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 GNU build ID as found in the @code .note.gnu.build-id @endcode ELF section (hex string). + */ +static constexpr const char *kProcessExecutableBuildIdGnu = "process.executable.build_id.gnu"; + +/** + * The Go build ID as retrieved by @code go tool buildid @endcode. + */ +static constexpr const char *kProcessExecutableBuildIdGo = "process.executable.build_id.go"; + +/** + * Profiling specific build ID for executables. See the OTel specification for Profiles for more + * information. + */ +static constexpr const char *kProcessExecutableBuildIdProfiling = + "process.executable.build_id.profiling"; + +/** + * 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"; + +/** + * Process title (proctitle) + *

+ * In many Unix-like systems, process title (proctitle), is the string that represents the name or + * command line of a running process, displayed by system monitoring tools like ps, top, and htop. + */ +static constexpr const char *kProcessTitle = "process.title"; + +/** + * 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"; + +/** + * The working directory of the process. + */ +static constexpr const char *kProcessWorkingDirectory = "process.working_directory"; + +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_metrics.h new file mode 100644 index 00000000000..5f851a2d411 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/process_metrics.h @@ -0,0 +1,454 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessContextSwitches(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessContextSwitches, + descrMetricProcessContextSwitches, + unitMetricProcessContextSwitches); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricProcessContextSwitches(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessContextSwitches, + descrMetricProcessContextSwitches, + unitMetricProcessContextSwitches); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessContextSwitches(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessContextSwitches, + descrMetricProcessContextSwitches, + unitMetricProcessContextSwitches); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessContextSwitches(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> CreateSyncInt64MetricProcessCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessCpuTime, descrMetricProcessCpuTime, + unitMetricProcessCpuTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessCpuTime, descrMetricProcessCpuTime, + unitMetricProcessCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricProcessCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessCpuTime, descrMetricProcessCpuTime, + unitMetricProcessCpuTime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessCpuTime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricProcessCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricProcessCpuUtilization, descrMetricProcessCpuUtilization, + unitMetricProcessCpuUtilization); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricProcessCpuUtilization, descrMetricProcessCpuUtilization, + unitMetricProcessCpuUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessCpuUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricProcessCpuUtilization, + descrMetricProcessCpuUtilization, + unitMetricProcessCpuUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessCpuUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(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 inline nostd::unique_ptr> CreateSyncInt64MetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessDiskIo, descrMetricProcessDiskIo, + unitMetricProcessDiskIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessDiskIo, descrMetricProcessDiskIo, + unitMetricProcessDiskIo); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessDiskIo, descrMetricProcessDiskIo, + unitMetricProcessDiskIo); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricProcessDiskIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessMemoryUsage, descrMetricProcessMemoryUsage, + unitMetricProcessMemoryUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricProcessMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricProcessMemoryUsage, descrMetricProcessMemoryUsage, + unitMetricProcessMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessMemoryUsage, descrMetricProcessMemoryUsage, unitMetricProcessMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessMemoryVirtual(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricProcessMemoryVirtual, descrMetricProcessMemoryVirtual, unitMetricProcessMemoryVirtual); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricProcessMemoryVirtual(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricProcessMemoryVirtual, descrMetricProcessMemoryVirtual, unitMetricProcessMemoryVirtual); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessMemoryVirtual(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessMemoryVirtual, descrMetricProcessMemoryVirtual, unitMetricProcessMemoryVirtual); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessMemoryVirtual(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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 inline nostd::unique_ptr> CreateSyncInt64MetricProcessNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessNetworkIo, descrMetricProcessNetworkIo, + unitMetricProcessNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessNetworkIo, descrMetricProcessNetworkIo, + unitMetricProcessNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessNetworkIo, descrMetricProcessNetworkIo, + unitMetricProcessNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessOpenFileDescriptorCount, + descrMetricProcessOpenFileDescriptorCount, + unitMetricProcessOpenFileDescriptorCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricProcessOpenFileDescriptorCount, + descrMetricProcessOpenFileDescriptorCount, + unitMetricProcessOpenFileDescriptorCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricProcessOpenFileDescriptorCount, + descrMetricProcessOpenFileDescriptorCount, + unitMetricProcessOpenFileDescriptorCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessOpenFileDescriptorCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessPagingFaults(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessPagingFaults, descrMetricProcessPagingFaults, + unitMetricProcessPagingFaults); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessPagingFaults, descrMetricProcessPagingFaults, + unitMetricProcessPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessPagingFaults(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricProcessPagingFaults, descrMetricProcessPagingFaults, unitMetricProcessPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricProcessThreadCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricProcessThreadCount, descrMetricProcessThreadCount, + unitMetricProcessThreadCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricProcessThreadCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricProcessThreadCount, descrMetricProcessThreadCount, + unitMetricProcessThreadCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricProcessThreadCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricProcessThreadCount, descrMetricProcessThreadCount, unitMetricProcessThreadCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricProcessThreadCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricProcessThreadCount, descrMetricProcessThreadCount, unitMetricProcessThreadCount); +} + +/** + * The time the process has been running. + *

+ * Instrumentations SHOULD use counter with type @code double @endcode and measure uptime with at + * least millisecond precision

counter + */ +static constexpr const char *kMetricProcessUptime = "metric.process.uptime"; +static constexpr const char *descrMetricProcessUptime = "The time the process has been running."; +static constexpr const char *unitMetricProcessUptime = "s"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +} // namespace process +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/profile_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/profile_attributes.h new file mode 100644 index 00000000000..076177904ff --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/profile_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 profile +{ + +/** + * Describes the interpreter or compiler of a single frame. + */ +static constexpr const char *kProfileFrameType = "profile.frame.type"; + +namespace ProfileFrameTypeValues +{ +/** + * .NET + */ +static constexpr const char *kDotnet = "dotnet"; + +/** + * JVM + */ +static constexpr const char *kJvm = "jvm"; + +/** + * Kernel + */ +static constexpr const char *kKernel = "kernel"; + +/** + * C, C++, Go, Rust + */ +static constexpr const char *kNative = "native"; + +/** + * Perl + */ +static constexpr const char *kPerl = "perl"; + +/** + * PHP + */ +static constexpr const char *kPhp = "php"; + +/** + * Python + */ +static constexpr const char *kCpython = "cpython"; + +/** + * Ruby + */ +static constexpr const char *kRuby = "ruby"; + +/** + * V8JS + */ +static constexpr const char *kV8js = "v8js"; + +} // namespace ProfileFrameTypeValues + +} // namespace profile +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_attributes.h new file mode 100644 index 00000000000..49ba418512a --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_metrics.h new file mode 100644 index 00000000000..30e95ce7108 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/rpc_metrics.h @@ -0,0 +1,312 @@ +/* + * 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/metrics/meter.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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcClientDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientDuration, descrMetricRpcClientDuration, + unitMetricRpcClientDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcClientDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcClientRequestSize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientRequestSize, descrMetricRpcClientRequestSize, + unitMetricRpcClientRequestSize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcClientRequestSize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcClientRequestsPerRpc(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientRequestsPerRpc, + descrMetricRpcClientRequestsPerRpc, + unitMetricRpcClientRequestsPerRpc); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcClientRequestsPerRpc(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcClientResponseSize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientResponseSize, + descrMetricRpcClientResponseSize, + unitMetricRpcClientResponseSize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcClientResponseSize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcClientResponsesPerRpc(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcClientResponsesPerRpc, + descrMetricRpcClientResponsesPerRpc, + unitMetricRpcClientResponsesPerRpc); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcClientResponsesPerRpc(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcServerDuration(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerDuration, descrMetricRpcServerDuration, + unitMetricRpcServerDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcServerDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcServerRequestSize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerRequestSize, descrMetricRpcServerRequestSize, + unitMetricRpcServerRequestSize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcServerRequestSize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcServerRequestsPerRpc(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerRequestsPerRpc, + descrMetricRpcServerRequestsPerRpc, + unitMetricRpcServerRequestsPerRpc); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcServerRequestsPerRpc(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcServerResponseSize(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerResponseSize, + descrMetricRpcServerResponseSize, + unitMetricRpcServerResponseSize); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcServerResponseSize(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(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 inline nostd::unique_ptr> +CreateSyncInt64MetricRpcServerResponsesPerRpc(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricRpcServerResponsesPerRpc, + descrMetricRpcServerResponsesPerRpc, + unitMetricRpcServerResponsesPerRpc); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricRpcServerResponsesPerRpc(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricRpcServerResponsesPerRpc, + descrMetricRpcServerResponsesPerRpc, + unitMetricRpcServerResponsesPerRpc); +} + +} // namespace rpc +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/server_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/server_attributes.h new file mode 100644 index 00000000000..21cb75d729a --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/service_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/service_attributes.h new file mode 100644 index 00000000000..7582c19868f --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/session_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/session_attributes.h new file mode 100644 index 00000000000..abbe9446d64 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/source_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/source_attributes.h new file mode 100644 index 00000000000..06a6ddc2f62 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_attributes.h new file mode 100644 index 00000000000..be7ec801864 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_metrics.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_metrics.h new file mode 100644 index 00000000000..a23a8ae4d08 --- /dev/null +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/system_metrics.h @@ -0,0 +1,1284 @@ +/* + * 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/metrics/meter.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}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricSystemCpuFrequency( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, + unitMetricSystemCpuFrequency); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemCpuFrequency( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, + unitMetricSystemCpuFrequency); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemCpuFrequency(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemCpuFrequency, descrMetricSystemCpuFrequency, + unitMetricSystemCpuFrequency); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemCpuFrequency(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemCpuLogicalCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemCpuLogicalCount, + descrMetricSystemCpuLogicalCount, + unitMetricSystemCpuLogicalCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemCpuLogicalCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemCpuLogicalCount, + descrMetricSystemCpuLogicalCount, + unitMetricSystemCpuLogicalCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemCpuLogicalCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuLogicalCount, + descrMetricSystemCpuLogicalCount, + unitMetricSystemCpuLogicalCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemCpuLogicalCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemCpuPhysicalCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemCpuPhysicalCount, + descrMetricSystemCpuPhysicalCount, + unitMetricSystemCpuPhysicalCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemCpuPhysicalCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemCpuPhysicalCount, + descrMetricSystemCpuPhysicalCount, + unitMetricSystemCpuPhysicalCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemCpuPhysicalCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemCpuPhysicalCount, + descrMetricSystemCpuPhysicalCount, + unitMetricSystemCpuPhysicalCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemCpuPhysicalCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> CreateSyncInt64MetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemCpuTime, descrMetricSystemCpuTime, + unitMetricSystemCpuTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime, + unitMetricSystemCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemCpuTime, descrMetricSystemCpuTime, + unitMetricSystemCpuTime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricSystemCpuTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricSystemCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, + unitMetricSystemCpuUtilization); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemCpuUtilization( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, + unitMetricSystemCpuUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemCpuUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricSystemCpuUtilization, descrMetricSystemCpuUtilization, unitMetricSystemCpuUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemCpuUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + 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 inline nostd::unique_ptr> CreateSyncInt64MetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskIo, descrMetricSystemDiskIo, + unitMetricSystemDiskIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo, + unitMetricSystemDiskIo); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskIo, descrMetricSystemDiskIo, + unitMetricSystemDiskIo); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricSystemDiskIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> CreateSyncInt64MetricSystemDiskIoTime( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemDiskIoTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemDiskIoTime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemDiskIoTime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricSystemDiskIoTime, descrMetricSystemDiskIoTime, + unitMetricSystemDiskIoTime); +} + +/** + * The total storage capacity of the disk + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemDiskLimit = "metric.system.disk.limit"; +static constexpr const char *descrMetricSystemDiskLimit = "The total storage capacity of the disk"; +static constexpr const char *unitMetricSystemDiskLimit = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemDiskLimit(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemDiskLimit, descrMetricSystemDiskLimit, + unitMetricSystemDiskLimit); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemDiskLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemDiskLimit, descrMetricSystemDiskLimit, + unitMetricSystemDiskLimit); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemDiskLimit(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemDiskLimit, descrMetricSystemDiskLimit, unitMetricSystemDiskLimit); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemDiskLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricSystemDiskLimit, descrMetricSystemDiskLimit, unitMetricSystemDiskLimit); +} + +/** + * counter + */ +static constexpr const char *kMetricSystemDiskMerged = "metric.system.disk.merged"; +static constexpr const char *descrMetricSystemDiskMerged = ""; +static constexpr const char *unitMetricSystemDiskMerged = "{operation}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricSystemDiskMerged( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged, + unitMetricSystemDiskMerged); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemDiskMerged( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged, + unitMetricSystemDiskMerged); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemDiskMerged(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskMerged, descrMetricSystemDiskMerged, + unitMetricSystemDiskMerged); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemDiskMerged(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemDiskOperationTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskOperationTime, + descrMetricSystemDiskOperationTime, + unitMetricSystemDiskOperationTime); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemDiskOperationTime(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemDiskOperationTime, + descrMetricSystemDiskOperationTime, + unitMetricSystemDiskOperationTime); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemDiskOperationTime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemDiskOperationTime, + descrMetricSystemDiskOperationTime, + unitMetricSystemDiskOperationTime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemDiskOperationTime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemDiskOperations(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemDiskOperations, descrMetricSystemDiskOperations, + unitMetricSystemDiskOperations); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemDiskOperations(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemDiskOperations, descrMetricSystemDiskOperations, + unitMetricSystemDiskOperations); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemDiskOperations(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemDiskOperations, descrMetricSystemDiskOperations, unitMetricSystemDiskOperations); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemDiskOperations(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricSystemDiskOperations, descrMetricSystemDiskOperations, unitMetricSystemDiskOperations); +} + +/** + * The total storage capacity of the filesystem + *

+ * updowncounter + */ +static constexpr const char *kMetricSystemFilesystemLimit = "metric.system.filesystem.limit"; +static constexpr const char *descrMetricSystemFilesystemLimit = + "The total storage capacity of the filesystem"; +static constexpr const char *unitMetricSystemFilesystemLimit = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemFilesystemLimit(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemFilesystemLimit, + descrMetricSystemFilesystemLimit, + unitMetricSystemFilesystemLimit); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemFilesystemLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemFilesystemLimit, + descrMetricSystemFilesystemLimit, + unitMetricSystemFilesystemLimit); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemFilesystemLimit(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemFilesystemLimit, + descrMetricSystemFilesystemLimit, + unitMetricSystemFilesystemLimit); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemFilesystemLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricSystemFilesystemLimit, + descrMetricSystemFilesystemLimit, + unitMetricSystemFilesystemLimit); +} + +/** + * Reports a filesystem's space usage across different states. + *

+ * The sum of all @code system.filesystem.usage @endcode values over the different @code + * system.filesystem.state @endcode attributes SHOULD equal the total storage capacity of the + * filesystem, that is @code system.filesystem.limit @endcode.

updowncounter + */ +static constexpr const char *kMetricSystemFilesystemUsage = "metric.system.filesystem.usage"; +static constexpr const char *descrMetricSystemFilesystemUsage = + "Reports a filesystem's space usage across different states."; +static constexpr const char *unitMetricSystemFilesystemUsage = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemFilesystemUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemFilesystemUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemFilesystemUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemFilesystemUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricSystemFilesystemUsage, + descrMetricSystemFilesystemUsage, + unitMetricSystemFilesystemUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemFilesystemUtilization = + "metric.system.filesystem.utilization"; +static constexpr const char *descrMetricSystemFilesystemUtilization = ""; +static constexpr const char *unitMetricSystemFilesystemUtilization = "1"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemFilesystemUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemFilesystemUtilization, + descrMetricSystemFilesystemUtilization, + unitMetricSystemFilesystemUtilization); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemFilesystemUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemFilesystemUtilization, + descrMetricSystemFilesystemUtilization, + unitMetricSystemFilesystemUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemFilesystemUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemFilesystemUtilization, + descrMetricSystemFilesystemUtilization, + unitMetricSystemFilesystemUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemFilesystemUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemLinuxMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemoryAvailable, + descrMetricSystemLinuxMemoryAvailable, + unitMetricSystemLinuxMemoryAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemLinuxMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemLinuxMemoryAvailable, + descrMetricSystemLinuxMemoryAvailable, + unitMetricSystemLinuxMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemLinuxMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemoryAvailable, + descrMetricSystemLinuxMemoryAvailable, + unitMetricSystemLinuxMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemLinuxMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemLinuxMemorySlabUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemLinuxMemorySlabUsage, + descrMetricSystemLinuxMemorySlabUsage, + unitMetricSystemLinuxMemorySlabUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemLinuxMemorySlabUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemLinuxMemorySlabUsage, + descrMetricSystemLinuxMemorySlabUsage, + unitMetricSystemLinuxMemorySlabUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemLinuxMemorySlabUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemLinuxMemorySlabUsage, + descrMetricSystemLinuxMemorySlabUsage, + unitMetricSystemLinuxMemorySlabUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemLinuxMemorySlabUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemMemoryLimit(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, + unitMetricSystemMemoryLimit); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemMemoryLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, + unitMetricSystemMemoryLimit); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemMemoryLimit(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryLimit, descrMetricSystemMemoryLimit, unitMetricSystemMemoryLimit); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemMemoryLimit(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemMemoryShared(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryShared, descrMetricSystemMemoryShared, + unitMetricSystemMemoryShared); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemMemoryShared(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryShared, descrMetricSystemMemoryShared, + unitMetricSystemMemoryShared); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemMemoryShared(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryShared, descrMetricSystemMemoryShared, unitMetricSystemMemoryShared); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemMemoryShared(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, + unitMetricSystemMemoryUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, + unitMetricSystemMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, unitMetricSystemMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricSystemMemoryUsage, descrMetricSystemMemoryUsage, unitMetricSystemMemoryUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemMemoryUtilization = "metric.system.memory.utilization"; +static constexpr const char *descrMetricSystemMemoryUtilization = ""; +static constexpr const char *unitMetricSystemMemoryUtilization = "1"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemMemoryUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemMemoryUtilization, descrMetricSystemMemoryUtilization, + unitMetricSystemMemoryUtilization); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemMemoryUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemMemoryUtilization, + descrMetricSystemMemoryUtilization, + unitMetricSystemMemoryUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemMemoryUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemMemoryUtilization, + descrMetricSystemMemoryUtilization, + unitMetricSystemMemoryUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemMemoryUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkConnections(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemNetworkConnections, + descrMetricSystemNetworkConnections, + unitMetricSystemNetworkConnections); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemNetworkConnections(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemNetworkConnections, + descrMetricSystemNetworkConnections, + unitMetricSystemNetworkConnections); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkConnections(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricSystemNetworkConnections, + descrMetricSystemNetworkConnections, + unitMetricSystemNetworkConnections); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkConnections(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, + unitMetricSystemNetworkDropped); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, + unitMetricSystemNetworkDropped); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, + unitMetricSystemNetworkErrors); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemNetworkErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, + unitMetricSystemNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkErrors, descrMetricSystemNetworkErrors, unitMetricSystemNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> CreateSyncInt64MetricSystemNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo, + unitMetricSystemNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo, + unitMetricSystemNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemNetworkIo, descrMetricSystemNetworkIo, + unitMetricSystemNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, + unitMetricSystemNetworkPackets); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, + unitMetricSystemNetworkPackets); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> CreateSyncInt64MetricSystemPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemPagingFaults, descrMetricSystemPagingFaults, + unitMetricSystemPagingFaults); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemPagingFaults( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemPagingFaults, descrMetricSystemPagingFaults, + unitMetricSystemPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemPagingFaults(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemPagingFaults, descrMetricSystemPagingFaults, unitMetricSystemPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemPagingOperations(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemPagingOperations, + descrMetricSystemPagingOperations, + unitMetricSystemPagingOperations); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemPagingOperations(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemPagingOperations, + descrMetricSystemPagingOperations, + unitMetricSystemPagingOperations); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemPagingOperations(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricSystemPagingOperations, + descrMetricSystemPagingOperations, + unitMetricSystemPagingOperations); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemPagingOperations(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemPagingUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemPagingUsage, descrMetricSystemPagingUsage, + unitMetricSystemPagingUsage); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemPagingUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemPagingUsage, descrMetricSystemPagingUsage, + unitMetricSystemPagingUsage); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemPagingUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemPagingUsage, descrMetricSystemPagingUsage, unitMetricSystemPagingUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemPagingUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricSystemPagingUsage, descrMetricSystemPagingUsage, unitMetricSystemPagingUsage); +} + +/** + * gauge + */ +static constexpr const char *kMetricSystemPagingUtilization = "metric.system.paging.utilization"; +static constexpr const char *descrMetricSystemPagingUtilization = ""; +static constexpr const char *unitMetricSystemPagingUtilization = "1"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemPagingUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemPagingUtilization, descrMetricSystemPagingUtilization, + unitMetricSystemPagingUtilization); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemPagingUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemPagingUtilization, + descrMetricSystemPagingUtilization, + unitMetricSystemPagingUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemPagingUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemPagingUtilization, + descrMetricSystemPagingUtilization, + unitMetricSystemPagingUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemPagingUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemProcessCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricSystemProcessCount, descrMetricSystemProcessCount, + unitMetricSystemProcessCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemProcessCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricSystemProcessCount, descrMetricSystemProcessCount, + unitMetricSystemProcessCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemProcessCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricSystemProcessCount, descrMetricSystemProcessCount, unitMetricSystemProcessCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemProcessCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + 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 inline nostd::unique_ptr> +CreateSyncInt64MetricSystemProcessCreated(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemProcessCreated, descrMetricSystemProcessCreated, + unitMetricSystemProcessCreated); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemProcessCreated(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemProcessCreated, descrMetricSystemProcessCreated, + unitMetricSystemProcessCreated); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemProcessCreated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemProcessCreated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated); +} + +} // namespace system +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h new file mode 100644 index 00000000000..5504febaba4 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/test_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/test_attributes.h new file mode 100644 index 00000000000..dce482055c0 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/thread_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/thread_attributes.h new file mode 100644 index 00000000000..8c053f84088 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/tls_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/tls_attributes.h new file mode 100644 index 00000000000..89449453ec9 --- /dev/null +++ b/deps/opentelemetry-cpp/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 @code server.address @endcode. + */ +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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/url_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/url_attributes.h new file mode 100644 index 00000000000..fb3418e26a2 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h new file mode 100644 index 00000000000..738bb6de15b --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/user_attributes.h new file mode 100644 index 00000000000..cc5a80d069c --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/vcs_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/vcs_attributes.h new file mode 100644 index 00000000000..cc38902e889 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/webengine_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/incubating/webengine_attributes.h new file mode 100644 index 00000000000..16283b43cb8 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/network_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/network_attributes.h new file mode 100644 index 00000000000..7e965e6a6ec --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/otel_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/otel_attributes.h new file mode 100644 index 00000000000..b92eff1dd44 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/schema_url.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/schema_url.h new file mode 100644 index 00000000000..a25e28b5ea9 --- /dev/null +++ b/deps/opentelemetry-cpp/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.28.0"; +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/server_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/server_attributes.h new file mode 100644 index 00000000000..21cb75d729a --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/service_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/service_attributes.h new file mode 100644 index 00000000000..e4c0dda17a2 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/telemetry_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/telemetry_attributes.h new file mode 100644 index 00000000000..7aa764cdaa4 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/url_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/url_attributes.h new file mode 100644 index 00000000000..25ed5b03ab9 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/user_agent_attributes.h b/deps/opentelemetry-cpp/api/include/opentelemetry/semconv/user_agent_attributes.h new file mode 100644 index 00000000000..dd1d4932786 --- /dev/null +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/api/include/opentelemetry/trace/default_span.h b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/default_span.h index 7e3979501e2..7ad6a3726e4 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/default_span.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/default_span.h @@ -66,8 +66,8 @@ class DefaultSpan : public Span DefaultSpan(SpanContext span_context) noexcept : span_context_(span_context) {} // movable and copiable - DefaultSpan(DefaultSpan &&spn) noexcept : span_context_(spn.GetContext()) {} - DefaultSpan(const DefaultSpan &spn) noexcept : span_context_(spn.GetContext()) {} + DefaultSpan(DefaultSpan &&spn) noexcept : Span(), span_context_(spn.GetContext()) {} + DefaultSpan(const DefaultSpan &spn) noexcept : Span(), span_context_(spn.GetContext()) {} private: SpanContext span_context_; diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/http_trace_context.h b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/http_trace_context.h index a6b7e3b219c..81d4c308ec0 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/http_trace_context.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/http_trace_context.h @@ -86,14 +86,8 @@ class HttpTraceContext : public context::propagation::TextMapPropagator } private: - static constexpr uint8_t kInvalidVersion = 0xFF; - - static bool IsValidVersion(nostd::string_view version_hex) - { - uint8_t version; - detail::HexToBinary(version_hex, &version, sizeof(version)); - return version != kInvalidVersion; - } + static constexpr uint8_t kInvalidVersion = 0xFF; + static constexpr uint8_t kDefaultAssumedVersion = 0x00; static void InjectImpl(context::propagation::TextMapCarrier &carrier, const SpanContext &span_context) @@ -122,11 +116,6 @@ class HttpTraceContext : public context::propagation::TextMapPropagator static SpanContext ExtractContextFromTraceHeaders(nostd::string_view trace_parent, nostd::string_view trace_state) { - if (trace_parent.size() != kTraceParentSize) - { - return SpanContext::GetInvalid(); - } - std::array fields{}; if (detail::SplitString(trace_parent, '-', fields.data(), 4) != 4) { @@ -150,11 +139,33 @@ class HttpTraceContext : public context::propagation::TextMapPropagator return SpanContext::GetInvalid(); } - if (!IsValidVersion(version_hex)) + // hex is valid, convert it to binary + uint8_t version_binary; + detail::HexToBinary(version_hex, &version_binary, sizeof(version_binary)); + if (version_binary == kInvalidVersion) { + // invalid version encountered return SpanContext::GetInvalid(); } + // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent + if (version_binary > kDefaultAssumedVersion) + { + // higher than default version detected + if (trace_parent.size() < kTraceParentSize) + { + return SpanContext::GetInvalid(); + } + } + else + { + // version is either lower or same as the default version + if (trace_parent.size() != kTraceParentSize) + { + return SpanContext::GetInvalid(); + } + } + TraceId trace_id = TraceIdFromHex(trace_id_hex); SpanId span_id = SpanIdFromHex(span_id_hex); @@ -169,7 +180,8 @@ class HttpTraceContext : public context::propagation::TextMapPropagator static SpanContext ExtractImpl(const context::propagation::TextMapCarrier &carrier) { - nostd::string_view trace_parent = carrier.Get(kTraceParent); + // Get trace_parent after trimming the leading and trailing whitespaces + nostd::string_view trace_parent = common::StringUtil::Trim(carrier.Get(kTraceParent)); nostd::string_view trace_state = carrier.Get(kTraceState); if (trace_parent == "") { diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/jaeger.h b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/jaeger.h index 1f0195a248b..45a93709193 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/jaeger.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/propagation/jaeger.h @@ -3,10 +3,6 @@ #pragma once -#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE -# error "header is deprecated." -#endif - #include "detail/hex.h" #include "detail/string.h" #include "opentelemetry/context/propagation/text_map_propagator.h" @@ -21,7 +17,7 @@ namespace propagation static const nostd::string_view kJaegerTraceHeader = "uber-trace-id"; -class OPENTELEMETRY_DEPRECATED JaegerPropagator : public context::propagation::TextMapPropagator +class JaegerPropagator : public context::propagation::TextMapPropagator { public: void Inject(context::propagation::TextMapCarrier &carrier, diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/semantic_conventions.h b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/semantic_conventions.h index fb26385fbc5..d6d6591149a 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/semantic_conventions.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/semantic_conventions.h @@ -4,9 +4,13 @@ */ /* - DO NOT EDIT, this is an Auto-generated file - from buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 -*/ + * This file is DEPRECATED, and no longer updated. + * See file DEPRECATED.md for details. + */ + +#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE +# error "header is deprecated." +#endif #pragma once diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/trace_state.h b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/trace_state.h index 753f48c99e0..df7a0e0fe9c 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/trace/trace_state.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/trace/trace_state.h @@ -59,7 +59,8 @@ class OPENTELEMETRY_EXPORT TraceState size_t cnt = kv_str_tokenizer.NumTokens(); // upper bound on number of kv pairs if (cnt > kMaxKeyValuePairs) { - cnt = kMaxKeyValuePairs; + // trace state should be discarded if count exceeds + return GetDefault(); } nostd::shared_ptr ts(new TraceState(cnt)); diff --git a/deps/opentelemetry-cpp/api/include/opentelemetry/version.h b/deps/opentelemetry-cpp/api/include/opentelemetry/version.h index d3e18ce1d8b..a26b8b4e88d 100644 --- a/deps/opentelemetry-cpp/api/include/opentelemetry/version.h +++ b/deps/opentelemetry-cpp/api/include/opentelemetry/version.h @@ -10,9 +10,9 @@ # define OPENTELEMETRY_ABI_VERSION_NO 1 #endif -#define OPENTELEMETRY_VERSION "1.17.0" +#define OPENTELEMETRY_VERSION "1.18.0" #define OPENTELEMETRY_VERSION_MAJOR 1 -#define OPENTELEMETRY_VERSION_MINOR 17 +#define OPENTELEMETRY_VERSION_MINOR 18 #define OPENTELEMETRY_VERSION_PATCH 0 #define OPENTELEMETRY_ABI_VERSION OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_ABI_VERSION_NO) diff --git a/deps/opentelemetry-cpp/api/test/CMakeLists.txt b/deps/opentelemetry-cpp/api/test/CMakeLists.txt index 20c9f4e9492..66eeee20927 100644 --- a/deps/opentelemetry-cpp/api/test/CMakeLists.txt +++ b/deps/opentelemetry-cpp/api/test/CMakeLists.txt @@ -10,4 +10,7 @@ add_subdirectory(metrics) add_subdirectory(logs) add_subdirectory(common) add_subdirectory(baggage) -add_subdirectory(singleton) + +if(NOT OPENTELEMETRY_SKIP_DYNAMIC_LOADING_TESTS) + add_subdirectory(singleton) +endif() diff --git a/deps/opentelemetry-cpp/api/test/common/spinlock_benchmark.cc b/deps/opentelemetry-cpp/api/test/common/spinlock_benchmark.cc index b5e98a2108e..da588b7e30a 100644 --- a/deps/opentelemetry-cpp/api/test/common/spinlock_benchmark.cc +++ b/deps/opentelemetry-cpp/api/test/common/spinlock_benchmark.cc @@ -102,8 +102,10 @@ static void BM_ProcYieldSpinLockThrashing(benchmark::State &s) # else __builtin_ia32_pause(); # endif -#elif defined(__arm__) - __asm__ volatile("yield" ::: "memory"); +#elif defined(__armel__) || defined(__ARMEL__) + asm volatile("nop" ::: "memory"); +#elif defined(__arm__) || defined(__aarch64__) // arm big endian / arm64 + __asm__ __volatile__("yield" ::: "memory"); #endif } }, diff --git a/deps/opentelemetry-cpp/api/test/common/string_util_test.cc b/deps/opentelemetry-cpp/api/test/common/string_util_test.cc index f074d4fbe3d..8746607766c 100644 --- a/deps/opentelemetry-cpp/api/test/common/string_util_test.cc +++ b/deps/opentelemetry-cpp/api/test/common/string_util_test.cc @@ -35,9 +35,15 @@ TEST(StringUtilTest, TrimString) {"k1=v1,k2=v2, k3=v3", "k1=v1,k2=v2, k3=v3"}, {" k1=v1", "k1=v1"}, {"k1=v1 ", "k1=v1"}, + {"k1=v1\t", "k1=v1"}, + {"\t k1=v1 \t", "k1=v1"}, + {"\t\t k1=v1\t ", "k1=v1"}, + {"\t\t k1=v1\t ,k2=v2", "k1=v1\t ,k2=v2"}, {" k1=v1 ", "k1=v1"}, {" ", ""}, - {"", ""}}; + {"", ""}, + {"\n_some string_\t", "_some string_"}}; + for (auto &testcase : testcases) { EXPECT_EQ(StringUtil::Trim(testcase.input), testcase.expected); diff --git a/deps/opentelemetry-cpp/api/test/trace/propagation/CMakeLists.txt b/deps/opentelemetry-cpp/api/test/trace/propagation/CMakeLists.txt index a1cfcf83eec..f55c7381658 100644 --- a/deps/opentelemetry-cpp/api/test/trace/propagation/CMakeLists.txt +++ b/deps/opentelemetry-cpp/api/test/trace/propagation/CMakeLists.txt @@ -3,7 +3,8 @@ add_subdirectory(detail) -foreach(testname http_text_format_test b3_propagation_test) +foreach(testname http_text_format_test b3_propagation_test + jaeger_propagation_test) add_executable(${testname} "${testname}.cc") target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api) @@ -12,16 +13,3 @@ foreach(testname http_text_format_test b3_propagation_test) TEST_PREFIX trace. TEST_LIST ${testname}) endforeach() - -if(NOT WITH_NO_DEPRECATED_CODE) - foreach(testname jaeger_propagation_test) - - add_executable(${testname} "${testname}.cc") - target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api) - gtest_add_tests( - TARGET ${testname} - TEST_PREFIX trace. - TEST_LIST ${testname}) - endforeach() -endif() diff --git a/deps/opentelemetry-cpp/api/test/trace/propagation/detail/BUILD b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/BUILD index a082586650a..322c8929375 100644 --- a/deps/opentelemetry-cpp/api/test/trace/propagation/detail/BUILD +++ b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/BUILD @@ -18,3 +18,19 @@ cc_test( "@com_google_googletest//:gtest_main", ], ) + +cc_test( + name = "string_test", + srcs = [ + "string_test.cc", + ], + tags = [ + "api", + "test", + "trace", + ], + deps = [ + "//api", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/deps/opentelemetry-cpp/api/test/trace/propagation/detail/CMakeLists.txt b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/CMakeLists.txt index 34e2f6ae408..c70478efa1e 100644 --- a/deps/opentelemetry-cpp/api/test/trace/propagation/detail/CMakeLists.txt +++ b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -foreach(testname hex_test) +foreach(testname hex_test string_test) add_executable(${testname} "${testname}.cc") target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api) diff --git a/deps/opentelemetry-cpp/api/test/trace/propagation/detail/string_test.cc b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/string_test.cc new file mode 100644 index 00000000000..67a48a354c4 --- /dev/null +++ b/deps/opentelemetry-cpp/api/test/trace/propagation/detail/string_test.cc @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include + +#include "opentelemetry/nostd/string_view.h" + +using namespace opentelemetry; + +namespace +{ + +struct SplitStringTestData +{ + opentelemetry::nostd::string_view input; + char separator; + size_t max_count; + size_t expected_number_strings; + + // When googletest registers parameterized tests, it uses this method to format the parameters. + // The default implementation prints hex dump of all bytes in the object. If there is any padding + // in these bytes, valgrind reports this as a warning - "Use of uninitialized bytes". + // See https://github.com/google/googletest/issues/3805. + friend void PrintTo(const SplitStringTestData &data, std::ostream *os) + { + *os << "(" << data.input << "," << data.separator << "," << data.max_count << "," + << data.expected_number_strings << ")"; + } +}; + +const SplitStringTestData split_string_test_cases[] = { + {"foo,bar,baz", ',', 4, 3}, + {"foo,bar,baz,foobar", ',', 4, 4}, + {"foo,bar,baz,foobar", '.', 4, 1}, + {"foo,bar,baz,", ',', 4, 4}, + {"foo,bar,baz,", ',', 2, 2}, + {"foo ,bar, baz ", ',', 4, 3}, + {"foo ,bar, baz ", ',', 4, 3}, + {"00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01", '-', 4, 4}, +}; +} // namespace + +// Test fixture +class SplitStringTestFixture : public ::testing::TestWithParam +{}; + +TEST_P(SplitStringTestFixture, SplitsAsExpected) +{ + const SplitStringTestData test_param = GetParam(); + std::vector fields(test_param.expected_number_strings); + size_t got_splits_num = opentelemetry::trace::propagation::detail::SplitString( + test_param.input, test_param.separator, fields.data(), test_param.max_count); + + // Assert on the output + EXPECT_EQ(got_splits_num, test_param.expected_number_strings); +} + +INSTANTIATE_TEST_SUITE_P(SplitStringTestCases, + SplitStringTestFixture, + ::testing::ValuesIn(split_string_test_cases)); diff --git a/deps/opentelemetry-cpp/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h b/deps/opentelemetry-cpp/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h index af4ccb16efb..9baf9ef7bde 100644 --- a/deps/opentelemetry-cpp/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h +++ b/deps/opentelemetry-cpp/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h @@ -28,20 +28,18 @@ class ElasticSearchRecordable final : public sdk::logs::Recordable { private: /** - * A helper method that writes a key/value pair under a specified name, the two names used here - * being "attributes" and "resources" + * A helper method that writes a value under a specified name. + * `name` will be at the root of the JSON object. If it has to be nested under some other keys, + * then write `name` as `key1.key2.[...].name` */ - void WriteKeyValue(nostd::string_view key, - const opentelemetry::common::AttributeValue &value, - const std::string &name); - - void WriteKeyValue(nostd::string_view key, - const opentelemetry::sdk::common::OwnedAttributeValue &value, - const std::string &name); + void WriteValue(const opentelemetry::sdk::common::OwnedAttributeValue &value, + const std::string &name); void WriteValue(const opentelemetry::common::AttributeValue &value, const std::string &name); public: + ElasticSearchRecordable() noexcept; + /** * Returns a JSON object contain the log information */ diff --git a/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_record_exporter.cc b/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_record_exporter.cc index f464df5006f..1ec786a198f 100644 --- a/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -288,7 +288,12 @@ class AsyncResponseHandler : public http_client::EventHandler #endif ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() - : options_{ElasticsearchExporterOptions()}, + : ElasticsearchLogRecordExporter(ElasticsearchExporterOptions()) +{} + +ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( + const ElasticsearchExporterOptions &options) + : options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()} #ifdef ENABLE_ASYNC_EXPORT , @@ -301,11 +306,6 @@ ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() #endif } -ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( - const ElasticsearchExporterOptions &options) - : options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()} -{} - std::unique_ptr ElasticsearchLogRecordExporter::MakeRecordable() noexcept { return std::unique_ptr(new ElasticSearchRecordable()); diff --git a/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_recordable.cc b/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_recordable.cc index 663691273b8..3412a8cc611 100644 --- a/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_recordable.cc +++ b/deps/opentelemetry-cpp/exporters/elasticsearch/src/es_log_recordable.cc @@ -14,44 +14,7 @@ namespace exporter { namespace logs { -void ElasticSearchRecordable::WriteKeyValue(nostd::string_view key, - const opentelemetry::common::AttributeValue &value, - const std::string &name) -{ - switch (value.index()) - { - case common::AttributeType::kTypeBool: - json_[name][key.data()] = opentelemetry::nostd::get(value) ? true : false; - return; - case common::AttributeType::kTypeInt: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeInt64: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeUInt: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeUInt64: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeDouble: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeCString: - json_[name][key.data()] = opentelemetry::nostd::get(value); - return; - case common::AttributeType::kTypeString: - json_[name][key.data()] = - opentelemetry::nostd::get(value).data(); - return; - default: - return; - } -} - -void ElasticSearchRecordable::WriteKeyValue( - nostd::string_view key, +void ElasticSearchRecordable::WriteValue( const opentelemetry::sdk::common::OwnedAttributeValue &value, const std::string &name) { @@ -59,25 +22,25 @@ void ElasticSearchRecordable::WriteKeyValue( switch (value.index()) { case common::kTypeBool: - json_[name][key.data()] = opentelemetry::nostd::get(value) ? true : false; + json_[name] = opentelemetry::nostd::get(value) ? true : false; return; case common::kTypeInt: - json_[name][key.data()] = opentelemetry::nostd::get(value); + json_[name] = opentelemetry::nostd::get(value); return; case common::kTypeInt64: - json_[name][key.data()] = opentelemetry::nostd::get(value); + json_[name] = opentelemetry::nostd::get(value); return; case common::kTypeUInt: - json_[name][key.data()] = opentelemetry::nostd::get(value); + json_[name] = opentelemetry::nostd::get(value); return; case common::kTypeUInt64: - json_[name][key.data()] = opentelemetry::nostd::get(value); + json_[name] = opentelemetry::nostd::get(value); return; case common::kTypeDouble: - json_[name][key.data()] = opentelemetry::nostd::get(value); + json_[name] = opentelemetry::nostd::get(value); return; case common::kTypeString: - json_[name][key.data()] = opentelemetry::nostd::get(value).data(); + json_[name] = opentelemetry::nostd::get(value).data(); return; default: return; @@ -197,6 +160,11 @@ void ElasticSearchRecordable::WriteValue(const opentelemetry::common::AttributeV } } +ElasticSearchRecordable::ElasticSearchRecordable() noexcept : sdk::logs::Recordable() +{ + json_["ecs"]["version"] = "8.11.0"; +} + nlohmann::json ElasticSearchRecordable::GetJSON() noexcept { return json_; @@ -205,7 +173,38 @@ nlohmann::json ElasticSearchRecordable::GetJSON() noexcept void ElasticSearchRecordable::SetTimestamp( opentelemetry::common::SystemTimestamp timestamp) noexcept { - json_["timestamp"] = timestamp.time_since_epoch().count(); + const std::chrono::system_clock::time_point timePoint{timestamp}; + + // If built with with at least cpp 20 then use std::format + // Otherwise use the old style to format the timestamp in UTC +#if __cplusplus >= 202002L + const std::string dateStr = std::format("{:%FT%T%Ez}", timePoint); +#else + const static int dateToSecondsSize = 19; + const static int millisecondsSize = 8; + const static int timeZoneSize = 1; + const static int dateSize = dateToSecondsSize + millisecondsSize + timeZoneSize; + + std::time_t time = std::chrono::system_clock::to_time_t(timePoint); + std::tm tm = *std::gmtime(&time); + + char bufferDate[dateSize]; // example: 2024-10-18T07:26:00.123456Z + std::strftime(bufferDate, sizeof(bufferDate), "%Y-%m-%dT%H:%M:%S", &tm); + auto microseconds = + std::chrono::duration_cast(timePoint.time_since_epoch()) % + std::chrono::seconds(1); + + char bufferMilliseconds[millisecondsSize]; + std::snprintf(bufferMilliseconds, sizeof(bufferMilliseconds), ".%06ld", + static_cast(microseconds.count())); + + std::strcat(bufferDate, bufferMilliseconds); + std::strcat(bufferDate, "Z"); + + const std::string dateStr(bufferDate); +#endif + + json_["@timestamp"] = dateStr; } void ElasticSearchRecordable::SetObservedTimestamp( @@ -216,23 +215,25 @@ void ElasticSearchRecordable::SetObservedTimestamp( void ElasticSearchRecordable::SetSeverity(opentelemetry::logs::Severity severity) noexcept { + auto &severityField = json_["log"]["level"]; + // Convert the severity enum to a string std::uint32_t severity_index = static_cast(severity); if (severity_index >= std::extent::value) { std::stringstream sout; sout << "Invalid severity(" << severity_index << ")"; - json_["severity"] = sout.str(); + severityField = sout.str(); } else { - json_["severity"] = opentelemetry::logs::SeverityNumToText[severity_index]; + severityField = opentelemetry::logs::SeverityNumToText[severity_index]; } } void ElasticSearchRecordable::SetBody(const opentelemetry::common::AttributeValue &message) noexcept { - WriteValue(message, "body"); + WriteValue(message, "message"); } void ElasticSearchRecordable::SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept @@ -275,7 +276,7 @@ void ElasticSearchRecordable::SetAttribute( nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { - WriteKeyValue(key, value, "attributes"); + WriteValue(value, key.data()); } void ElasticSearchRecordable::SetResource( @@ -283,7 +284,7 @@ void ElasticSearchRecordable::SetResource( { for (auto &attribute : resource.GetAttributes()) { - WriteKeyValue(attribute.first, attribute.second, "resource"); + WriteValue(attribute.second, attribute.first); } } @@ -291,7 +292,7 @@ void ElasticSearchRecordable::SetInstrumentationScope( const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope) noexcept { - json_["name"] = instrumentation_scope.GetName(); + json_["log"]["logger"] = instrumentation_scope.GetName(); } } // namespace logs diff --git a/deps/opentelemetry-cpp/exporters/elasticsearch/test/es_log_record_exporter_test.cc b/deps/opentelemetry-cpp/exporters/elasticsearch/test/es_log_record_exporter_test.cc index 8a1c81da48d..6bdd5248a56 100644 --- a/deps/opentelemetry-cpp/exporters/elasticsearch/test/es_log_record_exporter_test.cc +++ b/deps/opentelemetry-cpp/exporters/elasticsearch/test/es_log_record_exporter_test.cc @@ -2,50 +2,48 @@ // SPDX-License-Identifier: Apache-2.0 #include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" -#include "opentelemetry/ext/http/server/http_server.h" -#include "opentelemetry/logs/provider.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/logs/exporter.h" -#include "opentelemetry/sdk/logs/logger_provider.h" -#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/sdk/resource/resource.h" #include -#include +#include +#include namespace sdklogs = opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; namespace nostd = opentelemetry::nostd; namespace logs_exporter = opentelemetry::exporter::logs; -TEST(ElasticsearchLogsExporterTests, Dummy) -{ - // to enable linking -} - -#if 0 // Attempt to write a log to an invalid host/port, test that the Export() returns failure -TEST(ElasticsearchLogsExporterTests, InvalidEndpoint) +TEST(DISABLED_ElasticsearchLogsExporterTests, InvalidEndpoint) { // Create invalid connection options for the elasticsearch exporter logs_exporter::ElasticsearchExporterOptions options("localhost", -1); // Create an elasticsearch exporter - auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogRecordExporter(options)); + auto exporter = std::unique_ptr( + new logs_exporter::ElasticsearchLogRecordExporter(options)); // Create a log record and send to the exporter auto record = exporter->MakeRecordable(); auto result = exporter->Export(nostd::span>(&record, 1)); // Ensure the return value is failure - ASSERT_EQ(result, sdk::common::ExportResult::kFailure); + ASSERT_EQ(result, opentelemetry::sdk::common::ExportResult::kFailure); } // Test that when the exporter is shutdown, any call to Export should return failure -TEST(ElasticsearchLogsExporterTests, Shutdown) +TEST(DISABLED_ElasticsearchLogsExporterTests, Shutdown) { // Create an elasticsearch exporter and immediately shut it down - auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogRecordExporter); + auto exporter = std::unique_ptr( + new logs_exporter::ElasticsearchLogRecordExporter); bool shutdownResult = exporter->Shutdown(); ASSERT_TRUE(shutdownResult); @@ -54,15 +52,15 @@ TEST(ElasticsearchLogsExporterTests, Shutdown) auto result = exporter->Export(nostd::span>(&record, 1)); // Ensure the return value is failure - ASSERT_EQ(result, sdk::common::ExportResult::kFailure); + ASSERT_EQ(result, opentelemetry::sdk::common::ExportResult::kFailure); } // Test the elasticsearch recordable object -TEST(ElasticsearchLogsExporterTests, RecordableCreation) +TEST(DISABLED_ElasticsearchLogsExporterTests, RecordableCreation) { // Create an elasticsearch exporter - auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogRecordExporter); + auto exporter = std::unique_ptr( + new logs_exporter::ElasticsearchLogRecordExporter); // Create a recordable auto record = exporter->MakeRecordable(); @@ -79,4 +77,52 @@ TEST(ElasticsearchLogsExporterTests, RecordableCreation) exporter->Export(nostd::span>(&record, 1)); } -#endif + +TEST(ElasticsearchLogRecordableTests, BasicTests) +{ + const auto severity = logs_api::Severity::kFatal; + const std::array stringlist{ + {nostd::string_view("string1"), nostd::string_view("string2")}}; + + const std::int64_t expected_observed_ts = 1732063944999647774LL; + const std::string expected_timestamp("2024-11-20T00:52:24.999647Z"); + const std::string expected_severity( + opentelemetry::logs::SeverityNumToText[static_cast(severity)]); + const std::string expected_body("Body of the log message"); + const std::string expected_scope_name("scope_name"); + const bool expected_boolean = false; + const int expected_int = 1; + const double expected_double = 2.0; + + const nlohmann::json expected{ + {"@timestamp", expected_timestamp}, + {"boolean", expected_boolean}, + {"double", expected_double}, + {"ecs", {{"version", "8.11.0"}}}, + {"int", expected_int}, + {"log", {{"level", expected_severity}, {"logger", expected_scope_name}}}, + {"message", expected_body}, + {"observedtimestamp", expected_observed_ts}, + {"stringlist", {stringlist[0], stringlist[1]}}}; + + const opentelemetry::common::SystemTimestamp now{std::chrono::nanoseconds(expected_observed_ts)}; + + const auto scope = + opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create(expected_scope_name); + + opentelemetry::exporter::logs::ElasticSearchRecordable recordable; + recordable.SetTimestamp(now); + recordable.SetObservedTimestamp(now); + recordable.SetSeverity(severity); + recordable.SetBody(expected_body); + recordable.SetInstrumentationScope(*scope); + + recordable.SetAttribute("boolean", expected_boolean); + recordable.SetAttribute("int", expected_int); + recordable.SetAttribute("double", expected_double); + recordable.SetAttribute("stringlist", stringlist); + + const auto actual = recordable.GetJSON(); + + EXPECT_EQ(actual, expected); +} diff --git a/deps/opentelemetry-cpp/exporters/etw/README.md b/deps/opentelemetry-cpp/exporters/etw/README.md index 3339223fa6c..372aa5738e7 100644 --- a/deps/opentelemetry-cpp/exporters/etw/README.md +++ b/deps/opentelemetry-cpp/exporters/etw/README.md @@ -12,215 +12,5 @@ subsequent data recording or forwarding to alternate pipelines and flows. Windows Event Tracing infrastructure is available to any vendor or application being deployed on Windows. -## API support - -These are the features planned to be supported by ETW exporter: - -- [x] OpenTelemetry Tracing API and SDK headers are **stable** and moving - towards GA. -- [ ] OpenTelemetry Logging API is work-in-progress, pending implementation of - [Latest Logging API spec - here](https://github.com/open-telemetry/oteps/pull/150) -- [ ] OpenTelemetry Metrics API is not implemented yet. - -Implementation of OpenTelemetry C++ SDK ETW exporter on Windows OS is `header -only` : - -- full definitions of all macros, functions and classes comprising the library -are visible to the compiler in a header file form. -- implementation does not need to be separately compiled, packaged and installed - in order to be used. - -All that is required is to point the compiler at the location of the headers, -and then `#include` the header files into the application source. Compiler's -optimizer can do a much better job when all the library's source code is -available. Several options below may be turned on to optimize the code with the -usage of standard C++ library, Microsoft Guidelines Support library, Google -Abseil Variant library. Or enabling support for non-standard features, such as -8-bit byte arrays support that enables performance-efficient representation of -binary blobs on ETW wire. - -## Example project - -The following include directories are required, relative to the top-level source -tree of OpenTelemetry C++ repo: - -- api/include/ -- exporters/etw/include/ -- sdk/include/ - -Code that instantiates ETW TracerProvider, subsequently obtaining a Tracer bound -to `OpenTelemetry-ETW-Provider`, and emitting a span named `MySpan` with -attributes on it, as well as `MyEvent` within that span. - -```cpp - -#include -#include - -#include "opentelemetry/exporters/etw/etw_tracer_exporter.h" - -using namespace OPENTELEMETRY_NAMESPACE; -using namespace opentelemetry::exporter::etw; - -// Supply unique instrumentation name (ETW Provider Name) here: -std::string providerName = "OpenTelemetry-ETW-Provider"; - -exporter::etw::TracerProvider tp; - -int main(int argc, const char* argv[]) -{ - // Obtain a Tracer object for instrumentation name. - // Each Tracer is associated with unique TraceId. - auto tracer = tp.GetTracer(providerName, "TLD"); - - // Properties is a helper class in ETW namespace that is otherwise compatible - // with Key-Value Iterable accepted by OpenTelemetry API. Using Properties - // should enable more efficient data transfer without unnecessary memcpy. - - // Span attributes - Properties attribs = - { - {"attrib1", 1}, - {"attrib2", 2} - }; - - // Start Span with attributes - auto span = tracer->StartSpan("MySpan", attribs); - - // Emit an event on Span - std::string eventName = "MyEvent1"; - Properties event = - { - {"uint32Key", (uint32_t)1234}, - {"uint64Key", (uint64_t)1234567890}, - {"strKey", "someValue"} - }; - span->AddEvent(eventName, event); - - // End Span. - span->End(); - - // Close the Tracer on application stop. - tracer->CloseWithMicroseconds(0); - - return 0; -} -``` - -Note that different `Tracer` objects may be bound to different ETW destinations. - -## Build options and Compiler Defines - -While including OpenTelemetry C++ SDK with ETW exporter, the customers are in -complete control of what options they would like to enable for their project -using `Preprocessor Definitions`. - -These options affect how "embedded in application" OpenTelemetry C++ SDK code is -compiled: - -| Name | Description | -|---------------------|------------------------------------------------------------------------------------------------------------------------| -| OPENTELEMETRY_STL_VERSION | Use STL classes for API surface. C++20 is recommended. Some customers may benefit from STL library provided with the compiler instead of using custom OpenTelemetry `nostd::` implementation due to security and performance considerations. | -| HAVE_GSL | Use [Microsoft GSL](https://github.com/microsoft/GSL) for `gsl::span` implementation. Library must be in include path. Microsoft GSL claims to be the most feature-complete implementation of `std::span`. It may be used instead of `nostd::span` implementation in projects that statically link OpenTelemetry SDK. | -| HAVE_TLD | Use ETW/TraceLogging Dynamic protocol. This is the default implementation compatible with existing C# "listeners" / "decoders" of ETW events. This option requires an additional optional Microsoft MIT-licensed `TraceLoggingDynamic.h` header. | - -## Debugging - -### ETW TraceLogging Dynamic Events - -ETW supports a mode that is called "Dynamic Manifest", where event may contain -strongly-typed key-value pairs, with primitive types such as `integer`, -`double`, `string`, etc. This mode requires `TraceLoggingDynamic.h` header. -Please refer to upstream repository containining [Microsoft TraceLogging Dynamic -framework](https://github.com/microsoft/tracelogging-dynamic-windows) licensed -under [MIT -License](https://github.com/microsoft/tracelogging-dynamic-windows/blob/main/LICENSE). - -Complete [list of ETW -types](https://docs.microsoft.com/en-us/windows/win32/wes/eventmanifestschema-outputtype-complextype#remarks). - -OpenTelemetry C++ ETW exporter implements the following type mapping: - -| OpenTelemetry C++ API type | ETW type | -|----------------------------|-----------------| -| bool | xs:byte | -| int (32-bit) | xs:int | -| int (64-bit) | xs:long | -| uint (32-bit) | xs:unsignedInt | -| uint (64-bit) | xs:unsignedLong | -| double | xs:double | -| string | win:Utf8 | - -Support for arrays of primitive types is not implemented yet. - -Visual Studio 2019 allows to use `View -> Other Windows -> Diagnostic Events` to -capture events that are emitted by instrumented application and sent to ETW -provider in a live view. Instrumentation name passed to `GetTracer` API above -corresponds to `ETW Provider Name`. If Instrumentation name contains a GUID - -starts with a curly brace, e.g. `{deadbeef-fade-dead-c0de-cafebabefeed}` then -the parameter is assumed to be `ETW Provider GUID`. - -Click on `Settings` and add the provider to monitor either by its Name or by -GUID. In above example, the provider name is `OpenTelemetry-ETW-Provider`. -Please refer to Diagnostic Events usage instructions -[here](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-diagnostics-how-to-monitor-and-diagnose-services-locally#view-service-fabric-system-events-in-visual-studio) -to learn more. Note that running ETW Listener in Visual Studio requires -Elevation, i.e. Visual Studio would prompt you to confirm that you accept to run -the ETW Listener process as Administrator. This is a limitation of ETW -Listeners, they must be run as privileged process. - -### ETW events encoded in MessagePack - -OpenTelemetry ETW exporter optionally allows to encode the incoming event -payload using [MessagePack](https://msgpack.org/index.html) compact binary -protocol. ETW/MsgPack encoding requires -[nlohmann/json](https://github.com/nlohmann/json) library to be included in the -build of OpenTelemetry ETW exporter. Any recent version of `nlohmann/json` is -compatible with ETW exporter. For example, the version included in -`third_party/nlohmann-json` directory may be used. - -There is currently **no built-in decoder available** for this format. However, -there is ongoing effort to include the ETW/MsgPack decoder in -[Azure/diagnostics-eventflow](https://github.com/Azure/diagnostics-eventflow) -project, which may be used as a side-car listener to forward incoming -ETW/MsgPack events to many other destinations, such as: - -- StdOutput (console output) -- HTTP (json via http) -- Application Insights -- Azure EventHub -- Elasticsearch -- Azure Monitor Logs - -And community-contributed exporters: - -- Google Big Query output -- SQL Server output -- ReflectInsight output -- Splunk output - -[This PR](https://github.com/Azure/diagnostics-eventflow/pull/382) implements -the `Input adapter` for OpenTelemetry ETW/MsgPack protocol encoded events for -Azure EventFlow. - -Other standard tools for processing ETW events on Windows OS, such as: - -- [PerfView](https://github.com/microsoft/perfview) -- [PerfViewJS](https://github.com/microsoft/perfview/tree/main/src/PerfViewJS) - -will be augmented in future with support for ETW/MsgPack encoding. - -## Addendum - -This document needs to be supplemented with additional information: - -- [ ] mapping between OpenTelemetry fields and concepts and their corresponding - ETW counterparts -- [ ] links to E2E instrumentation example and ETW listener -- [ ] Logging API example -- [ ] Metrics API example (once Metrics spec is finalized) -- [ ] example how ETW Listener may employ OpenTelemetry .NET SDK to 1-1 - transform from ETW events back to OpenTelemetry flow -- [ ] links to NuGet package that contains the source code of SDK that includes - OpenTelemetry SDK and ETW exporter +It is recommended to consume this exporter via +[vcpkg](https://vcpkg.io/en/package/opentelemetry-cpp). diff --git a/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_data.cc b/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_data.cc index 2a77e0b5a36..90f1c1450fa 100644 --- a/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_data.cc +++ b/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_data.cc @@ -31,7 +31,9 @@ void SimpleAggregateInMemoryMetricData::Add(std::unique_ptr res const auto &metric = m.instrument_descriptor.name_; for (const auto &pda : m.point_data_attr_) { - data_[{scope, metric}].insert({pda.attributes, pda.point_data}); + // NOTE: Explicit type conversion added for C++11 (gcc 4.8) + data_[std::tuple{scope, metric}].insert( + {pda.attributes, pda.point_data}); } } } @@ -41,7 +43,8 @@ const SimpleAggregateInMemoryMetricData::AttributeToPoint &SimpleAggregateInMemo const std::string &scope, const std::string &metric) { - return data_[{scope, metric}]; + // NOTE: Explicit type conversion added for C++11 (gcc 4.8) + return data_[std::tuple{scope, metric}]; } void SimpleAggregateInMemoryMetricData::Clear() diff --git a/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_exporter_factory.cc b/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_exporter_factory.cc index f2577c4e9b7..0deff73dcd6 100644 --- a/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_exporter_factory.cc +++ b/deps/opentelemetry-cpp/exporters/memory/src/in_memory_metric_exporter_factory.cc @@ -49,7 +49,7 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter OTEL_INTERNAL_LOG_ERROR("[In Memory Metric Exporter] Exporting failed, exporter is shutdown"); return ExportResult::kFailure; } - data_->Add(std::make_unique(data)); + data_->Add(std::unique_ptr(new ResourceMetrics{data})); return ExportResult::kSuccess; } @@ -78,14 +78,15 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter std::unique_ptr InMemoryMetricExporterFactory::Create( const std::shared_ptr &data) { - return Create(data, [](auto) { return AggregationTemporality::kCumulative; }); + return Create(data, + [](sdk::metrics::InstrumentType) { return AggregationTemporality::kCumulative; }); } std::unique_ptr InMemoryMetricExporterFactory::Create( const std::shared_ptr &data, const AggregationTemporalitySelector &temporality) { - return std::make_unique(data, temporality); + return std::unique_ptr(new InMemoryMetricExporter{data, temporality}); } } // namespace memory diff --git a/deps/opentelemetry-cpp/exporters/memory/test/in_memory_metric_data_test.cc b/deps/opentelemetry-cpp/exporters/memory/test/in_memory_metric_data_test.cc index ffaba2cfb9c..3f2d661759e 100644 --- a/deps/opentelemetry-cpp/exporters/memory/test/in_memory_metric_data_test.cc +++ b/deps/opentelemetry-cpp/exporters/memory/test/in_memory_metric_data_test.cc @@ -23,8 +23,8 @@ TEST(InMemoryMetricDataTest, CircularBuffer) { CircularBufferInMemoryMetricData buf(10); Resource resource = Resource::GetEmpty(); - buf.Add(std::make_unique( - &resource, std::vector{{nullptr, std::vector{}}})); + buf.Add(std::unique_ptr(new ResourceMetrics{ + &resource, std::vector{{nullptr, std::vector{}}}})); EXPECT_EQ((*buf.Get().begin())->resource_, &resource); } @@ -45,8 +45,8 @@ TEST(InMemoryMetricDataTest, SimpleAggregate) md.instrument_descriptor.name_ = "my-metric"; md.point_data_attr_.push_back(pda); - agg.Add(std::make_unique( - &resource, std::vector{{scope.get(), std::vector{md}}})); + agg.Add(std::unique_ptr(new ResourceMetrics{ + &resource, std::vector{{scope.get(), std::vector{md}}}})); auto it = agg.Get("my-scope", "my-metric").begin(); auto saved_point = opentelemetry::nostd::get(it->second); diff --git a/deps/opentelemetry-cpp/exporters/otlp/BUILD b/deps/opentelemetry-cpp/exporters/otlp/BUILD index a2dd8f8c650..eb3d23d5791 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/BUILD +++ b/deps/opentelemetry-cpp/exporters/otlp/BUILD @@ -42,11 +42,13 @@ cc_library( name = "otlp_grpc_client", srcs = [ "src/otlp_grpc_client.cc", + "src/otlp_grpc_client_factory.cc", "src/otlp_grpc_utils.cc", ], hdrs = [ "include/opentelemetry/exporters/otlp/otlp_environment.h", "include/opentelemetry/exporters/otlp/otlp_grpc_client.h", + "include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h", "include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h", "include/opentelemetry/exporters/otlp/otlp_grpc_utils.h", "include/opentelemetry/exporters/otlp/protobuf_include_prefix.h", diff --git a/deps/opentelemetry-cpp/exporters/otlp/CMakeLists.txt b/deps/opentelemetry-cpp/exporters/otlp/CMakeLists.txt index 83b35f16a78..34da75b563a 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/CMakeLists.txt +++ b/deps/opentelemetry-cpp/exporters/otlp/CMakeLists.txt @@ -23,8 +23,10 @@ target_link_libraries(opentelemetry_otlp_recordable if(WITH_OTLP_GRPC) find_package(gRPC REQUIRED) - add_library(opentelemetry_exporter_otlp_grpc_client src/otlp_grpc_client.cc - src/otlp_grpc_utils.cc) + add_library( + opentelemetry_exporter_otlp_grpc_client + src/otlp_grpc_client.cc src/otlp_grpc_client_factory.cc + src/otlp_grpc_utils.cc) set_target_properties(opentelemetry_exporter_otlp_grpc_client PROPERTIES EXPORT_NAME otlp_grpc_client) set_target_version(opentelemetry_exporter_otlp_grpc_client) @@ -45,7 +47,7 @@ if(WITH_OTLP_GRPC) INTERFACE_INCLUDE_DIRECTORIES) if(GRPC_INCLUDE_DIRECTORY) target_include_directories( - opentelemetry_exporter_otlp_grpc_client + opentelemetry_exporter_otlp_grpc_client BEFORE PUBLIC "$") endif() target_include_directories( diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h index 89224403a44..3ded3a16ebf 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h @@ -13,14 +13,18 @@ #include "opentelemetry/exporters/otlp/otlp_grpc_client_options.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on #include "google/protobuf/arena.h" #include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" #include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" #include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// clang-format on OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -28,11 +32,25 @@ namespace exporter namespace otlp { +class OtlpGrpcClient; struct OtlpGrpcClientOptions; - -#ifdef ENABLE_ASYNC_EXPORT struct OtlpGrpcClientAsyncData; -#endif + +class OtlpGrpcClientReferenceGuard +{ +public: + OtlpGrpcClientReferenceGuard() noexcept; + ~OtlpGrpcClientReferenceGuard() noexcept; + + OtlpGrpcClientReferenceGuard(const OtlpGrpcClientReferenceGuard &) = delete; + OtlpGrpcClientReferenceGuard(OtlpGrpcClientReferenceGuard &&) = delete; + OtlpGrpcClientReferenceGuard &operator=(const OtlpGrpcClientReferenceGuard &) = delete; + OtlpGrpcClientReferenceGuard &operator=(OtlpGrpcClientReferenceGuard &&) = delete; + +private: + friend class OtlpGrpcClient; + std::atomic has_value_; +}; /** * The OTLP gRPC client contains utility functions of gRPC. @@ -40,7 +58,7 @@ struct OtlpGrpcClientAsyncData; class OtlpGrpcClient { public: - OtlpGrpcClient(); + OtlpGrpcClient(const OtlpGrpcClientOptions &options); ~OtlpGrpcClient(); @@ -58,20 +76,18 @@ class OtlpGrpcClient /** * Create trace service stub to communicate with the OpenTelemetry Collector. */ - static std::unique_ptr - MakeTraceServiceStub(const OtlpGrpcClientOptions &options); + std::unique_ptr MakeTraceServiceStub(); /** * Create metrics service stub to communicate with the OpenTelemetry Collector. */ - static std::unique_ptr - MakeMetricsServiceStub(const OtlpGrpcClientOptions &options); + std::unique_ptr + MakeMetricsServiceStub(); /** * Create logs service stub to communicate with the OpenTelemetry Collector. */ - static std::unique_ptr - MakeLogsServiceStub(const OtlpGrpcClientOptions &options); + std::unique_ptr MakeLogsServiceStub(); static grpc::Status DelegateExport( proto::collector::trace::v1::TraceService::StubInterface *stub, @@ -94,8 +110,18 @@ class OtlpGrpcClient proto::collector::logs::v1::ExportLogsServiceRequest &&request, proto::collector::logs::v1::ExportLogsServiceResponse *response); -#ifdef ENABLE_ASYNC_EXPORT + void AddReference(OtlpGrpcClientReferenceGuard &guard, + const OtlpGrpcClientOptions &options) noexcept; + /** + * Reomve reference fro a guard object + * + * @param guard guard object to remove reference from + * @return true if there is no more reference to this gRPC client + */ + bool RemoveReference(OtlpGrpcClientReferenceGuard &guard) noexcept; + +#ifdef ENABLE_ASYNC_EXPORT /** * Async export * @param options Options used to message to create gRPC context and stub(if necessary) @@ -155,6 +181,7 @@ class OtlpGrpcClient const proto::collector::logs::v1::ExportLogsServiceRequest &, proto::collector::logs::v1::ExportLogsServiceResponse *)> &&result_callback) noexcept; +#endif /** * Force flush the gRPC client. @@ -167,17 +194,19 @@ class OtlpGrpcClient * timeout is applied. * @return return the status of this operation */ - bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept; + bool Shutdown(OtlpGrpcClientReferenceGuard &guard, + std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept; std::shared_ptr MutableAsyncData(const OtlpGrpcClientOptions &options); + bool IsShutdown() const noexcept; + private: // Stores if this gRPC client had its Shutdown() method called std::atomic is_shutdown_; // Stores shared data between threads of this gRPC client std::shared_ptr async_data_; -#endif }; } // namespace otlp } // namespace exporter diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h new file mode 100644 index 00000000000..ded0eadd8e2 --- /dev/null +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +#include "opentelemetry/exporters/otlp/otlp_grpc_client_options.h" +#include "opentelemetry/nostd/shared_ptr.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace exporter +{ +namespace otlp +{ + +class OtlpGrpcClientReferenceGuard; +class OtlpGrpcClient; + +/** + * Factory class for OtlpGrpcClient. + */ +class OPENTELEMETRY_EXPORT OtlpGrpcClientFactory +{ +public: + /** + * Create an OtlpGrpcClient using all default options. + */ + static std::shared_ptr Create(const OtlpGrpcClientOptions &options); + + static std::shared_ptr CreateReferenceGuard(); +}; + +} // namespace otlp +} // namespace exporter +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h index 80346a253da..1022b0dc8fc 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h @@ -6,12 +6,17 @@ #include #include +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on #include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// clang-format on +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/trace/exporter.h" #include "opentelemetry/exporters/otlp/otlp_environment.h" @@ -23,6 +28,8 @@ namespace exporter namespace otlp { +class OtlpGrpcClientReferenceGuard; + class OtlpGrpcClient; /** @@ -36,11 +43,22 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter */ OtlpGrpcExporter(); + /** + * Create an OtlpGrpcExporter using specified OtlpGrpcClient. + * + * @param options options to create exporter + * @param client the gRPC client to use + */ + OtlpGrpcExporter(const OtlpGrpcExporterOptions &options, + const std::shared_ptr &client); + /** * Create an OtlpGrpcExporter using the given options. */ explicit OtlpGrpcExporter(const OtlpGrpcExporterOptions &options); + ~OtlpGrpcExporter() override; + /** * Create a span recordable. * @return a newly initialized Recordable object @@ -71,20 +89,26 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter bool Shutdown( std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + /** + * Get the Client object + * + * @return return binded gRPC client + */ + const std::shared_ptr &GetClient() const noexcept; + private: // The configuration options associated with this exporter. const OtlpGrpcExporterOptions options_; -#ifdef ENABLE_ASYNC_EXPORT std::shared_ptr client_; -#endif + std::shared_ptr client_reference_guard_; // For testing friend class OtlpGrpcExporterTestPeer; friend class OtlpGrpcLogRecordExporterTestPeer; // Store service stub internally. Useful for testing. - std::unique_ptr trace_service_stub_; + std::shared_ptr trace_service_stub_; /** * Create an OtlpGrpcExporter using the specified service stub. @@ -92,6 +116,16 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter * @param stub the service stub to be used for exporting */ OtlpGrpcExporter(std::unique_ptr stub); + + /** + * Create an OtlpGrpcExporter using the specified service stub and gRPC client. + * Only tests can call this constructor directly. + * @param stub the service stub to be used for exporting + * @param client the gRPC client to use + */ + OtlpGrpcExporter(std::unique_ptr stub, + const std::shared_ptr &client); + std::atomic is_shutdown_{false}; bool isShutdown() const noexcept; }; diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h index 518cf8b82cb..24d19d5ced4 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h @@ -6,6 +6,7 @@ #include #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/trace/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -14,6 +15,8 @@ namespace exporter namespace otlp { +class OtlpGrpcClient; + /** * Factory class for OtlpGrpcExporter. */ @@ -30,6 +33,13 @@ class OPENTELEMETRY_EXPORT OtlpGrpcExporterFactory */ static std::unique_ptr Create( const OtlpGrpcExporterOptions &options); + + /** + * Create an OtlpGrpcExporter using the given options and gRPC client. + */ + static std::unique_ptr Create( + const OtlpGrpcExporterOptions &options, + const std::shared_ptr &client); }; } // namespace otlp diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h index 72af90701f2..da278ccd282 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h @@ -4,15 +4,18 @@ #pragma once // clang-format off - #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on + #include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" -#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // clang-format on #include "opentelemetry/exporters/otlp/otlp_environment.h" #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/logs/exporter.h" #include @@ -23,6 +26,8 @@ namespace exporter namespace otlp { +class OtlpGrpcClientReferenceGuard; + class OtlpGrpcClient; /** @@ -36,12 +41,23 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo */ OtlpGrpcLogRecordExporter(); + /** + * Create an OtlpGrpcLogRecordExporter using specified OtlpGrpcClient. + * + * @param options options to create exporter + * @param client the gRPC client to use + */ + OtlpGrpcLogRecordExporter(const OtlpGrpcLogRecordExporterOptions &options, + const std::shared_ptr &client); + /** * Create an OtlpGrpcLogRecordExporter with user specified options. * @param options An object containing the user's configuration options. */ OtlpGrpcLogRecordExporter(const OtlpGrpcLogRecordExporterOptions &options); + ~OtlpGrpcLogRecordExporter() override; + /** * Creates a recordable that stores the data in protobuf. * @return a newly initialized Recordable object. @@ -72,19 +88,25 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo bool Shutdown( std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + /** + * Get the Client object + * + * @return return binded gRPC client + */ + const std::shared_ptr &GetClient() const noexcept; + private: // Configuration options for the exporter const OtlpGrpcLogRecordExporterOptions options_; -#ifdef ENABLE_ASYNC_EXPORT std::shared_ptr client_; -#endif + std::shared_ptr client_reference_guard_; // For testing friend class OtlpGrpcLogRecordExporterTestPeer; // Store service stub internally. Useful for testing. - std::unique_ptr log_service_stub_; + std::shared_ptr log_service_stub_; /** * Create an OtlpGrpcLogRecordExporter using the specified service stub. @@ -93,6 +115,17 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo */ OtlpGrpcLogRecordExporter( std::unique_ptr stub); + + /** + * Create an OtlpGrpcLogRecordExporter using the specified service stub and gRPC client. + * Only tests can call this constructor directly. + * @param stub the service stub to be used for exporting + * @param client the gRPC client to use + */ + OtlpGrpcLogRecordExporter( + std::unique_ptr stub, + const std::shared_ptr &client); + std::atomic is_shutdown_{false}; bool isShutdown() const noexcept; }; diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h index 7a886159594..e69a20b4522 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h @@ -4,6 +4,7 @@ #pragma once #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/logs/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -12,6 +13,8 @@ namespace exporter namespace otlp { +class OtlpGrpcClient; + /** * Factory class for OtlpGrpcLogRecordExporter. */ @@ -24,10 +27,17 @@ class OPENTELEMETRY_EXPORT OtlpGrpcLogRecordExporterFactory static std::unique_ptr Create(); /** - * Create a OtlpGrpcLogRecordExporter. + * Create a OtlpGrpcLogRecordExporter using the given options. */ static std::unique_ptr Create( const OtlpGrpcLogRecordExporterOptions &options); + + /** + * Create a OtlpGrpcLogRecordExporter using the given options and gRPC client. + */ + static std::unique_ptr Create( + const OtlpGrpcLogRecordExporterOptions &options, + const std::shared_ptr &client); }; } // namespace otlp diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h index 3899e926f64..d3d857b3f08 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h @@ -4,15 +4,18 @@ #pragma once // clang-format off - #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on + #include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" -#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // clang-format on #include "opentelemetry/exporters/otlp/otlp_environment.h" #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" #include @@ -23,6 +26,7 @@ namespace exporter namespace otlp { +class OtlpGrpcClientReferenceGuard; class OtlpGrpcClient; /** @@ -36,11 +40,22 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp */ OtlpGrpcMetricExporter(); + /** + * Create an OtlpGrpcMetricExporter using specified OtlpGrpcClient. + * + * @param options options to create exporter + * @param client the gRPC client to use + */ + OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options, + const std::shared_ptr &client); + /** * Create an OtlpGrpcMetricExporter using the given options. */ explicit OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options); + ~OtlpGrpcMetricExporter() override; + /** * Get the AggregationTemporality for exporter * @@ -58,13 +73,19 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp bool Shutdown( std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + /** + * Get the Client object + * + * @return return binded gRPC client + */ + const std::shared_ptr &GetClient() const noexcept; + private: // The configuration options associated with this exporter. const OtlpGrpcMetricExporterOptions options_; -#ifdef ENABLE_ASYNC_EXPORT std::shared_ptr client_; -#endif + std::shared_ptr client_reference_guard_; // Aggregation Temporality selector const sdk::metrics::AggregationTemporalitySelector aggregation_temporality_selector_; @@ -73,7 +94,7 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp friend class OtlpGrpcMetricExporterTestPeer; // Store service stub internally. Useful for testing. - std::unique_ptr + std::shared_ptr metrics_service_stub_; /** @@ -83,6 +104,17 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp */ OtlpGrpcMetricExporter( std::unique_ptr stub); + + /** + * Create an OtlpGrpcMetricExporter using the specified service stub and gRPC client. + * Only tests can call this constructor directly. + * @param stub the service stub to be used for exporting + * @param client the gRPC client to use + */ + OtlpGrpcMetricExporter( + std::unique_ptr stub, + const std::shared_ptr &client); + std::atomic is_shutdown_{false}; bool isShutdown() const noexcept; }; diff --git a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h index 11b185a384a..5d405609b0e 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h +++ b/deps/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h @@ -6,6 +6,7 @@ #include #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -14,6 +15,8 @@ namespace exporter namespace otlp { +class OtlpGrpcClient; + /** * Factory class for OtlpGrpcMetricExporter. */ @@ -26,10 +29,17 @@ class OPENTELEMETRY_EXPORT OtlpGrpcMetricExporterFactory static std::unique_ptr Create(); /** - * Create a OtlpGrpcMetricExporter. + * Create a OtlpGrpcMetricExporter using the given options. */ static std::unique_ptr Create( const OtlpGrpcMetricExporterOptions &options); + + /** + * Create a OtlpGrpcMetricExporter using the given options and gRPC client. + */ + static std::unique_ptr Create( + const OtlpGrpcMetricExporterOptions &options, + const std::shared_ptr &client); }; } // namespace otlp diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client.cc index d3d59bce6e8..fe38f16e2ba 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client.cc @@ -78,16 +78,20 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpGrpcAsyncCallData : public OtlpGrpcAsyncCal virtual ~OtlpGrpcAsyncCallData() {} }; } // namespace +#endif struct OtlpGrpcClientAsyncData { + std::chrono::system_clock::duration export_timeout = std::chrono::seconds{10}; // The best performance trade-off of gRPC is having numcpu's threads and one completion queue // per thread, but this exporter should not cost a lot resource and we don't want to create - // too many threads in the process. So we use one completion queue. - grpc::CompletionQueue cq; - + // too many threads in the process. So we use one completion queue and shared context. + std::shared_ptr channel; +#ifdef ENABLE_ASYNC_EXPORT + std::mutex running_calls_lock; + std::unordered_set> running_calls; // Running requests, this is used to limit the number of concurrent requests. std::atomic running_requests{0}; // Request counter is used to record ForceFlush. @@ -98,13 +102,16 @@ struct OtlpGrpcClientAsyncData // Condition variable and mutex to control the concurrency count of running requests. std::mutex session_waker_lock; std::condition_variable session_waker; +#endif + + // Reference count of OtlpGrpcClient + std::atomic reference_count{0}; // Do not use OtlpGrpcClientAsyncData() = default; here, some versions of GCC&Clang have BUGs // and may not initialize the member correctly. See also // https://stackoverflow.com/questions/53408962/try-to-understand-compiler-error-message-default-member-initializer-required-be OtlpGrpcClientAsyncData() {} }; -#endif namespace { @@ -199,6 +206,11 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( ++async_data->start_request_counter; ++async_data->running_requests; + { + std::lock_guard lock{async_data->running_calls_lock}; + async_data->running_calls.insert( + std::static_pointer_cast(call_data)); + } // Some old toolchains can only use gRPC 1.33 and it's experimental. # if defined(GRPC_CPP_VERSION_MAJOR) && \ (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 @@ -207,7 +219,13 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( stub->experimental_async() # endif ->Export(call_data->grpc_context.get(), call_data->request, call_data->response, - [call_data, async_data](::grpc::Status grpc_status) { + [call_data, async_data, export_data_name](::grpc::Status grpc_status) { + { + std::lock_guard lock{async_data->running_calls_lock}; + async_data->running_calls.erase( + std::static_pointer_cast(call_data)); + } + --async_data->running_requests; ++async_data->finished_request_counter; @@ -216,6 +234,13 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( { call_data->export_result = opentelemetry::sdk::common::ExportResult::kSuccess; } + else + { + OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] ERROR: Export " + << export_data_name << " failed with status_code: \"" + << grpc_status.error_code() << "\" error_message: \"" + << grpc_status.error_message() << "\""); + } if (call_data->grpc_async_callback) { @@ -240,18 +265,38 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( #endif } // namespace -OtlpGrpcClient::OtlpGrpcClient() -#ifdef ENABLE_ASYNC_EXPORT - : is_shutdown_(false) -#endif -{} +OtlpGrpcClientReferenceGuard::OtlpGrpcClientReferenceGuard() noexcept : has_value_{false} {} + +OtlpGrpcClientReferenceGuard::~OtlpGrpcClientReferenceGuard() noexcept {} + +OtlpGrpcClient::OtlpGrpcClient(const OtlpGrpcClientOptions &options) : is_shutdown_(false) +{ + std::shared_ptr async_data = MutableAsyncData(options); + async_data->channel = MakeChannel(options); +} OtlpGrpcClient::~OtlpGrpcClient() { -#ifdef ENABLE_ASYNC_EXPORT std::shared_ptr async_data; async_data.swap(async_data_); +#ifdef ENABLE_ASYNC_EXPORT + if (async_data) + { + std::unordered_set> running_calls; + { + std::lock_guard lock(async_data->running_calls_lock); + running_calls = async_data->running_calls; + } + for (auto &call_data : running_calls) + { + if (call_data && call_data->grpc_context) + { + call_data->grpc_context->TryCancel(); + } + } + } + while (async_data && async_data->running_requests.load(std::memory_order_acquire) > 0) { std::unique_lock lock{async_data->session_waker_lock}; @@ -350,21 +395,33 @@ std::unique_ptr OtlpGrpcClient::MakeClientContext( } std::unique_ptr -OtlpGrpcClient::MakeTraceServiceStub(const OtlpGrpcClientOptions &options) +OtlpGrpcClient::MakeTraceServiceStub() { - return proto::collector::trace::v1::TraceService::NewStub(MakeChannel(options)); + if (!async_data_ || !async_data_->channel) + { + return nullptr; + } + return proto::collector::trace::v1::TraceService::NewStub(async_data_->channel); } std::unique_ptr -OtlpGrpcClient::MakeMetricsServiceStub(const OtlpGrpcClientOptions &options) +OtlpGrpcClient::MakeMetricsServiceStub() { - return proto::collector::metrics::v1::MetricsService::NewStub(MakeChannel(options)); + if (!async_data_ || !async_data_->channel) + { + return nullptr; + } + return proto::collector::metrics::v1::MetricsService::NewStub(async_data_->channel); } std::unique_ptr -OtlpGrpcClient::MakeLogsServiceStub(const OtlpGrpcClientOptions &options) +OtlpGrpcClient::MakeLogsServiceStub() { - return proto::collector::logs::v1::LogsService::NewStub(MakeChannel(options)); + if (!async_data_ || !async_data_->channel) + { + return nullptr; + } + return proto::collector::logs::v1::LogsService::NewStub(async_data_->channel); } grpc::Status OtlpGrpcClient::DelegateExport( @@ -397,6 +454,35 @@ grpc::Status OtlpGrpcClient::DelegateExport( return stub->Export(context.get(), request, response); } +void OtlpGrpcClient::AddReference(OtlpGrpcClientReferenceGuard &guard, + const OtlpGrpcClientOptions &options) noexcept +{ + if (false == guard.has_value_.exchange(true, std::memory_order_acq_rel)) + { + MutableAsyncData(options)->reference_count.fetch_add(1, std::memory_order_acq_rel); + } +} + +bool OtlpGrpcClient::RemoveReference(OtlpGrpcClientReferenceGuard &guard) noexcept +{ + auto async_data = async_data_; + if (true == guard.has_value_.exchange(false, std::memory_order_acq_rel)) + { + if (async_data) + { + int64_t left = async_data->reference_count.fetch_sub(1, std::memory_order_acq_rel); + return left <= 1; + } + } + + if (async_data) + { + return async_data->reference_count.load(std::memory_order_acquire) <= 0; + } + + return true; +} + #ifdef ENABLE_ASYNC_EXPORT /** @@ -500,26 +586,37 @@ sdk::common::ExportResult OtlpGrpcClient::DelegateAsyncExport( "log(s)"); } +#endif + std::shared_ptr OtlpGrpcClient::MutableAsyncData( const OtlpGrpcClientOptions &options) { if (!async_data_) { - async_data_ = std::make_shared(); - async_data_->export_timeout = options.timeout; + async_data_ = std::make_shared(); + async_data_->export_timeout = options.timeout; +#ifdef ENABLE_ASYNC_EXPORT async_data_->max_concurrent_requests = options.max_concurrent_requests; +#endif } return async_data_; } -bool OtlpGrpcClient::ForceFlush(std::chrono::microseconds timeout) noexcept +bool OtlpGrpcClient::IsShutdown() const noexcept +{ + return is_shutdown_.load(std::memory_order_acquire); +} + +bool OtlpGrpcClient::ForceFlush( + OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { if (!async_data_) { return true; } +#ifdef ENABLE_ASYNC_EXPORT std::size_t request_counter = async_data_->start_request_counter.load(std::memory_order_acquire); if (request_counter <= async_data_->finished_request_counter.load(std::memory_order_acquire)) { @@ -558,21 +655,46 @@ bool OtlpGrpcClient::ForceFlush(std::chrono::microseconds timeout) noexcept } return timeout_steady > std::chrono::steady_clock::duration::zero(); +#else + return true; +#endif } -bool OtlpGrpcClient::Shutdown(std::chrono::microseconds timeout) noexcept +bool OtlpGrpcClient::Shutdown(OtlpGrpcClientReferenceGuard &guard, + OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { if (!async_data_) { return true; } + bool last_reference_removed = RemoveReference(guard); bool force_flush_result; - if (false == is_shutdown_.exchange(true, std::memory_order_acq_rel)) + if (last_reference_removed && false == is_shutdown_.exchange(true, std::memory_order_acq_rel)) { + OTEL_INTERNAL_LOG_DEBUG("[OTLP GRPC Client] DEBUG: OtlpGrpcClient start to shutdown"); force_flush_result = ForceFlush(timeout); - async_data_->cq.Shutdown(); +#ifdef ENABLE_ASYNC_EXPORT + std::unordered_set> running_calls; + { + std::lock_guard lock(async_data_->running_calls_lock); + running_calls = async_data_->running_calls; + } + if (!running_calls.empty()) + { + OTEL_INTERNAL_LOG_WARN( + "[OTLP GRPC Client] WARN: OtlpGrpcClient shutdown timeout, try to cancel " + << running_calls.size() << " running calls."); + } + for (auto &call_data : running_calls) + { + if (call_data && call_data->grpc_context) + { + call_data->grpc_context->TryCancel(); + } + } +#endif } else { @@ -582,8 +704,6 @@ bool OtlpGrpcClient::Shutdown(std::chrono::microseconds timeout) noexcept return force_flush_result; } -#endif - } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client_factory.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client_factory.cc new file mode 100644 index 00000000000..310593a77a6 --- /dev/null +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_client_factory.cc @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" +#include + +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace exporter +{ +namespace otlp +{ + +std::shared_ptr OtlpGrpcClientFactory::Create(const OtlpGrpcClientOptions &options) +{ + return std::make_shared(options); +} + +std::shared_ptr OtlpGrpcClientFactory::CreateReferenceGuard() +{ + return std::make_shared(); +} + +} // namespace otlp +} // namespace exporter +OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter.cc index ed0fc745183..e4012c2ebf6 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter.cc @@ -12,6 +12,7 @@ #include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" #include "opentelemetry/sdk_config.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -23,22 +24,53 @@ namespace otlp OtlpGrpcExporter::OtlpGrpcExporter() : OtlpGrpcExporter(OtlpGrpcExporterOptions()) {} -OtlpGrpcExporter::OtlpGrpcExporter(const OtlpGrpcExporterOptions &options) - : options_(options), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif - trace_service_stub_(OtlpGrpcClient::MakeTraceServiceStub(options)) -{} +OtlpGrpcExporter::OtlpGrpcExporter(const OtlpGrpcExporterOptions &options) : options_(options) +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); + + trace_service_stub_ = client_->MakeTraceServiceStub(); +} OtlpGrpcExporter::OtlpGrpcExporter( std::unique_ptr stub) + : options_(OtlpGrpcExporterOptions()), trace_service_stub_(std::move(stub)) +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcExporter::OtlpGrpcExporter(const OtlpGrpcExporterOptions &options, + const std::shared_ptr &client) + : options_(options), + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()) +{ + client_->AddReference(*client_reference_guard_, options_); + + trace_service_stub_ = client_->MakeTraceServiceStub(); +} + +OtlpGrpcExporter::OtlpGrpcExporter( + std::unique_ptr stub, + const std::shared_ptr &client) : options_(OtlpGrpcExporterOptions()), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()), trace_service_stub_(std::move(stub)) -{} +{ + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcExporter::~OtlpGrpcExporter() +{ + if (client_) + { + client_->RemoveReference(*client_reference_guard_); + } +} // ----------------------------- Exporter methods ------------------------------ @@ -50,12 +82,21 @@ std::unique_ptr OtlpGrpcExporter::MakeRecordable() noexc sdk::common::ExportResult OtlpGrpcExporter::Export( const nostd::span> &spans) noexcept { - if (isShutdown()) + std::shared_ptr client = client_; + if (isShutdown() || !client) { OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC] Exporting " << spans.size() << " span(s) failed, exporter is shutdown"); return sdk::common::ExportResult::kFailure; } + + if (!trace_service_stub_) + { + OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC] Exporting " + << spans.size() << " span(s) failed, service stub unavailable"); + return sdk::common::ExportResult::kFailure; + } + if (spans.empty()) { return sdk::common::ExportResult::kSuccess; @@ -82,13 +123,16 @@ sdk::common::ExportResult OtlpGrpcExporter::Export( #ifdef ENABLE_ASYNC_EXPORT if (options_.max_concurrent_requests > 1) { - return client_->DelegateAsyncExport( + return client->DelegateAsyncExport( options_, trace_service_stub_.get(), std::move(context), std::move(arena), std::move(*request), - [](opentelemetry::sdk::common::ExportResult result, - std::unique_ptr &&, - const proto::collector::trace::v1::ExportTraceServiceRequest &request, - proto::collector::trace::v1::ExportTraceServiceResponse *) { + // Capture the trace_service_stub_ to ensure it is not destroyed before the callback is + // called. + [trace_service_stub = trace_service_stub_]( + opentelemetry::sdk::common::ExportResult result, + std::unique_ptr &&, + const proto::collector::trace::v1::ExportTraceServiceRequest &request, + proto::collector::trace::v1::ExportTraceServiceResponse *) { if (result != opentelemetry::sdk::common::ExportResult::kSuccess) { OTEL_INTERNAL_LOG_ERROR("[OTLP TRACE GRPC Exporter] ERROR: Export " @@ -125,22 +169,27 @@ sdk::common::ExportResult OtlpGrpcExporter::Export( bool OtlpGrpcExporter::ForceFlush( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { -#ifdef ENABLE_ASYNC_EXPORT - return client_->ForceFlush(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client = client_; + if (!client) + { + return true; + } + return client->ForceFlush(timeout); } bool OtlpGrpcExporter::Shutdown( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { is_shutdown_ = true; -#ifdef ENABLE_ASYNC_EXPORT - return client_->Shutdown(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client; + client.swap(client_); + if (!client) + { + return true; + } + return client->Shutdown(*client_reference_guard_, timeout); } bool OtlpGrpcExporter::isShutdown() const noexcept @@ -148,6 +197,11 @@ bool OtlpGrpcExporter::isShutdown() const noexcept return is_shutdown_; } +const std::shared_ptr &OtlpGrpcExporter::GetClient() const noexcept +{ + return client_; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter_factory.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter_factory.cc index f8ee7e3594c..5ed832a3cd0 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter_factory.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_exporter_factory.cc @@ -27,6 +27,15 @@ std::unique_ptr OtlpGrpcExporterFactory return exporter; } +std::unique_ptr OtlpGrpcExporterFactory::Create( + const OtlpGrpcExporterOptions &options, + const std::shared_ptr &client) +{ + std::unique_ptr exporter( + new OtlpGrpcExporter(options, client)); + return exporter; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter.cc index 1069703f961..fe05be7b304 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter.cc @@ -6,19 +6,20 @@ #include "opentelemetry/common/macros.h" #include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" #include "opentelemetry/exporters/otlp/otlp_log_recordable.h" #include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" // clang-format off - #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on -#include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" #include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" - // clang-format on #include "opentelemetry/sdk/common/global_log_handler.h" @@ -36,21 +37,54 @@ OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter() OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter( const OtlpGrpcLogRecordExporterOptions &options) - : options_(options), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif - log_service_stub_(OtlpGrpcClient::MakeLogsServiceStub(options)) -{} + : options_(options) +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); + + log_service_stub_ = client_->MakeLogsServiceStub(); +} OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter( std::unique_ptr stub) + : options_(OtlpGrpcLogRecordExporterOptions()), log_service_stub_(std::move(stub)) +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter( + const OtlpGrpcLogRecordExporterOptions &options, + const std::shared_ptr &client) + : options_(options), + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()) +{ + client_->AddReference(*client_reference_guard_, options_); + + log_service_stub_ = client_->MakeLogsServiceStub(); +} + +OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter( + std::unique_ptr stub, + const std::shared_ptr &client) : options_(OtlpGrpcLogRecordExporterOptions()), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()), log_service_stub_(std::move(stub)) -{} +{ + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcLogRecordExporter::~OtlpGrpcLogRecordExporter() +{ + if (client_) + { + client_->RemoveReference(*client_reference_guard_); + } +} // ----------------------------- Exporter methods ------------------------------ @@ -63,12 +97,20 @@ OtlpGrpcLogRecordExporter::MakeRecordable() noexcept opentelemetry::sdk::common::ExportResult OtlpGrpcLogRecordExporter::Export( const nostd::span> &logs) noexcept { - if (isShutdown()) + std::shared_ptr client = client_; + if (isShutdown() || !client) { OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC log] Exporting " << logs.size() << " log(s) failed, exporter is shutdown"); return sdk::common::ExportResult::kFailure; } + if (!log_service_stub_) + { + OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC] Exporting " << logs.size() + << " log(s) failed, service stub unavailable"); + return sdk::common::ExportResult::kFailure; + } + if (logs.empty()) { return sdk::common::ExportResult::kSuccess; @@ -95,13 +137,16 @@ opentelemetry::sdk::common::ExportResult OtlpGrpcLogRecordExporter::Export( #ifdef ENABLE_ASYNC_EXPORT if (options_.max_concurrent_requests > 1) { - return client_->DelegateAsyncExport( + return client->DelegateAsyncExport( options_, log_service_stub_.get(), std::move(context), std::move(arena), std::move(*request), - [](opentelemetry::sdk::common::ExportResult result, - std::unique_ptr &&, - const proto::collector::logs::v1::ExportLogsServiceRequest &request, - proto::collector::logs::v1::ExportLogsServiceResponse *) { + // Capture log_service_stub by value to ensure it is not destroyed before the callback is + // called. + [log_service_stub = log_service_stub_]( + opentelemetry::sdk::common::ExportResult result, + std::unique_ptr &&, + const proto::collector::logs::v1::ExportLogsServiceRequest &request, + proto::collector::logs::v1::ExportLogsServiceResponse *) { if (result != opentelemetry::sdk::common::ExportResult::kSuccess) { OTEL_INTERNAL_LOG_ERROR("[OTLP LOG GRPC Exporter] ERROR: Export " @@ -139,21 +184,26 @@ bool OtlpGrpcLogRecordExporter::Shutdown( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { is_shutdown_ = true; -#ifdef ENABLE_ASYNC_EXPORT - return client_->Shutdown(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client; + client.swap(client_); + if (!client) + { + return true; + } + return client->Shutdown(*client_reference_guard_, timeout); } bool OtlpGrpcLogRecordExporter::ForceFlush( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { -#ifdef ENABLE_ASYNC_EXPORT - return client_->ForceFlush(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client = client_; + if (!client) + { + return true; + } + return client->ForceFlush(timeout); } bool OtlpGrpcLogRecordExporter::isShutdown() const noexcept @@ -161,6 +211,11 @@ bool OtlpGrpcLogRecordExporter::isShutdown() const noexcept return is_shutdown_; } +const std::shared_ptr &OtlpGrpcLogRecordExporter::GetClient() const noexcept +{ + return client_; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc index 7229de569a9..4b519e37e86 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc @@ -28,6 +28,15 @@ OtlpGrpcLogRecordExporterFactory::Create(const OtlpGrpcLogRecordExporterOptions return exporter; } +std::unique_ptr +OtlpGrpcLogRecordExporterFactory::Create(const OtlpGrpcLogRecordExporterOptions &options, + const std::shared_ptr &client) +{ + std::unique_ptr exporter( + new OtlpGrpcLogRecordExporter(options, client)); + return exporter; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc index 6a78149eaad..1723dd557af 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc @@ -6,6 +6,7 @@ #include "opentelemetry/common/macros.h" #include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" #include "opentelemetry/exporters/otlp/otlp_metric_utils.h" @@ -24,24 +25,57 @@ OtlpGrpcMetricExporter::OtlpGrpcMetricExporter() OtlpGrpcMetricExporter::OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options) : options_(options), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif aggregation_temporality_selector_{ - OtlpMetricUtils::ChooseTemporalitySelector(options_.aggregation_temporality)}, - metrics_service_stub_(OtlpGrpcClient::MakeMetricsServiceStub(options)) -{} + OtlpMetricUtils::ChooseTemporalitySelector(options_.aggregation_temporality)} +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); + + metrics_service_stub_ = client_->MakeMetricsServiceStub(); +} OtlpGrpcMetricExporter::OtlpGrpcMetricExporter( std::unique_ptr stub) : options_(OtlpGrpcMetricExporterOptions()), -#ifdef ENABLE_ASYNC_EXPORT - client_(std::make_shared()), -#endif aggregation_temporality_selector_{ OtlpMetricUtils::ChooseTemporalitySelector(options_.aggregation_temporality)}, metrics_service_stub_(std::move(stub)) -{} +{ + client_ = OtlpGrpcClientFactory::Create(options_); + client_reference_guard_ = OtlpGrpcClientFactory::CreateReferenceGuard(); + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcMetricExporter::OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options, + const std::shared_ptr &client) + : options_(options), + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()) +{ + client_->AddReference(*client_reference_guard_, options_); + + metrics_service_stub_ = client_->MakeMetricsServiceStub(); +} + +OtlpGrpcMetricExporter::OtlpGrpcMetricExporter( + std::unique_ptr stub, + const std::shared_ptr &client) + : options_(OtlpGrpcMetricExporterOptions()), + client_(client), + client_reference_guard_(OtlpGrpcClientFactory::CreateReferenceGuard()), + metrics_service_stub_(std::move(stub)) +{ + client_->AddReference(*client_reference_guard_, options_); +} + +OtlpGrpcMetricExporter::~OtlpGrpcMetricExporter() +{ + if (client_) + { + client_->RemoveReference(*client_reference_guard_); + } +} // ----------------------------- Exporter methods ------------------------------ @@ -54,14 +88,23 @@ sdk::metrics::AggregationTemporality OtlpGrpcMetricExporter::GetAggregationTempo opentelemetry::sdk::common::ExportResult OtlpGrpcMetricExporter::Export( const opentelemetry::sdk::metrics::ResourceMetrics &data) noexcept { - - if (isShutdown()) + std::shared_ptr client = client_; + if (isShutdown() || !client) { OTEL_INTERNAL_LOG_ERROR("[OTLP METRICS gRPC] Exporting " << data.scope_metric_data_.size() << " metric(s) failed, exporter is shutdown"); return sdk::common::ExportResult::kFailure; } + + if (!metrics_service_stub_) + { + OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC] Exporting " + << data.scope_metric_data_.size() + << " metric(s) failed, service stub unavailable"); + return sdk::common::ExportResult::kFailure; + } + if (data.scope_metric_data_.empty()) { return sdk::common::ExportResult::kSuccess; @@ -88,13 +131,16 @@ opentelemetry::sdk::common::ExportResult OtlpGrpcMetricExporter::Export( #ifdef ENABLE_ASYNC_EXPORT if (options_.max_concurrent_requests > 1) { - return client_->DelegateAsyncExport( + return client->DelegateAsyncExport( options_, metrics_service_stub_.get(), std::move(context), std::move(arena), std::move(*request), - [](opentelemetry::sdk::common::ExportResult result, - std::unique_ptr &&, - const proto::collector::metrics::v1::ExportMetricsServiceRequest &request, - proto::collector::metrics::v1::ExportMetricsServiceResponse *) { + // Capture the metrics_service_stub_ to ensure it is not destroyed before the callback is + // called. + [metrics_service_stub = metrics_service_stub_]( + opentelemetry::sdk::common::ExportResult result, + std::unique_ptr &&, + const proto::collector::metrics::v1::ExportMetricsServiceRequest &request, + proto::collector::metrics::v1::ExportMetricsServiceResponse *) { if (result != opentelemetry::sdk::common::ExportResult::kSuccess) { OTEL_INTERNAL_LOG_ERROR("[OTLP METRIC GRPC Exporter] ERROR: Export " @@ -131,22 +177,27 @@ opentelemetry::sdk::common::ExportResult OtlpGrpcMetricExporter::Export( bool OtlpGrpcMetricExporter::ForceFlush( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { -#ifdef ENABLE_ASYNC_EXPORT - return client_->ForceFlush(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client = client_; + if (!client) + { + return true; + } + return client->ForceFlush(timeout); } bool OtlpGrpcMetricExporter::Shutdown( OPENTELEMETRY_MAYBE_UNUSED std::chrono::microseconds timeout) noexcept { is_shutdown_ = true; -#ifdef ENABLE_ASYNC_EXPORT - return client_->Shutdown(timeout); -#else - return true; -#endif + // Maybe already shutdown, we need to keep thread-safety here. + std::shared_ptr client; + client.swap(client_); + if (!client) + { + return true; + } + return client->Shutdown(*client_reference_guard_, timeout); } bool OtlpGrpcMetricExporter::isShutdown() const noexcept @@ -154,6 +205,11 @@ bool OtlpGrpcMetricExporter::isShutdown() const noexcept return is_shutdown_; } +const std::shared_ptr &OtlpGrpcMetricExporter::GetClient() const noexcept +{ + return client_; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc index c26035a8df1..244d2757220 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc @@ -28,6 +28,15 @@ OtlpGrpcMetricExporterFactory::Create(const OtlpGrpcMetricExporterOptions &optio return exporter; } +std::unique_ptr +OtlpGrpcMetricExporterFactory::Create(const OtlpGrpcMetricExporterOptions &options, + const std::shared_ptr &client) +{ + std::unique_ptr exporter( + new OtlpGrpcMetricExporter(options, client)); + return exporter; +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc index 876719fa1ed..c330ffae2f8 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc @@ -989,6 +989,7 @@ OtlpHttpClient::createSession( request->SetBody(body_vec); request->ReplaceHeader("Content-Type", content_type); request->ReplaceHeader("User-Agent", options_.user_agent); + request->EnableLogging(options_.console_debug); if (options_.compression == "gzip") { diff --git a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_metric_utils.cc b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_metric_utils.cc index 103135ad1d8..a7220e98324 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/src/otlp_metric_utils.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/src/otlp_metric_utils.cc @@ -356,6 +356,7 @@ sdk::metrics::AggregationTemporality OtlpMetricUtils::DeltaTemporalitySelector( case sdk::metrics::InstrumentType::kObservableCounter: case sdk::metrics::InstrumentType::kHistogram: case sdk::metrics::InstrumentType::kObservableGauge: + case sdk::metrics::InstrumentType::kGauge: return sdk::metrics::AggregationTemporality::kDelta; case sdk::metrics::InstrumentType::kUpDownCounter: case sdk::metrics::InstrumentType::kObservableUpDownCounter: @@ -381,6 +382,7 @@ sdk::metrics::AggregationTemporality OtlpMetricUtils::LowMemoryTemporalitySelect case sdk::metrics::InstrumentType::kHistogram: return sdk::metrics::AggregationTemporality::kDelta; case sdk::metrics::InstrumentType::kObservableCounter: + case sdk::metrics::InstrumentType::kGauge: case sdk::metrics::InstrumentType::kObservableGauge: case sdk::metrics::InstrumentType::kUpDownCounter: case sdk::metrics::InstrumentType::kObservableUpDownCounter: diff --git a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_exporter_factory_test.cc b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_exporter_factory_test.cc index c383cc85edd..a2fb62dab02 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_exporter_factory_test.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_exporter_factory_test.cc @@ -3,6 +3,7 @@ #include +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" @@ -14,6 +15,8 @@ # error "protobuf should not be included" #endif +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" + OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter { @@ -31,6 +34,25 @@ TEST(OtlpGrpcExporterFactoryTest, BuildTest) EXPECT_TRUE(exporter != nullptr); } +TEST(OtlpGrpcExporterFactoryTest, ShareClient) +{ + OtlpGrpcExporterOptions opts; + opts.endpoint = "localhost:45454"; + + std::shared_ptr client = OtlpGrpcClientFactory::Create(opts); + std::unique_ptr exporter1 = + OtlpGrpcExporterFactory::Create(opts, client); + + std::unique_ptr exporter2 = + OtlpGrpcExporterFactory::Create(opts, client); + + EXPECT_TRUE(exporter1 != nullptr); + EXPECT_TRUE(exporter2 != nullptr); + + EXPECT_TRUE(static_cast(exporter1.get())->GetClient().get() == client.get()); + EXPECT_TRUE(static_cast(exporter2.get())->GetClient().get() == client.get()); +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc index cb1d1849aac..0d0ab17d623 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc @@ -3,6 +3,7 @@ #include +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_options.h" @@ -14,6 +15,8 @@ # error "protobuf should not be included" #endif +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" + OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter { @@ -31,6 +34,27 @@ TEST(OtlpGrpcLogRecordExporterFactoryTest, BuildTest) EXPECT_TRUE(exporter != nullptr); } +TEST(OtlpGrpcLogRecordExporterFactoryTest, ShareClient) +{ + OtlpGrpcLogRecordExporterOptions opts; + opts.endpoint = "localhost:45454"; + + std::shared_ptr client = OtlpGrpcClientFactory::Create(opts); + std::unique_ptr exporter1 = + OtlpGrpcLogRecordExporterFactory::Create(opts, client); + + std::unique_ptr exporter2 = + OtlpGrpcLogRecordExporterFactory::Create(opts, client); + + EXPECT_TRUE(exporter1 != nullptr); + EXPECT_TRUE(exporter2 != nullptr); + + EXPECT_TRUE(static_cast(exporter1.get())->GetClient().get() == + client.get()); + EXPECT_TRUE(static_cast(exporter2.get())->GetClient().get() == + client.get()); +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc index 90827f576f8..a2604de0962 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc @@ -3,15 +3,21 @@ #include +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +// clang-format on #include "opentelemetry/proto/collector/logs/v1/logs_service_mock.grpc.pb.h" #include "opentelemetry/proto/collector/trace/v1/trace_service_mock.grpc.pb.h" +// clang-format off #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// clang-format on #include "opentelemetry/logs/provider.h" #include "opentelemetry/sdk/logs/batch_log_record_processor.h" @@ -188,6 +194,22 @@ class OtlpGrpcLogRecordExporterTestPeer : public ::testing::Test new OtlpGrpcExporter(std::move(stub_interface))); } + std::unique_ptr GetExporter( + std::unique_ptr &stub_interface, + const std::shared_ptr &client) + { + return std::unique_ptr( + new OtlpGrpcLogRecordExporter(std::move(stub_interface), std::move(client))); + } + + std::unique_ptr GetExporter( + std::unique_ptr &stub_interface, + const std::shared_ptr &client) + { + return std::unique_ptr( + new OtlpGrpcExporter(std::move(stub_interface), std::move(client))); + } + // Get the options associated with the given exporter. const OtlpGrpcLogRecordExporterOptions &GetOptions( std::unique_ptr &exporter) @@ -334,6 +356,116 @@ TEST_F(OtlpGrpcLogRecordExporterTestPeer, ExportIntegrationTest) trace_provider = opentelemetry::nostd::shared_ptr(); } +// Create spans, let processor call Export() and share client object between trace and logs +TEST_F(OtlpGrpcLogRecordExporterTestPeer, ShareClientTest) +{ + std::shared_ptr shared_client = + OtlpGrpcClientFactory::Create(OtlpGrpcLogRecordExporterOptions()); + + auto mock_stub = new OtlpMockLogsServiceStub(); + std::unique_ptr stub_interface(mock_stub); + + auto exporter = GetExporter(stub_interface, shared_client); + + bool attribute_storage_bool_value[] = {true, false, true}; + int32_t attribute_storage_int32_value[] = {1, 2}; + uint32_t attribute_storage_uint32_value[] = {3, 4}; + int64_t attribute_storage_int64_value[] = {5, 6}; + uint64_t attribute_storage_uint64_value[] = {7, 8}; + double attribute_storage_double_value[] = {3.2, 3.3}; + opentelemetry::nostd::string_view attribute_storage_string_value[] = {"vector", "string"}; + + auto provider = nostd::shared_ptr(new sdk::logs::LoggerProvider()); + provider->AddProcessor( + std::unique_ptr(new sdk::logs::BatchLogRecordProcessor( + std::move(exporter), 5, std::chrono::milliseconds(256), 1))); + + EXPECT_CALL(*mock_stub, Export(_, _, _)) + .Times(Exactly(1)) + .WillRepeatedly(Return(grpc::Status::OK)); + + uint8_t trace_id_bin[opentelemetry::trace::TraceId::kSize] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + opentelemetry::trace::TraceId trace_id{trace_id_bin}; + uint8_t span_id_bin[opentelemetry::trace::SpanId::kSize] = {'7', '6', '5', '4', + '3', '2', '1', '0'}; + opentelemetry::trace::SpanId span_id{span_id_bin}; + + auto trace_mock_stub = new OtlpMockTraceServiceStub(); + std::unique_ptr trace_stub_interface( + trace_mock_stub); + + auto trace_provider = opentelemetry::nostd::shared_ptr( + opentelemetry::sdk::trace::TracerProviderFactory::Create( + opentelemetry::sdk::trace::SimpleSpanProcessorFactory::Create( + GetExporter(trace_stub_interface, shared_client)))); + + // Trace and Logs should both receive datas when links static gRPC on ELF ABI. + EXPECT_CALL(*trace_mock_stub, Export(_, _, _)) + .Times(AtLeast(2)) + .WillRepeatedly(Return(grpc::Status::OK)); + + { + const std::string schema_url{"https://opentelemetry.io/schemas/1.11.0"}; + + auto tracer = trace_provider->GetTracer("opentelelemtry_library", "", schema_url); + auto copy_trace_provider = trace_provider; + opentelemetry::trace::Provider::SetTracerProvider(std::move(copy_trace_provider)); + auto trace_span = tracer->StartSpan("test_log"); + opentelemetry::trace::Scope trace_scope{trace_span}; + + auto logger = provider->GetLogger("test", "opentelelemtry_library", "", schema_url, + {{"scope_key1", "scope_value"}, {"scope_key2", 2}}); + std::unordered_map attributes; + attributes["service.name"] = "unit_test_service"; + attributes["tenant.id"] = "test_user"; + attributes["bool_value"] = true; + attributes["int32_value"] = static_cast(1); + attributes["uint32_value"] = static_cast(2); + attributes["int64_value"] = static_cast(0x1100000000LL); + attributes["uint64_value"] = static_cast(0x1200000000ULL); + attributes["double_value"] = static_cast(3.1); + attributes["vec_bool_value"] = attribute_storage_bool_value; + attributes["vec_int32_value"] = attribute_storage_int32_value; + attributes["vec_uint32_value"] = attribute_storage_uint32_value; + attributes["vec_int64_value"] = attribute_storage_int64_value; + attributes["vec_uint64_value"] = attribute_storage_uint64_value; + attributes["vec_double_value"] = attribute_storage_double_value; + attributes["vec_string_value"] = attribute_storage_string_value; + logger->EmitLogRecord(opentelemetry::logs::Severity::kInfo, "Log message", attributes, + trace_span->GetContext(), std::chrono::system_clock::now()); + } + + // Shudown logs, but tracer still works + provider->Shutdown(); + EXPECT_FALSE(shared_client->IsShutdown()); + + { + const std::string schema_url{"https://opentelemetry.io/schemas/1.11.0"}; + + auto tracer = trace_provider->GetTracer("opentelelemtry_library", "", schema_url); + auto trace_span = tracer->StartSpan("test_log"); + opentelemetry::trace::Scope trace_scope{trace_span}; + + auto logger = provider->GetLogger("test", "opentelelemtry_library", "", schema_url, + {{"scope_key1", "scope_value"}, {"scope_key2", 2}}); + std::unordered_map attributes; + attributes["service.name"] = "unit_test_service"; + attributes["tenant.id"] = "test_user"; + logger->EmitLogRecord(opentelemetry::logs::Severity::kInfo, "Log message", attributes, + trace_span->GetContext(), std::chrono::system_clock::now()); + } + + // All references are released, client should also be shutdown + trace_provider->Shutdown(); + EXPECT_TRUE(shared_client->IsShutdown()); + + opentelemetry::trace::Provider::SetTracerProvider( + opentelemetry::nostd::shared_ptr( + new opentelemetry::trace::NoopTracerProvider())); + trace_provider = opentelemetry::nostd::shared_ptr(); +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc index b1d473e8dad..ecad49bee19 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc +++ b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc @@ -3,6 +3,7 @@ #include +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" @@ -14,6 +15,8 @@ # error "protobuf should not be included" #endif +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" + OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter { @@ -31,6 +34,27 @@ TEST(OtlpGrpcMetricExporterFactory, BuildTest) EXPECT_TRUE(exporter != nullptr); } +TEST(OtlpGrpcMetricExporterFactory, ShareClient) +{ + OtlpGrpcMetricExporterOptions opts; + opts.endpoint = "localhost:45454"; + + std::shared_ptr client = OtlpGrpcClientFactory::Create(opts); + std::unique_ptr exporter1 = + OtlpGrpcMetricExporterFactory::Create(opts, client); + + std::unique_ptr exporter2 = + OtlpGrpcMetricExporterFactory::Create(opts, client); + + EXPECT_TRUE(exporter1 != nullptr); + EXPECT_TRUE(exporter2 != nullptr); + + EXPECT_TRUE(static_cast(exporter1.get())->GetClient().get() == + client.get()); + EXPECT_TRUE(static_cast(exporter2.get())->GetClient().get() == + client.get()); +} + } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_log_recordable_test.cc b/deps/opentelemetry-cpp/exporters/otlp/test/otlp_log_recordable_test.cc index bcecbb8d8f7..e5d6701e46c 100644 --- a/deps/opentelemetry-cpp/exporters/otlp/test/otlp_log_recordable_test.cc +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_options.h b/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_options.h index 5d8b4932fc2..da9d124029e 100644 --- a/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_options.h +++ b/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_options.h @@ -28,6 +28,12 @@ struct PrometheusExporterOptions // Populating otel_scope_name/otel_scope_labels attributes bool without_otel_scope = false; + + // Option to export metrics without the unit suffix + bool without_units = false; + + // Option to export metrics without the type suffix + bool without_type_suffix = false; }; } // namespace metrics diff --git a/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h b/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h index ccf3d03ff37..29c0f66daf9 100644 --- a/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h +++ b/deps/opentelemetry-cpp/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h @@ -30,12 +30,18 @@ class PrometheusExporterUtils * @param populate_target_info whether to populate target_info * @param without_otel_scope whether to populate otel_scope_name and otel_scope_version * attributes + * @param without_units exporter configuration controlling whether to append unit suffix in + * the exported metrics. + * @param without_type_suffix exporter configuration controlling whether to append type suffix in + * the exported metrics. * @return a collection of translated metrics that is acceptable by Prometheus */ static std::vector<::prometheus::MetricFamily> TranslateToPrometheus( const sdk::metrics::ResourceMetrics &data, bool populate_target_info = true, - bool without_otel_scope = false); + bool without_otel_scope = false, + bool without_units = false, + bool without_type_suffix = false); private: /** @@ -61,7 +67,9 @@ class PrometheusExporterUtils static std::string MapToPrometheusName(const std::string &name, const std::string &unit, - ::prometheus::MetricType prometheus_type); + ::prometheus::MetricType prometheus_type, + bool without_units, + bool without_type_suffix); /** * A utility function that returns the equivalent Prometheus name for the provided OTLP metric diff --git a/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_options.cc b/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_options.cc index f2c49f7a579..a9de8f4eb4d 100644 --- a/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_options.cc +++ b/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_options.cc @@ -48,10 +48,33 @@ inline bool GetPrometheusPopulateTargetInfo() return exists ? setting : true; } +inline bool GetPrometheusWithoutUnits() +{ + constexpr char kPrometheusWithoutUnits[] = "OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_UNITS"; + bool setting; + const auto exists = + opentelemetry::sdk::common::GetBoolEnvironmentVariable(kPrometheusWithoutUnits, setting); + + return exists ? setting : false; +} + +inline bool GetPrometheusWithoutTypeSuffix() +{ + constexpr char kPrometheusWithoutTypeSuffix[] = + "OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_TYPE_SUFFIX"; + bool setting; + const auto exists = + opentelemetry::sdk::common::GetBoolEnvironmentVariable(kPrometheusWithoutTypeSuffix, setting); + + return exists ? setting : false; +} + PrometheusExporterOptions::PrometheusExporterOptions() : url(GetPrometheusDefaultHttpEndpoint()), populate_target_info(GetPrometheusPopulateTargetInfo()), - without_otel_scope(GetPrometheusWithoutOtelScope()) + without_otel_scope(GetPrometheusWithoutOtelScope()), + without_units(GetPrometheusWithoutUnits()), + without_type_suffix(GetPrometheusWithoutTypeSuffix()) {} } // namespace metrics diff --git a/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_utils.cc b/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_utils.cc index 77fcd56ad27..f54b129ab81 100644 --- a/deps/opentelemetry-cpp/exporters/prometheus/src/exporter_utils.cc +++ b/deps/opentelemetry-cpp/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; @@ -102,13 +99,15 @@ std::string SanitizeLabel(std::string label_key) * Helper function to convert OpenTelemetry metrics data collection * to Prometheus metrics data collection * - * @param records a collection of metrics in OpenTelemetry + * @param data a collection of metrics in OpenTelemetry * @return a collection of translated metrics that is acceptable by Prometheus */ std::vector PrometheusExporterUtils::TranslateToPrometheus( const sdk::metrics::ResourceMetrics &data, bool populate_target_info, - bool without_otel_scope) + bool without_otel_scope, + bool without_units, + bool without_type_suffix) { // initialize output vector @@ -150,7 +149,8 @@ std::vector PrometheusExporterUtils::TranslateT } const prometheus_client::MetricType type = TranslateType(kind, is_monotonic); metric_family.name = MapToPrometheusName(metric_data.instrument_descriptor.name_, - metric_data.instrument_descriptor.unit_, type); + metric_data.instrument_descriptor.unit_, type, + without_units, without_type_suffix); metric_family.type = type; const opentelemetry::sdk::instrumentationscope::InstrumentationScope *scope = without_otel_scope ? nullptr : instrumentation_info.scope_; @@ -492,34 +492,43 @@ std::string PrometheusExporterUtils::CleanUpString(const std::string &str) std::string PrometheusExporterUtils::MapToPrometheusName( const std::string &name, const std::string &unit, - prometheus_client::MetricType prometheus_type) + prometheus_client::MetricType prometheus_type, + bool without_units, + bool without_type_suffix) { - auto sanitized_name = SanitizeNames(name); - std::string prometheus_equivalent_unit = GetEquivalentPrometheusUnit(unit); - - // Append prometheus unit if not null or empty. - if (!prometheus_equivalent_unit.empty() && - sanitized_name.find(prometheus_equivalent_unit) == std::string::npos) - { - sanitized_name += "_" + prometheus_equivalent_unit; - } - - // Special case - counter - if (prometheus_type == prometheus_client::MetricType::Counter) - { - auto t_pos = sanitized_name.rfind("_total"); - bool ends_with_total = t_pos == sanitized_name.size() - 6; - if (!ends_with_total) + auto sanitized_name = SanitizeNames(name); + // append unit suffixes + if (!without_units) + { + std::string prometheus_equivalent_unit = GetEquivalentPrometheusUnit(unit); + // Append prometheus unit if not null or empty. + if (!prometheus_equivalent_unit.empty() && + sanitized_name.find(prometheus_equivalent_unit) == std::string::npos) + { + sanitized_name += "_" + prometheus_equivalent_unit; + } + // Special case - gauge + if (unit == "1" && prometheus_type == prometheus_client::MetricType::Gauge && + sanitized_name.find("ratio") == std::string::npos) { - sanitized_name += "_total"; + // this is replacing the unit name + sanitized_name += "_ratio"; } } - // Special case - gauge - if (unit == "1" && prometheus_type == prometheus_client::MetricType::Gauge && - sanitized_name.find("ratio") == std::string::npos) + // append type suffixes + if (!without_type_suffix) { - sanitized_name += "_ratio"; + // Special case - counter + if (prometheus_type == prometheus_client::MetricType::Counter) + { + auto t_pos = sanitized_name.rfind("_total"); + bool ends_with_total = t_pos == sanitized_name.size() - 6; + if (!ends_with_total) + { + sanitized_name += "_total"; + } + } } return CleanUpString(SanitizeNames(sanitized_name)); diff --git a/deps/opentelemetry-cpp/exporters/prometheus/test/exporter_utils_test.cc b/deps/opentelemetry-cpp/exporters/prometheus/test/exporter_utils_test.cc index 7ad5eee1fd8..76ec869a6f6 100644 --- a/deps/opentelemetry-cpp/exporters/prometheus/test/exporter_utils_test.cc +++ b/deps/opentelemetry-cpp/exporters/prometheus/test/exporter_utils_test.cc @@ -54,9 +54,12 @@ class SanitizeNameTester } static std::string mapToPrometheusName(const std::string &name, const std::string &unit, - prometheus_client::MetricType prometheus_type) + prometheus_client::MetricType prometheus_type, + bool without_units = false, + bool without_type_suffix = false) { - return PrometheusExporterUtils::MapToPrometheusName(name, unit, prometheus_type); + return PrometheusExporterUtils::MapToPrometheusName(name, unit, prometheus_type, without_units, + without_type_suffix); } }; } // namespace metrics @@ -419,6 +422,93 @@ TEST(PrometheusExporterUtils, ConvertRateExpressedToPrometheusUnit) "_per_minute"); } +TEST(PromentheusExporterUtils, PrometheusNameMapping) +{ + // General test cases on unit expansions and name sanitization + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric___name", "g", prometheus::MetricType::Counter), + "sample_metric_name_grams_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "s", prometheus::MetricType::Counter), + "sample_metric_name_seconds_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "s", prometheus::MetricType::Gauge), + "sample_metric_name_seconds"); + // Test without_units & without_type_suffix with Counters and unit = 1 + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Counter), + "sample_metric_name_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Counter, true, false), + "sample_metric_name_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Counter, false, true), + "sample_metric_name"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Counter, true, true), + "sample_metric_name"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Counter, true, true), + "sample_metric_name"); + // Test without_units & without_type_suffix with Counters and non-special units + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "%", prometheus::MetricType::Counter), + "sample_metric_name_percent_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "m", prometheus::MetricType::Counter, true, false), + "sample_metric_name_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "By", prometheus::MetricType::Counter, false, true), + "sample_metric_name_bytes"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "s", prometheus::MetricType::Counter, true, true), + "sample_metric_name"); + // Special case Gauges & ratio + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Gauge), + "sample_metric_name_ratio"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Gauge, false, true), + "sample_metric_name_ratio"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Gauge, true, false), + "sample_metric_name"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "1", prometheus::MetricType::Gauge, true, true), + "sample_metric_name"); + // Test without_type_suffix affects only counters + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Counter), + "sample_metric_name_hertz_total"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Counter, false, true), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Gauge), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Gauge, false, true), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Histogram), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Histogram, false, true), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Summary), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Summary, false, true), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Info), + "sample_metric_name_hertz"); + ASSERT_EQ(exporter::metrics::SanitizeNameTester::mapToPrometheusName( + "sample_metric_name", "Hz", prometheus::MetricType::Info, false, true), + "sample_metric_name_hertz"); +} + TEST_F(AttributeCollisionTest, JoinsCollidingKeys) { CheckTranslation({{"foo.a", "value1"}, {"foo_a", "value2"}}, {{"foo_a", "value1;value2"}, diff --git a/deps/opentelemetry-cpp/exporters/zipkin/src/recordable.cc b/deps/opentelemetry-cpp/exporters/zipkin/src/recordable.cc index 69899e7fada..8b60faef711 100644 --- a/deps/opentelemetry-cpp/exporters/zipkin/src/recordable.cc +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h index 902981f3924..ef65388fe1f 100644 --- a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h +++ b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h @@ -102,6 +102,8 @@ class Request : public opentelemetry::ext::http::client::Request compression_ = compression; } + void EnableLogging(bool is_log_enabled) noexcept override { is_log_enabled_ = is_log_enabled; } + public: opentelemetry::ext::http::client::Method method_; opentelemetry::ext::http::client::HttpSslOptions ssl_options_; @@ -111,6 +113,7 @@ class Request : public opentelemetry::ext::http::client::Request std::chrono::milliseconds timeout_ms_{5000}; // ms opentelemetry::ext::http::client::Compression compression_{ opentelemetry::ext::http::client::Compression::kNone}; + bool is_log_enabled_{false}; }; class Response : public opentelemetry::ext::http::client::Response diff --git a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index b6654ce3ad4..b94c53b2d01 100644 --- a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -102,6 +102,12 @@ class HttpOperation static size_t ReadMemoryCallback(char *buffer, size_t size, size_t nitems, void *userp); + static int CurlLoggerCallback(const CURL * /* handle */, + curl_infotype type, + const char *data, + size_t size, + void * /* clientp */) noexcept; + #if LIBCURL_VERSION_NUM >= 0x075000 static int PreRequestCallback(void *clientp, char *conn_primary_ip, @@ -152,7 +158,8 @@ class HttpOperation // Default connectivity and response size options bool is_raw_response = false, std::chrono::milliseconds http_conn_timeout = default_http_conn_timeout, - bool reuse_connection = false); + bool reuse_connection = false, + bool is_log_enabled = false); /** * Destroy CURL instance @@ -300,6 +307,8 @@ class HttpOperation const opentelemetry::ext::http::client::Compression &compression_; + const bool is_log_enabled_; + // Processed response headers and body long response_code_; std::vector response_headers_; diff --git a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/http_client.h b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/http_client.h index d17215da9bb..e467f9ef63f 100644 --- a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/client/http_client.h @@ -245,6 +245,8 @@ class Request virtual void SetCompression(const Compression &compression) noexcept = 0; + virtual void EnableLogging(bool is_log_enabled) noexcept = 0; + virtual ~Request() = default; }; diff --git a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/common/url_parser.h b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/common/url_parser.h index 75f53ce9439..c5fe156aa6f 100644 --- a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/common/url_parser.h +++ b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/common/url_parser.h @@ -3,9 +3,11 @@ #pragma once -#include +#include #include +#include #include +#include #include "opentelemetry/version.h" @@ -33,7 +35,7 @@ class UrlParser std::string query_; bool success_; - UrlParser(std::string url) : url_(url), success_(true) + UrlParser(std::string url) : url_(std::move(url)), success_(true) { if (url_.length() == 0) { @@ -49,15 +51,15 @@ class UrlParser } else { - scheme_ = std::string(url_.begin() + cpos, url_.begin() + pos); + scheme_ = url_.substr(cpos, pos - cpos); cpos = pos + 3; } // credentials - size_t pos1 = url_.find_first_of("@", cpos); - size_t pos2 = url_.find_first_of("/", cpos); + size_t pos1 = url_.find_first_of('@', cpos); if (pos1 != std::string::npos) { + size_t pos2 = url_.find_first_of('/', cpos); // TODO - handle credentials if (pos2 == std::string::npos || pos1 < pos2) { @@ -71,15 +73,19 @@ class UrlParser { // port missing. Used default 80 / 443 if (scheme_ == "http") + { port_ = 80; - if (scheme_ == "https") + } + else if (scheme_ == "https") + { port_ = 443; + } } else { // port present is_port = true; - host_ = std::string(url_.begin() + cpos, url_.begin() + pos); + host_ = url_.substr(cpos, pos - cpos); cpos = pos + 1; } pos = url_.find_first_of("/?", cpos); @@ -88,23 +94,23 @@ class UrlParser path_ = std::string("/"); // use default path if (is_port) { - port_ = static_cast( - std::stoi(std::string(url_.begin() + cpos, url_.begin() + url_.length()))); + auto port_str = url_.substr(cpos); + port_ = GetPort(port_str); } else { - host_ = std::string(url_.begin() + cpos, url_.begin() + url_.length()); + host_ = url_.substr(cpos); } return; } if (is_port) { - port_ = - static_cast(std::stoi(std::string(url_.begin() + cpos, url_.begin() + pos))); + auto port_str = url_.substr(cpos, pos - cpos); + port_ = GetPort(port_str); } else { - host_ = std::string(url_.begin() + cpos, url_.begin() + pos); + host_ = url_.substr(cpos, pos - cpos); } cpos = pos; @@ -113,21 +119,20 @@ class UrlParser pos = url_.find('?', cpos); if (pos == std::string::npos) { - path_ = std::string(url_.begin() + cpos, url_.begin() + url_.length()); - query_ = ""; + path_ = url_.substr(cpos); } else { - path_ = std::string(url_.begin() + cpos, url_.begin() + pos); + path_ = url_.substr(cpos, pos - cpos); cpos = pos + 1; - query_ = std::string(url_.begin() + cpos, url_.begin() + url_.length()); + query_ = url_.substr(cpos); } return; } path_ = std::string("/"); if (url_[cpos] == '?') { - query_ = std::string(url_.begin() + cpos, url_.begin() + url_.length()); + query_ = url_.substr(cpos); } } @@ -164,6 +169,20 @@ class UrlParser return std::string::npos; } + + std::uint16_t GetPort(const std::string &s) + { + char *e = nullptr; + errno = 0; + auto port = std::strtol(s.c_str(), &e, 10); + if (e == s.c_str() || e != s.c_str() + s.size() || errno == ERANGE || port < 0 || port > 65535) + { + success_ = false; + return 0; + } + + return static_cast(port); + } }; class UrlDecoder @@ -174,36 +193,39 @@ class UrlDecoder std::string result; result.reserve(encoded.size()); + auto hex_to_int = [](int ch) -> int { + if (ch >= '0' && ch <= '9') + return ch - '0'; + if (ch >= 'a' && ch <= 'f') + return ch - 'a' + 10; + if (ch >= 'A' && ch <= 'F') + return ch - 'A' + 10; + return -1; + }; + for (size_t pos = 0; pos < encoded.size(); pos++) { - if (encoded[pos] == '%') + auto c = encoded[pos]; + if (c == '%') { - - // Invalid input: less than two characters left after '%' - if (encoded.size() < pos + 3) + if (pos + 2 >= encoded.size()) { return encoded; } - char hex[3] = {0}; - hex[0] = encoded[++pos]; - hex[1] = encoded[++pos]; - - char *endptr; - long value = strtol(hex, &endptr, 16); + int hi = hex_to_int(encoded[pos + 1]); + int lo = hex_to_int(encoded[pos + 2]); - // Invalid input: no valid hex characters after '%' - if (endptr != &hex[2]) + if (hi == -1 || lo == -1) { return encoded; } - result.push_back(static_cast(value)); - } - else - { - result.push_back(encoded[pos]); + c = static_cast((hi << 4) | lo); + pos += 2; } + + result.push_back(c); } return result; diff --git a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/server/http_server.h b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/server/http_server.h index 5ea7debc43a..21efac94e0a 100644 --- a/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/server/http_server.h +++ b/deps/opentelemetry-cpp/ext/include/opentelemetry/ext/http/server/http_server.h @@ -648,7 +648,15 @@ class HttpServer : private SocketTools::Reactor::SocketCallback { ptr++; } - conn.request.headers[name] = std::string(begin, ptr); + if (!conn.request.headers[name].empty()) + { + conn.request.headers[name] = + conn.request.headers[name].append(",").append(std::string(begin, ptr)); + } + else + { + conn.request.headers[name] = std::string(begin, ptr); + } if (*ptr == '\r') { ptr++; diff --git a/deps/opentelemetry-cpp/ext/src/http/client/curl/CMakeLists.txt b/deps/opentelemetry-cpp/ext/src/http/client/curl/CMakeLists.txt index 6a69c7de51d..c812fcefbf9 100644 --- a/deps/opentelemetry-cpp/ext/src/http/client/curl/CMakeLists.txt +++ b/deps/opentelemetry-cpp/ext/src/http/client/curl/CMakeLists.txt @@ -24,6 +24,11 @@ else() PRIVATE ${CURL_LIBRARIES}) endif() +if(WITH_CURL_LOGGING) + target_compile_definitions(opentelemetry_http_client_curl + PRIVATE ENABLE_CURL_LOGGING) +endif() + if(WITH_OTLP_HTTP_COMPRESSION) if(TARGET ZLIB::ZLIB) target_link_libraries( diff --git a/deps/opentelemetry-cpp/ext/src/http/client/curl/http_client_curl.cc b/deps/opentelemetry-cpp/ext/src/http/client/curl/http_client_curl.cc index 22f20fb0e08..6827b9f9c74 100644 --- a/deps/opentelemetry-cpp/ext/src/http/client/curl/http_client_curl.cc +++ b/deps/opentelemetry-cpp/ext/src/http/client/curl/http_client_curl.cc @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include "opentelemetry/version.h" #ifdef ENABLE_OTLP_COMPRESSION_PREVIEW +# include # include #else # include "opentelemetry/sdk/common/global_log_handler.h" @@ -116,10 +116,10 @@ void Session::SendRequest( #endif } - curl_operation_.reset(new HttpOperation(http_request_->method_, url, http_request_->ssl_options_, - callback_ptr, http_request_->headers_, - http_request_->body_, http_request_->compression_, false, - http_request_->timeout_ms_, reuse_connection)); + curl_operation_.reset(new HttpOperation( + http_request_->method_, url, http_request_->ssl_options_, callback_ptr, + http_request_->headers_, http_request_->body_, http_request_->compression_, false, + http_request_->timeout_ms_, reuse_connection, http_request_->is_log_enabled_)); bool success = CURLE_OK == curl_operation_->SendAsync(this, [this, callback](HttpOperation &operation) { if (operation.WasAborted()) diff --git a/deps/opentelemetry-cpp/ext/src/http/client/curl/http_operation_curl.cc b/deps/opentelemetry-cpp/ext/src/http/client/curl/http_operation_curl.cc index 4de014fd821..b80624d0697 100644 --- a/deps/opentelemetry-cpp/ext/src/http/client/curl/http_operation_curl.cc +++ b/deps/opentelemetry-cpp/ext/src/http/client/curl/http_operation_curl.cc @@ -22,6 +22,7 @@ #include "opentelemetry/ext/http/client/curl/http_client_curl.h" #include "opentelemetry/ext/http/client/curl/http_operation_curl.h" #include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/version.h" @@ -261,7 +262,8 @@ HttpOperation::HttpOperation(opentelemetry::ext::http::client::Method method, // Default connectivity and response size options bool is_raw_response, std::chrono::milliseconds http_conn_timeout, - bool reuse_connection) + bool reuse_connection, + bool is_log_enabled) : is_aborted_(false), is_finished_(false), is_cleaned_(false), @@ -281,6 +283,7 @@ HttpOperation::HttpOperation(opentelemetry::ext::http::client::Method method, request_nwrite_(0), session_state_(opentelemetry::ext::http::client::SessionState::Created), compression_(compression), + is_log_enabled_(is_log_enabled), response_code_(0) { /* get a curl handle */ @@ -569,8 +572,77 @@ CURLcode HttpOperation::SetCurlOffOption(CURLoption option, curl_off_t value) return rc; } +int HttpOperation::CurlLoggerCallback(const CURL * /* handle */, + curl_infotype type, + const char *data, + size_t size, + void * /* clientp */) noexcept +{ + nostd::string_view text_to_log{data, size}; + + if (!text_to_log.empty() && text_to_log[size - 1] == '\n') + { + text_to_log = text_to_log.substr(0, size - 1); + } + + if (type == CURLINFO_TEXT) + { + static const auto kTlsInfo = nostd::string_view("SSL connection using"); + static const auto kFailureMsg = nostd::string_view("Recv failure:"); + + if (text_to_log.substr(0, kTlsInfo.size()) == kTlsInfo) + { + OTEL_INTERNAL_LOG_INFO(text_to_log); + } + else if (text_to_log.substr(0, kFailureMsg.size()) == kFailureMsg) + { + OTEL_INTERNAL_LOG_ERROR(text_to_log); + } +// This guard serves as a catch-all block for all other less interesting output that should +// remain available for maintainer internal use and for debugging purposes only. +#ifdef OTEL_CURL_DEBUG + else + { + OTEL_INTERNAL_LOG_DEBUG(text_to_log); + } +#endif // OTEL_CURL_DEBUG + } +// Same as above, this guard is meant only for internal use by maintainers, and should not be used +// in production (information leak). +#ifdef OTEL_CURL_DEBUG + else if (type == CURLINFO_HEADER_OUT) + { + static const auto kHeaderSent = nostd::string_view("Send header => "); + + while (!text_to_log.empty() && !std::iscntrl(text_to_log[0])) + { + const auto pos = text_to_log.find('\n'); + + if (pos != nostd::string_view::npos) + { + OTEL_INTERNAL_LOG_DEBUG(kHeaderSent << text_to_log.substr(0, pos - 1)); + text_to_log = text_to_log.substr(pos + 1); + } + } + } + else if (type == CURLINFO_HEADER_IN) + { + static const auto kHeaderRecv = nostd::string_view("Recv header => "); + OTEL_INTERNAL_LOG_DEBUG(kHeaderRecv << text_to_log); + } +#endif // OTEL_CURL_DEBUG + + return 0; +} + CURLcode HttpOperation::Setup() { +#ifdef ENABLE_CURL_LOGGING + static constexpr auto kEnableCurlLogging = true; +#else + static constexpr auto kEnableCurlLogging = false; +#endif // ENABLE_CURL_LOGGING + if (!curl_resource_.easy_handle) { return CURLE_FAILED_INIT; @@ -581,11 +653,28 @@ CURLcode HttpOperation::Setup() curl_error_message_[0] = '\0'; curl_easy_setopt(curl_resource_.easy_handle, CURLOPT_ERRORBUFFER, curl_error_message_); +// Support for custom debug function callback was added in version 7.9.6 so we guard against +// exposing the default CURL output by keeping verbosity always disabled in lower versions. +#if LIBCURL_VERSION_NUM < CURL_VERSION_BITS(7, 9, 6) rc = SetCurlLongOption(CURLOPT_VERBOSE, 0L); if (rc != CURLE_OK) { return rc; } +#else + rc = SetCurlLongOption(CURLOPT_VERBOSE, (is_log_enabled_ && kEnableCurlLogging) ? 1L : 0L); + if (rc != CURLE_OK) + { + return rc; + } + + rc = SetCurlPtrOption(CURLOPT_DEBUGFUNCTION, + reinterpret_cast(&HttpOperation::CurlLoggerCallback)); + if (rc != CURLE_OK) + { + return rc; + } +#endif // Specify target URL rc = SetCurlStrOption(CURLOPT_URL, url_.c_str()); diff --git a/deps/opentelemetry-cpp/ext/test/CMakeLists.txt b/deps/opentelemetry-cpp/ext/test/CMakeLists.txt index cc3d4cd1e16..4dabab38218 100644 --- a/deps/opentelemetry-cpp/ext/test/CMakeLists.txt +++ b/deps/opentelemetry-cpp/ext/test/CMakeLists.txt @@ -3,5 +3,5 @@ add_subdirectory(http) if(BUILD_W3CTRACECONTEXT_TEST) - add_subdirectory(w3c_tracecontext_test) + add_subdirectory(w3c_tracecontext_http_test_server) endif() diff --git a/deps/opentelemetry-cpp/ext/test/http/CMakeLists.txt b/deps/opentelemetry-cpp/ext/test/http/CMakeLists.txt index 328f78638b5..9f5514d07bf 100644 --- a/deps/opentelemetry-cpp/ext/test/http/CMakeLists.txt +++ b/deps/opentelemetry-cpp/ext/test/http/CMakeLists.txt @@ -5,7 +5,7 @@ if(WITH_HTTP_CLIENT_CURL) set(FILENAME curl_http_test) add_compile_definitions(WITH_CURL) add_executable(${FILENAME} ${FILENAME}.cc) - target_link_libraries(${FILENAME} ${GTEST_BOTH_LIBRARIES} + target_link_libraries(${FILENAME} ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) if(TARGET CURL::libcurl) @@ -24,8 +24,8 @@ endif() set(URL_PARSER_FILENAME url_parser_test) add_executable(${URL_PARSER_FILENAME} ${URL_PARSER_FILENAME}.cc) -target_link_libraries(${URL_PARSER_FILENAME} ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api) +target_link_libraries(${URL_PARSER_FILENAME} opentelemetry_api ${GMOCK_LIB} + ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) gtest_add_tests( TARGET ${URL_PARSER_FILENAME} TEST_PREFIX ext.http.urlparser. diff --git a/deps/opentelemetry-cpp/ext/test/http/url_parser_test.cc b/deps/opentelemetry-cpp/ext/test/http/url_parser_test.cc index aceb43966af..680e73670fc 100644 --- a/deps/opentelemetry-cpp/ext/test/http/url_parser_test.cc +++ b/deps/opentelemetry-cpp/ext/test/http/url_parser_test.cc @@ -2,212 +2,136 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include #include -#include +#include #include "opentelemetry/ext/http/common/url_parser.h" namespace http_common = opentelemetry::ext::http::common; -inline const char *BoolToString(bool b) +struct ParsedUrl { - return b ? "true" : "false"; -} + std::string scheme; + std::string host; + std::uint16_t port; + std::string path; + std::string query; + bool success; -TEST(UrlParserTests, BasicTests) -{ - std::map> urls_map{ - {"www.abc.com", - {{"host", "www.abc.com"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/"}, - {"query", ""}, - {"success", "true"}}}, - {"http://www.abc.com", - {{"host", "www.abc.com"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com", - {{"host", "www.abc.com"}, - {"port", "443"}, - {"scheme", "https"}, - {"path", "/"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com:4431", - {{"host", "www.abc.com"}, - {"port", "4431"}, - {"scheme", "https"}, - {"path", "/"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com:4431", - {{"host", "www.abc.com"}, - {"port", "4431"}, - {"scheme", "https"}, - {"path", "/"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com:4431/path1", - {{"host", "www.abc.com"}, - {"port", "4431"}, - {"scheme", "https"}, - {"path", "/path1"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com:4431/path1/path2", - {{"host", "www.abc.com"}, - {"port", "4431"}, - {"scheme", "https"}, - {"path", "/path1/path2"}, - {"query", ""}, - {"success", "true"}}}, - {"https://www.abc.com/path1/path2", - {{"host", "www.abc.com"}, - {"port", "443"}, - {"scheme", "https"}, - {"path", "/path1/path2"}, - {"query", ""}, - {"success", "true"}}}, - {"http://www.abc.com/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://www.abc.com:8080/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"www.abc.com:8080/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://user:password@www.abc.com:8080/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"user:password@www.abc.com:8080/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"https://user@www.abc.com/path1/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "443"}, - {"scheme", "https"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://www.abc.com/path1@bbb/path2?q1=a1&q2=a2", - {{"host", "www.abc.com"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1@bbb/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://1.2.3.4/path1/path2?q1=a1&q2=a2", - {{"host", "1.2.3.4"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"user:password@1.2.3.4:8080/path1/path2?q1=a1&q2=a2", - {{"host", "1.2.3.4"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"https://user@1.2.3.4/path1/path2?q1=a1&q2=a2", - {{"host", "1.2.3.4"}, - {"port", "443"}, - {"scheme", "https"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://1.2.3.4/path1@bbb/path2?q1=a1&q2=a2", - {{"host", "1.2.3.4"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1@bbb/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://[fe80::225:93da:bfde:b5f5]/path1/path2?q1=a1&q2=a2", - {{"host", "[fe80::225:93da:bfde:b5f5]"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"user:password@[fe80::225:93da:bfde:b5f5]:8080/path1/path2?q1=a1&q2=a2", - {{"host", "[fe80::225:93da:bfde:b5f5]"}, - {"port", "8080"}, - {"scheme", "http"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"https://user@[fe80::225:93da:bfde:b5f5]/path1/path2?q1=a1&q2=a2", - {{"host", "[fe80::225:93da:bfde:b5f5]"}, - {"port", "443"}, - {"scheme", "https"}, - {"path", "/path1/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - {"http://[fe80::225:93da:bfde:b5f5]/path1@bbb/path2?q1=a1&q2=a2", - {{"host", "[fe80::225:93da:bfde:b5f5]"}, - {"port", "80"}, - {"scheme", "http"}, - {"path", "/path1@bbb/path2"}, - {"query", "q1=a1&q2=a2"}, - {"success", "true"}}}, - }; - for (auto &url_map : urls_map) + friend void PrintTo(const ParsedUrl &p, std::ostream *os) { - http_common::UrlParser url(url_map.first); - auto url_properties = url_map.second; - ASSERT_EQ(BoolToString(url.success_), url_properties["success"]); - ASSERT_EQ(url.host_, url_properties["host"]); - ASSERT_EQ(std::to_string(url.port_), url_properties["port"]); - ASSERT_EQ(url.scheme_, url_properties["scheme"]); - ASSERT_EQ(url.path_, url_properties["path"]); - ASSERT_EQ(url.query_, url_properties["query"]); + *os << "(valid: " << (p.success ? "yes" : "no") << ", scheme: " << p.scheme + << ", host: " << p.host << ", port: " << p.port << ", path: " << p.path + << ", query: " << p.query << ")"; } +}; + +class UrlParserTests : public testing::TestWithParam> +{}; + +INSTANTIATE_TEST_SUITE_P( + SampleValues, + UrlParserTests, + testing::Values( + std::make_tuple("www.abc.com", ParsedUrl{"http", "www.abc.com", 80, "/", "", true}), + std::make_tuple("http://www.abc.com", ParsedUrl{"http", "www.abc.com", 80, "/", "", true}), + std::make_tuple("https://www.abc.com", + ParsedUrl{"https", "www.abc.com", 443, "/", "", true}), + std::make_tuple("https://www.abc.com:4431", + ParsedUrl{"https", "www.abc.com", 4431, "/", "", true}), + std::make_tuple("https://www.abc.com:4431/path1", + ParsedUrl{"https", "www.abc.com", 4431, "/path1", "", true}), + std::make_tuple("https://www.abc.com:4431/path1/path2", + ParsedUrl{"https", "www.abc.com", 4431, "/path1/path2", "", true}), + std::make_tuple("https://www.abc.com/path1/path2", + ParsedUrl{"https", "www.abc.com", 443, "/path1/path2", "", true}), + std::make_tuple("http://www.abc.com/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 80, "/path1/path2", "q1=a1&q2=a2", true}), + std::make_tuple("http://www.abc.com:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 8080, "/path1/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("www.abc.com:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 8080, "/path1/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("http://user:password@www.abc.com:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 8080, "/path1/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("user:password@www.abc.com:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 8080, "/path1/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("https://user@www.abc.com/path1/path2?q1=a1&q2=a2", + ParsedUrl{"https", "www.abc.com", 443, "/path1/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("http://www.abc.com/path1@bbb/path2?q1=a1&q2=a2", + ParsedUrl{"http", "www.abc.com", 80, "/path1@bbb/path2", "q1=a1&q2=a2", + true}), + std::make_tuple("http://1.2.3.4/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "1.2.3.4", 80, "/path1/path2", "q1=a1&q2=a2", true}), + std::make_tuple("user:password@1.2.3.4:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "1.2.3.4", 8080, "/path1/path2", "q1=a1&q2=a2", true}), + std::make_tuple("https://user@1.2.3.4/path1/path2?q1=a1&q2=a2", + ParsedUrl{"https", "1.2.3.4", 443, "/path1/path2", "q1=a1&q2=a2", true}), + std::make_tuple("http://1.2.3.4/path1@bbb/path2?q1=a1&q2=a2", + ParsedUrl{"http", "1.2.3.4", 80, "/path1@bbb/path2", "q1=a1&q2=a2", true}), + std::make_tuple("http://[fe80::225:93da:bfde:b5f5]/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "[fe80::225:93da:bfde:b5f5]", 80, "/path1/path2", + "q1=a1&q2=a2", true}), + std::make_tuple("user:password@[fe80::225:93da:bfde:b5f5]:8080/path1/path2?q1=a1&q2=a2", + ParsedUrl{"http", "[fe80::225:93da:bfde:b5f5]", 8080, "/path1/path2", + "q1=a1&q2=a2", true}), + std::make_tuple("https://user@[fe80::225:93da:bfde:b5f5]/path1/path2?q1=a1&q2=a2", + ParsedUrl{"https", "[fe80::225:93da:bfde:b5f5]", 443, "/path1/path2", + "q1=a1&q2=a2", true}), + std::make_tuple("http://[fe80::225:93da:bfde:b5f5]/path1@bbb/path2?q1=a1&q2=a2", + ParsedUrl{"http", "[fe80::225:93da:bfde:b5f5]", 80, "/path1@bbb/path2", + "q1=a1&q2=a2", true}), + std::make_tuple("https://https://example.com/some/path", + ParsedUrl{"https", "https", 0, "//example.com/some/path", "", false}), + std::make_tuple("https://example.com:-1/some/path", + ParsedUrl{"https", "example.com", 0, "/some/path", "", false}), + std::make_tuple("https://example.com:65536/some/path", + ParsedUrl{"https", "example.com", 0, "/some/path", "", false}), + std::make_tuple("https://example.com:80a/some/path", + ParsedUrl{"https", "example.com", 0, "/some/path", "", false}), + std::make_tuple("https://example.com:18446744073709551616/some/path", + ParsedUrl{"https", "example.com", 0, "/some/path", "", false}))); + +TEST_P(UrlParserTests, BasicTests) +{ + const auto &url = std::get<0>(GetParam()); + const auto &expected = std::get<1>(GetParam()); + + const auto actual = http_common::UrlParser(url); + + EXPECT_EQ(actual.success_, expected.success); + EXPECT_EQ(actual.host_, expected.host); + EXPECT_EQ(actual.port_, expected.port); + EXPECT_EQ(actual.scheme_, expected.scheme); + EXPECT_EQ(actual.path_, expected.path); + EXPECT_EQ(actual.query_, expected.query); } -TEST(UrlDecoderTests, BasicTests) +class UrlDecoderTests : public ::testing::TestWithParam> +{}; + +INSTANTIATE_TEST_SUITE_P( + SampleValues, + UrlDecoderTests, + testing::Values(std::make_tuple("Authentication=Basic xxx", "Authentication=Basic xxx"), + std::make_tuple("Authentication=Basic%20xxx", "Authentication=Basic xxx"), + std::make_tuple("%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", + "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"), + std::make_tuple("%2x", "%2x"), + std::make_tuple("%20", " "), + std::make_tuple("text%2", "text%2"), + std::make_tuple("%20test%zztest", "%20test%zztest"), + std::make_tuple("%20test%2", "%20test%2"))); + +TEST_P(UrlDecoderTests, BasicTests) { - std::map testdata{ - {"Authentication=Basic xxx", "Authentication=Basic xxx"}, - {"Authentication=Basic%20xxx", "Authentication=Basic xxx"}, - {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", - "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"}, - {"%2x", "%2x"}, - {"%20", " "}, - {"text%2", "text%2"}, - }; + const auto &encoded = std::get<0>(GetParam()); + const auto &expected = std::get<1>(GetParam()); + const auto actual = http_common::UrlDecoder::Decode(encoded); - for (auto &testsample : testdata) - { - ASSERT_EQ(http_common::UrlDecoder::Decode(testsample.first), testsample.second); - ASSERT_TRUE(http_common::UrlDecoder::Decode(testsample.first) == testsample.second); - } + EXPECT_EQ(actual, expected); } diff --git a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/BUILD b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/BUILD similarity index 92% rename from deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/BUILD rename to deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/BUILD index c67ab11a9cf..8c1c8c17e97 100644 --- a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/BUILD +++ b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/BUILD @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 cc_binary( - name = "w3c_tracecontext_test", + name = "w3c_tracecontext_http_test_server", srcs = [ "main.cc", ], diff --git a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/CMakeLists.txt b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt similarity index 66% rename from deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/CMakeLists.txt rename to deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt index cc2ae43b1cb..85e3c3eea0c 100644 --- a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/CMakeLists.txt +++ b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt @@ -3,12 +3,13 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) -add_executable(w3c_tracecontext_test main.cc) +add_executable(w3c_tracecontext_http_test_server main.cc) target_link_libraries( - w3c_tracecontext_test + w3c_tracecontext_http_test_server PRIVATE ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace opentelemetry_http_client_curl opentelemetry_exporter_ostream_span ${CURL_LIBRARIES} nlohmann_json::nlohmann_json) if(nlohmann_json_clone) - add_dependencies(w3c_tracecontext_test nlohmann_json::nlohmann_json) + add_dependencies(w3c_tracecontext_http_test_server + nlohmann_json::nlohmann_json) endif() diff --git a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/Dockerfile b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/Dockerfile similarity index 100% rename from deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/Dockerfile rename to deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/Dockerfile diff --git a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/README.md b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/README.md similarity index 80% rename from deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/README.md rename to deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/README.md index 8eda092f825..afe2a68638a 100644 --- a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/README.md +++ b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/README.md @@ -3,7 +3,7 @@ This test application is intended to be used as a test service for the [W3C Distributed Tracing Validation Service](https://github.com/w3c/trace-context/tree/master/test). It is -implemented according to [this +implemented according to [these instructions](https://github.com/w3c/trace-context/tree/master/test#implement-test-service). ## Usage @@ -11,7 +11,7 @@ instructions](https://github.com/w3c/trace-context/tree/master/test#implement-te 1: Build and start the test service endpoint: ```sh -./w3c_tracecontext_test +./w3c_tracecontext_http_test_server Listening to http://localhost:30000/test ``` @@ -19,7 +19,7 @@ Listening to http://localhost:30000/test A custom port number for the test service to listen to can be specified: ```sh -./w3c_tracecontext_test 31339 +./w3c_tracecontext_http_test_server 31339 Listening to http://localhost:31339/test ``` @@ -47,4 +47,9 @@ docker run --network host w3c_driver http://localhost:31339/test 3: The validation service will run the test suite and print detailed test results. -4: Stop the test service by pressing enter. +4: Stop the test service by invoking `/stop`. Make sure to use the correct port number. + +```sh +# Assuming the service is currently running at port 30000 +curl http://localhost:30000/stop +``` diff --git a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/main.cc b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/main.cc similarity index 86% rename from deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/main.cc rename to deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/main.cc index fed07a23985..5af8c141de9 100644 --- a/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_test/main.cc +++ b/deps/opentelemetry-cpp/ext/test/w3c_tracecontext_http_test_server/main.cc @@ -3,8 +3,6 @@ #include #include -#include -#include #include #include #include @@ -12,19 +10,16 @@ #include #include -#include "opentelemetry/context/context_value.h" #include "opentelemetry/context/propagation/text_map_propagator.h" #include "opentelemetry/context/runtime_context.h" #include "opentelemetry/exporters/ostream/span_exporter.h" #include "opentelemetry/ext/http/client/curl/http_client_curl.h" -#include "opentelemetry/ext/http/client/curl/http_operation_curl.h" #include "opentelemetry/ext/http/client/http_client.h" #include "opentelemetry/ext/http/server/http_server.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/trace/exporter.h" #include "opentelemetry/sdk/trace/processor.h" -#include "opentelemetry/sdk/trace/recordable.h" #include "opentelemetry/sdk/trace/simple_processor.h" #include "opentelemetry/sdk/trace/tracer_context.h" #include "opentelemetry/sdk/trace/tracer_provider.h" @@ -45,16 +40,34 @@ namespace { static trace_api::propagation::HttpTraceContext propagator_format; +static bool equalsIgnoreCase(const std::string &str1, const std::string &str2) +{ + if (str1.length() != str2.length()) + { + return false; + } + for (size_t i = 0; i < str1.length(); i++) + { + if (tolower(str1[i]) != tolower(str2[i])) + { + return false; + } + } + return true; +} + class TextMapCarrierTest : public context::propagation::TextMapCarrier { public: TextMapCarrierTest(std::map &headers) : headers_(headers) {} nostd::string_view Get(nostd::string_view key) const noexcept override { - auto it = headers_.find(std::string(key)); - if (it != headers_.end()) + for (const auto &elem : headers_) { - return nostd::string_view(it->second); + if (equalsIgnoreCase(elem.first, std::string(key))) + { + return nostd::string_view(elem.second); + } } return ""; } @@ -85,7 +98,7 @@ void initTracer() nostd::shared_ptr get_tracer() { auto provider = trace_api::Provider::GetTracerProvider(); - return provider->GetTracer("w3c_tracecontext_test"); + return provider->GetTracer("w3c_tracecontext_http_test_server"); } struct Uri @@ -161,6 +174,7 @@ int main(int argc, char *argv[]) constexpr char default_host[] = "localhost"; constexpr uint16_t default_port = 30000; uint16_t port; + std::atomic_bool stop_server(false); // The port the validation service listens to can be specified via the command line. if (argc > 1) @@ -207,16 +221,28 @@ int main(int argc, char *argv[]) return 0; }}; + testing::HttpRequestCallback stop_cb{ + [&](testing::HttpRequest const & /*req*/, testing::HttpResponse &resp) { + std::cout << "Received request to stop server \n"; + stop_server.store(true); + resp.code = 200; + return 0; + }}; + server["/test"] = test_cb; + server["/stop"] = stop_cb; // Start server server.start(); std::cout << "Listening at http://" << default_host << ":" << port << "/test\n"; - // Wait for console input - std::cin.get(); - - // Stop server + // Wait for signal to stop server + while (!stop_server.load()) + { + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + // received signal to stop server + std::cout << "Stopping server \n"; server.stop(); } diff --git a/deps/opentelemetry-cpp/otlp-http-exporter.gyp b/deps/opentelemetry-cpp/otlp-http-exporter.gyp index 44783a73378..3449bd43d8a 100644 --- a/deps/opentelemetry-cpp/otlp-http-exporter.gyp +++ b/deps/opentelemetry-cpp/otlp-http-exporter.gyp @@ -6,6 +6,7 @@ 'sources': [ 'exporters/otlp/src/otlp_environment.cc', 'exporters/otlp/src/otlp_grpc_client.cc', + 'exporters/otlp/src/otlp_grpc_client_factory.cc', 'exporters/otlp/src/otlp_grpc_exporter_options.cc', 'exporters/otlp/src/otlp_grpc_exporter.cc', 'exporters/otlp/src/otlp_grpc_log_record_exporter.cc', diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/common/empty_attributes.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/common/empty_attributes.h index 0afe439ee62..4a699e7d32b 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/common/empty_attributes.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/common/empty_attributes.h @@ -21,12 +21,12 @@ namespace sdk * with default attributes. */ static const opentelemetry::common::KeyValueIterableView< - std::array, 0>> & + std::array, 0>> & GetEmptyAttributes() noexcept { - static const std::array, 0> array{}; + static const std::array, 0> array{}; static const opentelemetry::common::KeyValueIterableView< - std::array, 0>> + std::array, 0>> kEmptyAttributes(array); return kEmptyAttributes; diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h index 1d14c0760e5..91fc503ff06 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h @@ -180,6 +180,7 @@ class DefaultAggregation return AggregationType::kSum; case InstrumentType::kHistogram: return AggregationType::kHistogram; + case InstrumentType::kGauge: case InstrumentType::kObservableGauge: return AggregationType::kLastValue; case InstrumentType::kSummary: diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/instruments.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/instruments.h index eb9fc30a5a4..0d6b5e253d2 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/instruments.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/instruments.h @@ -22,6 +22,7 @@ enum class InstrumentType kObservableCounter, kObservableGauge, kObservableUpDownCounter, + kGauge, kSummary }; diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/meter.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/meter.h index b29bede0124..2e9153e1511 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/meter.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/meter.h @@ -75,6 +75,18 @@ class Meter final : public opentelemetry::metrics::Meter nostd::string_view description = "", nostd::string_view unit = "") noexcept override; +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + nostd::unique_ptr> CreateInt64Gauge( + nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept override; + + nostd::unique_ptr> CreateDoubleGauge( + nostd::string_view name, + nostd::string_view description = "", + nostd::string_view unit = "") noexcept override; +#endif + nostd::shared_ptr CreateInt64ObservableGauge( nostd::string_view name, nostd::string_view description = "", diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h index 039a37e7485..ff5eaeb2829 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h @@ -100,6 +100,40 @@ class DoubleUpDownCounter : public Synchronous, public opentelemetry::metrics::U void Add(double value, const opentelemetry::context::Context &context) noexcept override; }; +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +class LongGauge : public Synchronous, public opentelemetry::metrics::Gauge +{ +public: + LongGauge(const InstrumentDescriptor &instrument_descriptor, + std::unique_ptr storage); + + void Record(int64_t value, + const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + void Record(int64_t value, + const opentelemetry::common::KeyValueIterable &attributes, + const opentelemetry::context::Context &context) noexcept override; + + void Record(int64_t value) noexcept override; + void Record(int64_t value, const opentelemetry::context::Context &context) noexcept override; +}; + +class DoubleGauge : public Synchronous, public opentelemetry::metrics::Gauge +{ +public: + DoubleGauge(const InstrumentDescriptor &instrument_descriptor, + std::unique_ptr storage); + + void Record(double value, + const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + void Record(double value, + const opentelemetry::common::KeyValueIterable &attributes, + const opentelemetry::context::Context &context) noexcept override; + + void Record(double value) noexcept override; + void Record(double value, const opentelemetry::context::Context &context) noexcept override; +}; +#endif + class LongHistogram : public Synchronous, public opentelemetry::metrics::Histogram { public: diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 9ff985be4de..1c11ba68f9d 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -4,9 +4,13 @@ */ /* - DO NOT EDIT, this is an Auto-generated file - from buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 -*/ + * This file is DEPRECATED, and no longer updated. + * See file DEPRECATED.md for details. + */ + +#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE +# error "header is deprecated." +#endif #pragma once diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/trace/span_data.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/trace/span_data.h index 2bd8b2112bb..96b8e5deee7 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/trace/span_data.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/trace/span_data.h @@ -257,7 +257,7 @@ class SpanData final : public Recordable opentelemetry::common::SystemTimestamp timestamp = opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now()), const opentelemetry::common::KeyValueIterable &attributes = - opentelemetry::common::KeyValueIterableView>( + opentelemetry::common::KeyValueIterableView>( {})) noexcept override { SpanDataEvent event(std::string(name), timestamp, attributes); diff --git a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/version/version.h b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/version/version.h index b8f4c076f17..387eb64fab6 100644 --- a/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/version/version.h +++ b/deps/opentelemetry-cpp/sdk/include/opentelemetry/sdk/version/version.h @@ -3,7 +3,7 @@ #pragma once -#define OPENTELEMETRY_SDK_VERSION "1.17.0" +#define OPENTELEMETRY_SDK_VERSION "1.18.0" #include "opentelemetry/version.h" diff --git a/deps/opentelemetry-cpp/sdk/src/common/CMakeLists.txt b/deps/opentelemetry-cpp/sdk/src/common/CMakeLists.txt index 664db38e17c..16229e08207 100644 --- a/deps/opentelemetry-cpp/sdk/src/common/CMakeLists.txt +++ b/deps/opentelemetry-cpp/sdk/src/common/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries( opentelemetry_common PUBLIC opentelemetry_api opentelemetry_sdk Threads::Threads) -if(WITH_ABSEIL) +if(WITH_ABSEIL OR WITH_OTLP_GRPC) target_link_libraries(opentelemetry_common PUBLIC absl::strings) endif() diff --git a/deps/opentelemetry-cpp/sdk/src/logs/BUILD b/deps/opentelemetry-cpp/sdk/src/logs/BUILD index f1a0828527c..93642e99b61 100644 --- a/deps/opentelemetry-cpp/sdk/src/logs/BUILD +++ b/deps/opentelemetry-cpp/sdk/src/logs/BUILD @@ -6,7 +6,6 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "logs", srcs = glob(["**/*.cc"]), - hdrs = glob(["**/*.h"]), include_prefix = "src/logs", deps = [ "//api", diff --git a/deps/opentelemetry-cpp/sdk/src/metrics/BUILD b/deps/opentelemetry-cpp/sdk/src/metrics/BUILD index ff8d244da19..78f224b5aba 100644 --- a/deps/opentelemetry-cpp/sdk/src/metrics/BUILD +++ b/deps/opentelemetry-cpp/sdk/src/metrics/BUILD @@ -6,7 +6,6 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "metrics", srcs = glob(["**/*.cc"]), - hdrs = glob(["**/*.h"]), include_prefix = "src/metrics", deps = [ "//api", diff --git a/deps/opentelemetry-cpp/sdk/src/metrics/meter.cc b/deps/opentelemetry-cpp/sdk/src/metrics/meter.cc index c61f3a8d316..6d09f264dba 100644 --- a/deps/opentelemetry-cpp/sdk/src/metrics/meter.cc +++ b/deps/opentelemetry-cpp/sdk/src/metrics/meter.cc @@ -186,6 +186,50 @@ opentelemetry::nostd::unique_ptr> Meter::CreateDouble new DoubleHistogram(instrument_descriptor, std::move(storage))}; } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +opentelemetry::nostd::unique_ptr> Meter::CreateInt64Gauge( + opentelemetry::nostd::string_view name, + opentelemetry::nostd::string_view description, + opentelemetry::nostd::string_view unit) noexcept +{ + if (!ValidateInstrument(name, description, unit)) + { + OTEL_INTERNAL_LOG_ERROR("Meter::CreateInt64Gauge - failed. Invalid parameters." + << name << " " << description << " " << unit + << ". Measurements won't be recorded."); + return opentelemetry::nostd::unique_ptr>( + new metrics::NoopGauge(name, description, unit)); + } + InstrumentDescriptor instrument_descriptor = { + std::string{name.data(), name.size()}, std::string{description.data(), description.size()}, + std::string{unit.data(), unit.size()}, InstrumentType::kGauge, InstrumentValueType::kLong}; + auto storage = RegisterSyncMetricStorage(instrument_descriptor); + return opentelemetry::nostd::unique_ptr>{ + new LongGauge(instrument_descriptor, std::move(storage))}; +} + +opentelemetry::nostd::unique_ptr> Meter::CreateDoubleGauge( + opentelemetry::nostd::string_view name, + opentelemetry::nostd::string_view description, + opentelemetry::nostd::string_view unit) noexcept +{ + if (!ValidateInstrument(name, description, unit)) + { + OTEL_INTERNAL_LOG_ERROR("Meter::CreateDoubleGauge - failed. Invalid parameters." + << name << " " << description << " " << unit + << ". Measurements won't be recorded."); + return opentelemetry::nostd::unique_ptr>( + new metrics::NoopGauge(name, description, unit)); + } + InstrumentDescriptor instrument_descriptor = { + std::string{name.data(), name.size()}, std::string{description.data(), description.size()}, + std::string{unit.data(), unit.size()}, InstrumentType::kGauge, InstrumentValueType::kDouble}; + auto storage = RegisterSyncMetricStorage(instrument_descriptor); + return opentelemetry::nostd::unique_ptr>{ + new DoubleGauge(instrument_descriptor, std::move(storage))}; +} +#endif + opentelemetry::nostd::shared_ptr Meter::CreateInt64ObservableGauge(opentelemetry::nostd::string_view name, opentelemetry::nostd::string_view description, diff --git a/deps/opentelemetry-cpp/sdk/src/metrics/state/metric_collector.cc b/deps/opentelemetry-cpp/sdk/src/metrics/state/metric_collector.cc index 2a799b7fda5..35d5e53939c 100644 --- a/deps/opentelemetry-cpp/sdk/src/metrics/state/metric_collector.cc +++ b/deps/opentelemetry-cpp/sdk/src/metrics/state/metric_collector.cc @@ -36,7 +36,18 @@ MetricCollector::MetricCollector(opentelemetry::sdk::metrics::MeterContext *cont AggregationTemporality MetricCollector::GetAggregationTemporality( InstrumentType instrument_type) noexcept { - return metric_reader_->GetAggregationTemporality(instrument_type); + auto aggregation_temporality = metric_reader_->GetAggregationTemporality(instrument_type); + if (aggregation_temporality == AggregationTemporality::kDelta && + instrument_type == InstrumentType::kGauge) + { + OTEL_INTERNAL_LOG_ERROR( + "[MetricCollector::GetAggregationTemporality] - Error getting aggregation temporality." + << "Delta temporality for Synchronous Gauge is currently not supported, using cumulative " + "temporality"); + + return AggregationTemporality::kCumulative; + } + return aggregation_temporality; } MetricProducer::Result MetricCollector::Produce() noexcept diff --git a/deps/opentelemetry-cpp/sdk/src/metrics/sync_instruments.cc b/deps/opentelemetry-cpp/sdk/src/metrics/sync_instruments.cc index 56429a079f9..de66e930547 100644 --- a/deps/opentelemetry-cpp/sdk/src/metrics/sync_instruments.cc +++ b/deps/opentelemetry-cpp/sdk/src/metrics/sync_instruments.cc @@ -292,6 +292,127 @@ void DoubleUpDownCounter::Add(double value, const opentelemetry::context::Contex return storage_->RecordDouble(value, context); } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +LongGauge::LongGauge(const InstrumentDescriptor &instrument_descriptor, + std::unique_ptr storage) + : Synchronous(instrument_descriptor, std::move(storage)) +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_ERROR("[LongGauge::LongGauge] - Error constructing LongGauge." + << "The metric storage is invalid for " << instrument_descriptor.name_); + } +} + +void LongGauge::Record(int64_t value, + const opentelemetry::common::KeyValueIterable &attributes) noexcept +{ + auto context = opentelemetry::context::Context{}; + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[LongGauge::Record(V,A)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordLong(value, attributes, context); +} + +void LongGauge::Record(int64_t value, + const opentelemetry::common::KeyValueIterable &attributes, + const opentelemetry::context::Context &context) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[LongGauge::Record(V,A,C)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordLong(value, attributes, context); +} + +void LongGauge::Record(int64_t value) noexcept +{ + auto context = opentelemetry::context::Context{}; + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[LongGauge::Record(V)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordLong(value, context); +} + +void LongGauge::Record(int64_t value, const opentelemetry::context::Context &context) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[LongGauge::Record(V,C)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordLong(value, context); +} + +DoubleGauge::DoubleGauge(const InstrumentDescriptor &instrument_descriptor, + std::unique_ptr storage) + : Synchronous(instrument_descriptor, std::move(storage)) +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_ERROR("[DoubleGauge::DoubleGauge] - Error constructing DoubleUpDownCounter." + << "The metric storage is invalid for " << instrument_descriptor.name_); + } +} + +void DoubleGauge::Record(double value, + const opentelemetry::common::KeyValueIterable &attributes) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[DoubleGauge::Record(V,A)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + } + auto context = opentelemetry::context::Context{}; + return storage_->RecordDouble(value, attributes, context); +} + +void DoubleGauge::Record(double value, + const opentelemetry::common::KeyValueIterable &attributes, + const opentelemetry::context::Context &context) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[DoubleGauge::Record(V,A,C)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordDouble(value, attributes, context); +} + +void DoubleGauge::Record(double value) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[DoubleGauge::Record(V)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + auto context = opentelemetry::context::Context{}; + return storage_->RecordDouble(value, context); +} + +void DoubleGauge::Record(double value, const opentelemetry::context::Context &context) noexcept +{ + if (!storage_) + { + OTEL_INTERNAL_LOG_WARN("[DoubleGauge::Record(V,C)] Value not recorded - invalid storage for: " + << instrument_descriptor_.name_); + return; + } + return storage_->RecordDouble(value, context); +} +#endif + LongHistogram::LongHistogram(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) diff --git a/deps/opentelemetry-cpp/sdk/src/resource/BUILD b/deps/opentelemetry-cpp/sdk/src/resource/BUILD index 6cff52723ad..88456299901 100644 --- a/deps/opentelemetry-cpp/sdk/src/resource/BUILD +++ b/deps/opentelemetry-cpp/sdk/src/resource/BUILD @@ -6,7 +6,6 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "resource", srcs = glob(["**/*.cc"]), - hdrs = glob(["**/*.h"]), include_prefix = "src/resource", deps = [ "//api", diff --git a/deps/opentelemetry-cpp/sdk/src/resource/resource.cc b/deps/opentelemetry-cpp/sdk/src/resource/resource.cc index 919624686d8..5ae5446e805 100644 --- a/deps/opentelemetry-cpp/sdk/src/resource/resource.cc +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/sdk/src/resource/resource_detector.cc b/deps/opentelemetry-cpp/sdk/src/resource/resource_detector.cc index b7c7c7e6147..cab8ce748ad 100644 --- a/deps/opentelemetry-cpp/sdk/src/resource/resource_detector.cc +++ b/deps/opentelemetry-cpp/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/deps/opentelemetry-cpp/sdk/src/version/version.cc b/deps/opentelemetry-cpp/sdk/src/version/version.cc index 97e7f15549f..078bafe2ea7 100644 --- a/deps/opentelemetry-cpp/sdk/src/version/version.cc +++ b/deps/opentelemetry-cpp/sdk/src/version/version.cc @@ -12,13 +12,13 @@ namespace sdk namespace version { const int major_version = 1; -const int minor_version = 17; +const int minor_version = 18; const int patch_version = 0; const char *pre_release = "NONE"; const char *build_metadata = "NONE"; -const char *short_version = "1.17.0"; -const char *full_version = "1.17.0-NONE-NONE"; -const char *build_date = "Mon Oct 7 08:55:12 PM UTC 2024"; +const char *short_version = "1.18.0"; +const char *full_version = "1.18.0-NONE-NONE"; +const char *build_date = "Mon Nov 25 08:46:03 PM UTC 2024"; } // namespace version } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/deps/opentelemetry-cpp/sdk/test/metrics/CMakeLists.txt b/deps/opentelemetry-cpp/sdk/test/metrics/CMakeLists.txt index ccc31de6898..9effa73a4cf 100644 --- a/deps/opentelemetry-cpp/sdk/test/metrics/CMakeLists.txt +++ b/deps/opentelemetry-cpp/sdk/test/metrics/CMakeLists.txt @@ -19,6 +19,7 @@ foreach( cardinality_limit_test histogram_test sync_metric_storage_counter_test + sync_metric_storage_gauge_test sync_metric_storage_histogram_test sync_metric_storage_up_down_counter_test async_metric_storage_test diff --git a/deps/opentelemetry-cpp/sdk/test/metrics/sync_instruments_test.cc b/deps/opentelemetry-cpp/sdk/test/metrics/sync_instruments_test.cc index fb59e1d0333..22a05988dce 100644 --- a/deps/opentelemetry-cpp/sdk/test/metrics/sync_instruments_test.cc +++ b/deps/opentelemetry-cpp/sdk/test/metrics/sync_instruments_test.cc @@ -112,6 +112,45 @@ TEST(SyncInstruments, DoubleUpDownCounter) counter.Add(10.10, opentelemetry::common::KeyValueIterableView({})); } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +TEST(SyncInstruments, LongGauge) +{ + InstrumentDescriptor instrument_descriptor = {"long_gauge", "description", "1", + InstrumentType::kGauge, InstrumentValueType::kLong}; + std::unique_ptr metric_storage(new SyncMultiMetricStorage()); + LongGauge gauge(instrument_descriptor, std::move(metric_storage)); + gauge.Record(10); + gauge.Record(10, opentelemetry::context::Context{}); + + gauge.Record(10, opentelemetry::common::KeyValueIterableView({{"abc", "123"}, {"xyz", "456"}}), + opentelemetry::context::Context{}); + gauge.Record(10, + opentelemetry::common::KeyValueIterableView({{"abc", "123"}, {"xyz", "456"}})); + gauge.Record(10, opentelemetry::common::KeyValueIterableView({}), + opentelemetry::context::Context{}); + gauge.Record(10, opentelemetry::common::KeyValueIterableView({})); +} + +TEST(SyncInstruments, DoubleGauge) +{ + InstrumentDescriptor instrument_descriptor = { + "double_gauge", "description", "1", InstrumentType::kGauge, InstrumentValueType::kDouble}; + std::unique_ptr metric_storage(new SyncMultiMetricStorage()); + DoubleGauge gauge(instrument_descriptor, std::move(metric_storage)); + gauge.Record(10.10); + gauge.Record(10.10, opentelemetry::context::Context{}); + + gauge.Record(10.10, + opentelemetry::common::KeyValueIterableView({{"abc", "123"}, {"xyz", "456"}}), + opentelemetry::context::Context{}); + gauge.Record(10.10, + opentelemetry::common::KeyValueIterableView({{"abc", "123"}, {"xyz", "456"}})); + gauge.Record(10.10, opentelemetry::common::KeyValueIterableView({}), + opentelemetry::context::Context{}); + gauge.Record(10.10, opentelemetry::common::KeyValueIterableView({})); +} +#endif + TEST(SyncInstruments, LongHistogram) { InstrumentDescriptor instrument_descriptor = { diff --git a/deps/opentelemetry-cpp/sdk/test/metrics/sync_metric_storage_gauge_test.cc b/deps/opentelemetry-cpp/sdk/test/metrics/sync_metric_storage_gauge_test.cc new file mode 100644 index 00000000000..f826755af36 --- /dev/null +++ b/deps/opentelemetry-cpp/sdk/test/metrics/sync_metric_storage_gauge_test.cc @@ -0,0 +1,189 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include "common.h" + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include +#include +#include + +using namespace opentelemetry::sdk::metrics; +using namespace opentelemetry::common; +namespace nostd = opentelemetry::nostd; + +class WritableMetricStorageTestFixture : public ::testing::TestWithParam +{}; + +TEST_P(WritableMetricStorageTestFixture, LongGaugeLastValueAggregation) +{ +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + AggregationTemporality temporality = GetParam(); + auto sdk_start_ts = std::chrono::system_clock::now(); + InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kGauge, + InstrumentValueType::kLong}; + std::map attributes_roomA = {{"Room.id", "Rack A"}}; + std::map attributes_roomB = {{"Room.id", "Rack B"}}; + + std::unique_ptr default_attributes_processor{ + new DefaultAttributesProcessor{}}; + opentelemetry::sdk::metrics::SyncMetricStorage storage( + instr_desc, AggregationType::kLastValue, default_attributes_processor.get(), +# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW + ExemplarFilterType::kAlwaysOff, ExemplarReservoir::GetNoExemplarReservoir(), +# endif + nullptr); + + int64_t bg_noise_level_1_roomA = 10; + int64_t bg_noise_level_1_roomB = 20; + + storage.RecordLong(bg_noise_level_1_roomA, + KeyValueIterableView>(attributes_roomA), + opentelemetry::context::Context{}); + storage.RecordLong(bg_noise_level_1_roomB, + KeyValueIterableView>(attributes_roomB), + opentelemetry::context::Context{}); + + int64_t bg_noise_level_2_roomA = 43; + int64_t bg_noise_level_2_roomB = 25; + + storage.RecordLong(bg_noise_level_2_roomA, + KeyValueIterableView>(attributes_roomA), + opentelemetry::context::Context{}); + storage.RecordLong(bg_noise_level_2_roomB, + KeyValueIterableView>(attributes_roomB), + opentelemetry::context::Context{}); + + std::shared_ptr collector(new MockCollectorHandle(temporality)); + std::vector> collectors; + collectors.push_back(collector); + + // Some computation here + auto collection_ts = std::chrono::system_clock::now(); + size_t count_attributes = 0; + storage.Collect( + collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData &metric_data) { + for (const auto &data_attr : metric_data.point_data_attr_) + { + auto lastvalue_data = opentelemetry::nostd::get(data_attr.point_data); + if (opentelemetry::nostd::get( + data_attr.attributes.find("Room.id")->second) == "Rack A") + { + if (temporality == AggregationTemporality::kCumulative) + { + EXPECT_EQ(opentelemetry::nostd::get(lastvalue_data.value_), + bg_noise_level_2_roomA); + } + count_attributes++; + } + else if (opentelemetry::nostd::get( + data_attr.attributes.find("Room.id")->second) == "Rack B") + { + if (temporality == AggregationTemporality::kCumulative) + { + EXPECT_EQ(opentelemetry::nostd::get(lastvalue_data.value_), + bg_noise_level_2_roomB); + } + count_attributes++; + } + } + return true; + }); + EXPECT_EQ(count_attributes, 2); // RackA and RackB +#else + EXPECT_TRUE(true); +#endif +} + +INSTANTIATE_TEST_SUITE_P(WritableMetricStorageTestLong, + WritableMetricStorageTestFixture, + ::testing::Values(AggregationTemporality::kCumulative)); + +TEST_P(WritableMetricStorageTestFixture, DoubleGaugeLastValueAggregation) +{ +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + AggregationTemporality temporality = GetParam(); + auto sdk_start_ts = std::chrono::system_clock::now(); + InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kGauge, + InstrumentValueType::kDouble}; + std::map attributes_roomA = {{"Room.id", "Rack A"}}; + std::map attributes_roomB = {{"Room.id", "Rack B"}}; + + std::unique_ptr default_attributes_processor{ + new DefaultAttributesProcessor{}}; + opentelemetry::sdk::metrics::SyncMetricStorage storage( + instr_desc, AggregationType::kLastValue, default_attributes_processor.get(), +# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW + ExemplarFilterType::kAlwaysOff, ExemplarReservoir::GetNoExemplarReservoir(), +# endif + nullptr); + + double bg_noise_level_1_roomA = 4.3; + double bg_noise_level_1_roomB = 2.5; + + storage.RecordDouble(bg_noise_level_1_roomA, + KeyValueIterableView>(attributes_roomA), + opentelemetry::context::Context{}); + storage.RecordDouble(bg_noise_level_1_roomB, + KeyValueIterableView>(attributes_roomB), + opentelemetry::context::Context{}); + + double bg_noise_level_2_roomA = 10.5; + double bg_noise_level_2_roomB = 20.5; + + storage.RecordDouble(bg_noise_level_2_roomA, + KeyValueIterableView>(attributes_roomA), + opentelemetry::context::Context{}); + storage.RecordDouble(bg_noise_level_2_roomB, + KeyValueIterableView>(attributes_roomB), + opentelemetry::context::Context{}); + + std::shared_ptr collector(new MockCollectorHandle(temporality)); + std::vector> collectors; + collectors.push_back(collector); + + // Some computation here + auto collection_ts = std::chrono::system_clock::now(); + size_t count_attributes = 0; + storage.Collect( + collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData &metric_data) { + for (const auto &data_attr : metric_data.point_data_attr_) + { + auto lastvalue_data = opentelemetry::nostd::get(data_attr.point_data); + if (opentelemetry::nostd::get( + data_attr.attributes.find("Room.id")->second) == "Rack A") + { + if (temporality == AggregationTemporality::kCumulative) + { + EXPECT_DOUBLE_EQ(opentelemetry::nostd::get(lastvalue_data.value_), + bg_noise_level_2_roomA); + } + count_attributes++; + } + else if (opentelemetry::nostd::get( + data_attr.attributes.find("Room.id")->second) == "Rack B") + { + if (temporality == AggregationTemporality::kCumulative) + { + EXPECT_DOUBLE_EQ(opentelemetry::nostd::get(lastvalue_data.value_), + bg_noise_level_2_roomB); + } + count_attributes++; + } + } + return true; + }); + EXPECT_EQ(count_attributes, 2); // RackA and RackB +#else + EXPECT_TRUE(true); +#endif +} + +INSTANTIATE_TEST_SUITE_P(WritableMetricStorageTestDouble, + WritableMetricStorageTestFixture, + ::testing::Values(AggregationTemporality::kCumulative)); diff --git a/deps/opentelemetry-cpp/sdk/test/resource/resource_test.cc b/deps/opentelemetry-cpp/sdk/test/resource/resource_test.cc index c15087e9b75..a359cb33d41 100644 --- a/deps/opentelemetry-cpp/sdk/test/resource/resource_test.cc +++ b/deps/opentelemetry-cpp/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); diff --git a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto similarity index 91% rename from deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto rename to deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto index d0e7894b29c..ab2433ed29d 100644 --- a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto +++ b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto @@ -14,15 +14,15 @@ syntax = "proto3"; -package opentelemetry.proto.collector.profiles.v1experimental; +package opentelemetry.proto.collector.profiles.v1development; -import "opentelemetry/proto/profiles/v1experimental/profiles.proto"; +import "opentelemetry/proto/profiles/v1development/profiles.proto"; -option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1Experimental"; +option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1Development"; option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.collector.profiles.v1experimental"; +option java_package = "io.opentelemetry.proto.collector.profiles.v1development"; option java_outer_classname = "ProfilesServiceProto"; -option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1experimental"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1development"; // Service that can be used to push profiles between one Application instrumented with // OpenTelemetry and a collector, or between a collector and a central collector. @@ -38,7 +38,7 @@ message ExportProfilesServiceRequest { // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. - repeated opentelemetry.proto.profiles.v1experimental.ResourceProfiles resource_profiles = 1; + repeated opentelemetry.proto.profiles.v1development.ResourceProfiles resource_profiles = 1; } message ExportProfilesServiceResponse { diff --git a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service_http.yaml b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service_http.yaml similarity index 63% rename from deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service_http.yaml rename to deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service_http.yaml index ea501afbbb2..6b3b91da07e 100644 --- a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service_http.yaml +++ b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/collector/profiles/v1development/profiles_service_http.yaml @@ -4,6 +4,6 @@ type: google.api.Service config_version: 3 http: rules: - - selector: opentelemetry.proto.collector.profiles.v1experimental.ProfilesService.Export - post: /v1experimental/profiles + - selector: opentelemetry.proto.collector.profiles.v1development.ProfilesService.Export + post: /v1development/profiles body: "*" diff --git a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto index 19bb7ff8d53..45e656735ad 100644 --- a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto +++ b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto @@ -29,6 +29,24 @@ option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1"; // storage, OR can be embedded by other protocols that transfer OTLP metrics // data but do not implement the OTLP protocol. // +// MetricsData +// └─── ResourceMetrics +// ├── Resource +// ├── SchemaURL +// └── ScopeMetrics +// ├── Scope +// ├── SchemaURL +// └── Metric +// ├── Name +// ├── Description +// ├── Unit +// └── data +// ├── Gauge +// ├── Sum +// ├── Histogram +// ├── ExponentialHistogram +// └── Summary +// // The main difference between this message and collector protocol is that // in this message there will not be any "control" or "metadata" specific to // OTLP protocol. @@ -85,7 +103,6 @@ message ScopeMetrics { // // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md // -// // The data model and relation between entities is shown in the // diagram below. Here, "DataPoint" is the term used to refer to any // one of the specific data point value types, and "points" is the term used @@ -97,7 +114,7 @@ message ScopeMetrics { // - DataPoint contains timestamps, attributes, and one of the possible value type // fields. // -// Metric +// Metric // +------------+ // |name | // |description | @@ -251,6 +268,9 @@ message ExponentialHistogram { // data type. These data points cannot always be merged in a meaningful way. // While they can be useful in some applications, histogram data points are // recommended for new applications. +// Summary metrics do not have an aggregation temporality field. This is +// because the count and sum fields of a SummaryDataPoint are assumed to be +// cumulative values. message Summary { repeated SummaryDataPoint data_points = 1; } @@ -589,7 +609,8 @@ message ExponentialHistogramDataPoint { } // SummaryDataPoint is a single data point in a timeseries that describes the -// time-varying values of a Summary metric. +// time-varying values of a Summary metric. The count and sum fields represent +// cumulative values. message SummaryDataPoint { reserved 1; diff --git a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1development/profiles.proto similarity index 56% rename from deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto rename to deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1development/profiles.proto index b5b5b88fcef..f1b31b68140 100644 --- a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto +++ b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1development/profiles.proto @@ -28,6 +28,124 @@ // See the License for the specific language governing permissions and // limitations under the License. +syntax = "proto3"; + +package opentelemetry.proto.profiles.v1development; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Development"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.profiles.v1development"; +option java_outer_classname = "ProfilesProto"; +option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1development"; + +// Relationships Diagram +// +// ┌──────────────────┐ LEGEND +// │ ProfilesData │ +// └──────────────────┘ ─────▶ embedded +// │ +// │ 1-n ─────▷ referenced by index +// ▼ +// ┌──────────────────┐ +// │ ResourceProfiles │ +// └──────────────────┘ +// │ +// │ 1-n +// ▼ +// ┌──────────────────┐ +// │ ScopeProfiles │ +// └──────────────────┘ +// │ +// │ 1-1 +// ▼ +// ┌──────────────────┐ +// │ Profile │ +// └──────────────────┘ +// │ n-1 +// │ 1-n ┌───────────────────────────────────────┐ +// ▼ │ ▽ +// ┌──────────────────┐ 1-n ┌──────────────┐ ┌──────────┐ +// │ Sample │ ──────▷ │ KeyValue │ │ Link │ +// └──────────────────┘ └──────────────┘ └──────────┘ +// │ 1-n △ △ +// │ 1-n ┌─────────────────┘ │ 1-n +// ▽ │ │ +// ┌──────────────────┐ n-1 ┌──────────────┐ +// │ Location │ ──────▷ │ Mapping │ +// └──────────────────┘ └──────────────┘ +// │ +// │ 1-n +// ▼ +// ┌──────────────────┐ +// │ Line │ +// └──────────────────┘ +// │ +// │ 1-1 +// ▽ +// ┌──────────────────┐ +// │ Function │ +// └──────────────────┘ +// + +// ProfilesData represents the profiles data that can be stored in persistent storage, +// OR can be embedded by other protocols that transfer OTLP profiles data but do not +// implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +message ProfilesData { + // An array of ResourceProfiles. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceProfiles resource_profiles = 1; +} + + +// A collection of ScopeProfiles from a Resource. +message ResourceProfiles { + reserved 1000; + + // The resource for the profiles in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of ScopeProfiles that originate from a resource. + repeated ScopeProfiles scope_profiles = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_profiles" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Profiles produced by an InstrumentationScope. +message ScopeProfiles { + // The instrumentation scope information for the profiles in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + + // A list of Profiles that originate from an instrumentation scope. + repeated Profile profiles = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the profile data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to all profiles in the "profiles" field. + string schema_url = 3; +} + // Profile is a common stacktrace profile format. // // Measurements represented with this format should follow the @@ -52,20 +170,15 @@ // mappings. For every nonzero Location.mapping_id there must be a // unique Mapping with that index. -syntax = "proto3"; - -package opentelemetry.proto.profiles.v1experimental; - -import "opentelemetry/proto/common/v1/common.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.profiles.v1experimental"; -option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental"; - // Represents a complete profile, including sample types, samples, // mappings to binaries, locations, functions, string table, and additional metadata. +// It modifies and annotates pprof Profile with OpenTelemetry specific fields. +// +// Note that whilst fields in this message retain the name and field id from pprof in most cases +// for ease of understanding data migration, it is not intended that pprof:Profile and +// OpenTelemetry:Profile encoding be wire compatible. message Profile { + // A description of the samples associated with each Sample.value. // For a cpu profile this might be: // [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]] @@ -79,58 +192,91 @@ message Profile { repeated Sample sample = 2; // Mapping from address ranges to the image/binary/library mapped // into that address range. mapping[0] will be the main binary. - repeated Mapping mapping = 3; + // If multiple binaries contribute to the Profile and no main + // binary can be identified, mapping[0] has no special meaning. + repeated Mapping mapping_table = 3; // Locations referenced by samples via location_indices. - repeated Location location = 4; + repeated Location location_table = 4; // Array of locations referenced by samples. - repeated int64 location_indices = 15; + repeated int32 location_indices = 5; // Functions referenced by locations. - repeated Function function = 5; + repeated Function function_table = 6; // Lookup table for attributes. - repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 16; + repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 7; // Represents a mapping between Attribute Keys and Units. - repeated AttributeUnit attribute_units = 17; + repeated AttributeUnit attribute_units = 8; // Lookup table for links. - repeated Link link_table = 18; + repeated Link link_table = 9; // A common table for strings referenced by various messages. // string_table[0] must always be "". - repeated string string_table = 6; - // frames with Function.function_name fully matching the following - // regexp will be dropped from the samples, along with their successors. - int64 drop_frames = 7; // Index into string table. - // frames with Function.function_name fully matching the following - // regexp will be kept, even if it matches drop_frames. - int64 keep_frames = 8; // Index into string table. - - // The following fields are informational, do not affect + repeated string string_table = 10; + + // The following fields 9-14 are informational, do not affect // interpretation of results. // Time of collection (UTC) represented as nanoseconds past the epoch. - int64 time_nanos = 9; + int64 time_nanos = 11; // Duration of the profile, if a duration makes sense. - int64 duration_nanos = 10; + int64 duration_nanos = 12; // The kind of events between sampled occurrences. // e.g [ "cpu","cycles" ] or [ "heap","bytes" ] - ValueType period_type = 11; + ValueType period_type = 13; // The number of events between sampled occurrences. - int64 period = 12; + int64 period = 14; // Free-form text associated with the profile. The text is displayed as is // to the user by the tools that read profiles (e.g. by pprof). This field // should not be used to store any machine-readable information, it is only // for human-friendly content. The profile must stay functional if this field // is cleaned. - repeated int64 comment = 13; // Indices into string table. + repeated int32 comment_strindices = 15; // Indices into string table. // Index into the string table of the type of the preferred sample // value. If unset, clients should default to the last sample value. - int64 default_sample_type = 14; + int32 default_sample_type_strindex = 16; + + + // A globally unique identifier for a profile. The ID is a 16-byte array. An ID with + // all zeroes is considered invalid. + // + // This field is required. + bytes profile_id = 17; + + // attributes is a collection of key/value pairs. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "abc.com/myattribute": true + // "abc.com/score": 10.239 + // + // The OpenTelemetry API specification further restricts the allowed value types: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 18; + + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + uint32 dropped_attributes_count = 19; + + // Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] + string original_payload_format = 20; + + // Original payload can be stored in this field. This can be useful for users who want to get the original payload. + // Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. + // Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. + // If the original payload is in pprof format, it SHOULD not be included in this field. + // The field is optional, however if it is present then equivalent converted data should be populated in other fields + // of this message as far as is practicable. + bytes original_payload = 21; } // Represents a mapping between Attribute Keys and Units. message AttributeUnit { // Index into string table. - int64 attribute_key = 1; + int32 attribute_key_strindex = 1; // Index into string table. - int64 unit = 2; + int32 unit_strindex = 2; } // A pointer from a profile Sample to a trace Span. @@ -214,8 +360,8 @@ enum AggregationTemporality { // ValueType describes the type and units of a value, with an optional aggregation temporality. message ValueType { - int64 type = 1; // Index into string table. - int64 unit = 2; // Index into string table. + int32 type_strindex = 1; // Index into string table. + int32 unit_strindex = 2; // Index into string table. AggregationTemporality aggregation_temporality = 3; } @@ -225,52 +371,36 @@ message ValueType { // augmented with auxiliary information like the thread-id, some // indicator of a higher level request being handled etc. message Sample { - // The indices recorded here correspond to locations in Profile.location. - // The leaf is at location_index[0]. [deprecated, superseded by locations_start_index / locations_length] - repeated uint64 location_index = 1; - // locations_start_index along with locations_length refers to to a slice of locations in Profile.location. + // locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices. + int32 locations_start_index = 1; + // locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices. // Supersedes location_index. - uint64 locations_start_index = 7; - // locations_length along with locations_start_index refers to a slice of locations in Profile.location. - // Supersedes location_index. - uint64 locations_length = 8; - // A 128bit id that uniquely identifies this stacktrace, globally. Index into string table. [optional] - uint32 stacktrace_id_index = 9; + int32 locations_length = 2; // The type and unit of each value is defined by the corresponding // entry in Profile.sample_type. All samples must have the same // number of values, the same as the length of Profile.sample_type. // When aggregating multiple samples into a single sample, the // result has a list of values that is the element-wise sum of the // lists of the originals. - repeated int64 value = 2; - // label includes additional context for this sample. It can include - // things like a thread id, allocation size, etc. - // - // NOTE: While possible, having multiple values for the same label key is - // strongly discouraged and should never be used. Most tools (e.g. pprof) do - // not have good (or any) support for multi-value labels. And an even more - // discouraged case is having a string label and a numeric label of the same - // name on a sample. Again, possible to express, but should not be used. - // [deprecated, superseded by attributes] - repeated Label label = 3; + repeated int64 value = 3; // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 10; + repeated int32 attribute_indices = 4; // Reference to link in Profile.link_table. [optional] - uint64 link = 12; + optional int32 link_index = 5; // Timestamps associated with Sample represented in nanoseconds. These timestamps are expected // to fall within the Profile's time range. [optional] - repeated uint64 timestamps_unix_nano = 13; + repeated uint64 timestamps_unix_nano = 6; } // Provides additional context for a sample, // such as thread ID or allocation size, with optional units. [deprecated] message Label { - int64 key = 1; // Index into string table + int32 key_strindex = 1; // Index into string table // At most one of the following must be present - int64 str = 2; // Index into string table + int32 str_strindex = 2; // Index into string table int64 num = 3; // Should only be present when num is present. @@ -280,65 +410,43 @@ message Label { // Consumers may also interpret units like "bytes" and "kilobytes" as memory // units and units like "seconds" and "nanoseconds" as time units, // and apply appropriate unit conversions to these. - int64 num_unit = 4; // Index into string table -} - -// Indicates the semantics of the build_id field. -enum BuildIdKind { - // Linker-generated build ID, stored in the ELF binary notes. - BUILD_ID_LINKER = 0; - // Build ID based on the content hash of the binary. Currently no particular - // hashing approach is standardized, so a given producer needs to define it - // themselves and thus unlike BUILD_ID_LINKER this kind of hash is producer-specific. - // We may choose to provide a standardized stable hash recommendation later. - BUILD_ID_BINARY_HASH = 1; + int32 num_unit_strindex = 4; // Index into string table } // Describes the mapping of a binary in memory, including its address range, // file offset, and metadata like build ID message Mapping { - // Unique nonzero id for the mapping. [deprecated] - uint64 id = 1; // Address at which the binary (or DLL) is loaded into memory. - uint64 memory_start = 2; + uint64 memory_start = 1; // The limit of the address range occupied by this mapping. - uint64 memory_limit = 3; + uint64 memory_limit = 2; // Offset in the binary that corresponds to the first mapped address. - uint64 file_offset = 4; + uint64 file_offset = 3; // The object this entry is loaded from. This can be a filename on // disk for the main binary and shared libraries, or virtual // abstractions like "[vdso]". - int64 filename = 5; // Index into string table - // A string that uniquely identifies a particular program version - // with high probability. E.g., for binaries generated by GNU tools, - // it could be the contents of the .note.gnu.build-id field. - int64 build_id = 6; // Index into string table - // Specifies the kind of build id. See BuildIdKind enum for more details [optional] - BuildIdKind build_id_kind = 11; + int32 filename_strindex = 4; // Index into string table // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 12; + repeated int32 attribute_indices = 5; // The following fields indicate the resolution of symbolic info. - bool has_functions = 7; - bool has_filenames = 8; - bool has_line_numbers = 9; - bool has_inline_frames = 10; + bool has_functions = 6; + bool has_filenames = 7; + bool has_line_numbers = 8; + bool has_inline_frames = 9; } // Describes function and line table debug information. message Location { - // Unique nonzero id for the location. A profile could use - // instruction addresses or any integer sequence as ids. [deprecated] - uint64 id = 1; - // The index of the corresponding profile.Mapping for this location. + // Reference to mapping in Profile.mapping_table. // It can be unset if the mapping is unknown or not applicable for // this profile type. - uint64 mapping_index = 2; + optional int32 mapping_index = 1; // The instruction address for this location, if available. It // should be within [Mapping.memory_start...Mapping.memory_limit] // for the corresponding mapping. A non-leaf address may be in the // middle of a call instruction. It is up to display tools to find // the beginning of the instruction if necessary. - uint64 address = 3; + uint64 address = 2; // Multiple line indicates this location has inlined functions, // where the last entry represents the caller into which the // preceding entries were inlined. @@ -346,25 +454,22 @@ message Location { // E.g., if memcpy() is inlined into printf: // line[0].function_name == "memcpy" // line[1].function_name == "printf" - repeated Line line = 4; + repeated Line line = 3; // Provides an indication that multiple symbols map to this location's // address, for example due to identical code folding by the linker. In that // case the line information above represents one of the multiple // symbols. This field must be recomputed when the symbolization state of the // profile changes. - bool is_folded = 5; - - // Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table. - uint32 type_index = 6; + bool is_folded = 4; // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 7; + repeated int32 attribute_indices = 5; } // Details a specific line in a source code, linked to a function. message Line { - // The index of the corresponding profile.Function for this line. - uint64 function_index = 1; + // Reference to function in Profile.function_table. + int32 function_index = 1; // Line number in source code. int64 line = 2; // Column number in source code. @@ -374,15 +479,13 @@ message Line { // Describes a function, including its human-readable name, system name, // source file, and starting line number in the source. message Function { - // Unique nonzero id for the function. [deprecated] - uint64 id = 1; // Name of the function, in human-readable form if available. - int64 name = 2; // Index into string table + int32 name_strindex = 1; // Index into string table // Name of the function, as identified by the system. // For instance, it can be a C++ mangled name. - int64 system_name = 3; // Index into string table + int32 system_name_strindex = 2; // Index into string table // Source file containing the function. - int64 filename = 4; // Index into string table + int32 filename_strindex = 3; // Index into string table // Line number in source file. - int64 start_line = 5; + int64 start_line = 4; } diff --git a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto b/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto deleted file mode 100644 index 84b0108f86a..00000000000 --- a/deps/opentelemetry-cpp/third_party/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2023, 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. - -syntax = "proto3"; - -package opentelemetry.proto.profiles.v1experimental; - -import "opentelemetry/proto/common/v1/common.proto"; -import "opentelemetry/proto/resource/v1/resource.proto"; -import "opentelemetry/proto/profiles/v1experimental/pprofextended.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.profiles.v1experimental"; -option java_outer_classname = "ProfilesProto"; -option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental"; - -// Relationships Diagram -// -// ┌──────────────────┐ LEGEND -// │ ProfilesData │ -// └──────────────────┘ ─────▶ embedded -// │ -// │ 1-n ─────▷ referenced by index -// ▼ -// ┌──────────────────┐ -// │ ResourceProfiles │ -// └──────────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ ScopeProfiles │ -// └──────────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ ProfileContainer │ -// └──────────────────┘ -// │ -// │ 1-1 -// ▼ -// ┌──────────────────┐ -// │ Profile │ -// └──────────────────┘ -// │ n-1 -// │ 1-n ┌───────────────────────────────────────┐ -// ▼ │ ▽ -// ┌──────────────────┐ 1-n ┌──────────────┐ ┌──────────┐ -// │ Sample │ ──────▷ │ KeyValue │ │ Link │ -// └──────────────────┘ └──────────────┘ └──────────┘ -// │ 1-n △ △ -// │ 1-n ┌─────────────────┘ │ 1-n -// ▽ │ │ -// ┌──────────────────┐ n-1 ┌──────────────┐ -// │ Location │ ──────▷ │ Mapping │ -// └──────────────────┘ └──────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ Line │ -// └──────────────────┘ -// │ -// │ 1-1 -// ▽ -// ┌──────────────────┐ -// │ Function │ -// └──────────────────┘ -// - -// ProfilesData represents the profiles data that can be stored in persistent storage, -// OR can be embedded by other protocols that transfer OTLP profiles data but do not -// implement the OTLP protocol. -// -// The main difference between this message and collector protocol is that -// in this message there will not be any "control" or "metadata" specific to -// OTLP protocol. -// -// When new fields are added into this message, the OTLP request MUST be updated -// as well. -message ProfilesData { - // An array of ResourceProfiles. - // For data coming from a single resource this array will typically contain - // one element. Intermediary nodes that receive data from multiple origins - // typically batch the data before forwarding further and in that case this - // array will contain multiple elements. - repeated ResourceProfiles resource_profiles = 1; -} - - -// A collection of ScopeProfiles from a Resource. -message ResourceProfiles { - reserved 1000; - - // The resource for the profiles in this message. - // If this field is not set then no resource info is known. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of ScopeProfiles that originate from a resource. - repeated ScopeProfiles scope_profiles = 2; - - // The Schema URL, if known. This is the identifier of the Schema that the resource data - // is recorded in. To learn more about Schema URL see - // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - // This schema_url applies to the data in the "resource" field. It does not apply - // to the data in the "scope_profiles" field which have their own schema_url field. - string schema_url = 3; -} - -// A collection of ProfileContainers produced by an InstrumentationScope. -message ScopeProfiles { - // The instrumentation scope information for the profiles in this message. - // Semantically when InstrumentationScope isn't set, it is equivalent with - // an empty instrumentation scope name (unknown). - opentelemetry.proto.common.v1.InstrumentationScope scope = 1; - - // A list of ProfileContainers that originate from an instrumentation scope. - repeated ProfileContainer profiles = 2; - - // The Schema URL, if known. This is the identifier of the Schema that the metric data - // is recorded in. To learn more about Schema URL see - // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - // This schema_url applies to all profiles in the "profiles" field. - string schema_url = 3; -} - -// A ProfileContainer represents a single profile. It wraps pprof profile with OpenTelemetry specific metadata. -message ProfileContainer { - // A globally unique identifier for a profile. The ID is a 16-byte array. An ID with - // all zeroes is considered invalid. - // - // This field is required. - bytes profile_id = 1; - - // start_time_unix_nano is the start time of the profile. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 start_time_unix_nano = 2; - - // end_time_unix_nano is the end time of the profile. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 end_time_unix_nano = 3; - - // attributes is a collection of key/value pairs. Note, global attributes - // like server name can be set using the resource API. Examples of attributes: - // - // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - // "/http/server_latency": 300 - // "abc.com/myattribute": true - // "abc.com/score": 10.239 - // - // The OpenTelemetry API specification further restricts the allowed value types: - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute - // Attribute keys MUST be unique (it is not allowed to have more than one - // attribute with the same key). - repeated opentelemetry.proto.common.v1.KeyValue attributes = 4; - - // dropped_attributes_count is the number of attributes that were discarded. Attributes - // can be discarded because their keys are too long or because there are too many - // attributes. If this value is 0, then no attributes were dropped. - uint32 dropped_attributes_count = 5; - - // Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] - string original_payload_format = 6; - - // Original payload can be stored in this field. This can be useful for users who want to get the original payload. - // Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. - // Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. - // If the original payload is in pprof format, it SHOULD not be included in this field. - // The field is optional, however if it is present `profile` MUST be present and contain the same profiling information. - bytes original_payload = 7; - - // This is a reference to a pprof profile. Required, even when original_payload is present. - opentelemetry.proto.profiles.v1experimental.Profile profile = 8; -} diff --git a/deps/opentelemetry-cpp/third_party_release b/deps/opentelemetry-cpp/third_party_release index 7362473f609..75646fa6c9b 100644 --- a/deps/opentelemetry-cpp/third_party_release +++ b/deps/opentelemetry-cpp/third_party_release @@ -19,7 +19,7 @@ benchmark=v1.8.3 googletest=1.14.0 ms-gsl=v3.1.0-67-g6f45293 nlohmann-json=v3.11.3 -opentelemetry-proto=v1.3.2 +opentelemetry-proto=v1.4.0 opentracing-cpp=v1.6.0 -prometheus-cpp=v1.2.4 +prometheus-cpp=v1.3.0 vcpkg=2024.02.14