diff --git a/.bazelrc b/.bazelrc index fc170b0e8b..57cd0a2fa0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,12 +4,12 @@ # bazel configurations for running tests under sanitizers. # Based on https://github.com/bazelment/trunk/blob/master/tools/bazel.rc -# TODO: Remove once support is added, avoid MODULE.bazel creation for now -common --enable_bzlmod=false - # 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/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..db61b810c9 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,42 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +Checks: > + -*, + performance-*, + portability-*, + abseil-*, + -abseil-string-find-str-contains, + bugprone-*, + -bugprone-easily-swappable-parameters, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, + -bugprone-narrowing-conversions, + -bugprone-unchecked-optional-access, + -bugprone-unhandled-exception-at-new, + -bugprone-unused-local-non-trivial-variable, + google-*, + -google-build-using-namespace, + -google-default-arguments, + -google-explicit-constructor, + -google-readability-avoid-underscore-in-googletest-name, + -google-readability-braces-around-statements, + -google-readability-namespace-comments, + -google-readability-todo, + -google-runtime-references, + misc-*, + -misc-const-correctness, + -misc-include-cleaner, + -misc-non-private-member-variables-in-classes, + -misc-unused-alias-decls, + -misc-use-anonymous-namespace, + cppcoreguidelines-*, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-avoid-do-while, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-pro-* \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c17bbece0..2cb354d5db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,36 +7,38 @@ on: branches: [ main ] jobs: - arm64_test: - name: CMake test arm64 (with modern protobuf,grpc and abseil) - runs-on: actuated-arm64-4cpu-16gb - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: setup - env: - PROTOBUF_VERSION: '23.3' - ABSEIL_CPP_VERSION: '20230125.3' - CXX_STANDARD: '14' - CC: /usr/bin/gcc-10 - CXX: /usr/bin/g++-10 - run: | - sudo -E ./ci/setup_gcc10.sh - sudo -E ./ci/setup_cmake.sh - sudo -E ./ci/setup_ci_environment.sh - sudo -E ./ci/setup_googletest.sh - sudo -E ./ci/install_abseil.sh - sudo -E ./ci/install_protobuf.sh - - name: run otlp exporter tests - env: - CC: /usr/bin/gcc-10 - CXX: /usr/bin/g++-10 - WITH_ABSEIL: 'ON' - CXX_STANDARD: '14' - run: | - sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp - ./ci/do_ci.sh cmake.exporter.otprotocol.test + +# Commented 2024-11-06, lack of workers in github causes CI failures +# arm64_test: +# name: CMake test arm64 (with modern protobuf,grpc and abseil) +# runs-on: actuated-arm64-4cpu-16gb +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: 'recursive' +# - name: setup +# env: +# PROTOBUF_VERSION: '23.3' +# ABSEIL_CPP_VERSION: '20230125.3' +# CXX_STANDARD: '14' +# CC: /usr/bin/gcc-10 +# CXX: /usr/bin/g++-10 +# run: | +# sudo -E ./ci/setup_gcc10.sh +# sudo -E ./ci/setup_cmake.sh +# sudo -E ./ci/setup_ci_environment.sh +# sudo -E ./ci/setup_googletest.sh +# sudo -E ./ci/install_abseil.sh +# sudo -E ./ci/install_protobuf.sh +# - name: run otlp exporter tests +# env: +# CC: /usr/bin/gcc-10 +# CXX: /usr/bin/g++-10 +# WITH_ABSEIL: 'ON' +# CXX_STANDARD: '14' +# run: | +# sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp +# ./ci/do_ci.sh cmake.exporter.otprotocol.test cmake_test: name: CMake test (without otlp-exporter) @@ -874,9 +876,9 @@ jobs: CXX: /usr/bin/g++-10 run: ./ci/do_ci.sh code.coverage - name: upload report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: - file: /home/runner/build/coverage.info + files: /home/runner/build/coverage.info markdown-lint: runs-on: ubuntu-latest @@ -923,3 +925,42 @@ jobs: - name: run ./ci/docfx.cmd shell: cmd run: ./ci/docfx.cmd + + w3c_trace_context_compliance_v1: + name: W3C Distributed Tracing Validation V1 + runs-on: ubuntu-latest + steps: + - name: Checkout open-telemetry/opentelemetry-cpp + uses: actions/checkout@v4 + with: + submodules: 'recursive' + - name: setup + env: + CC: /usr/bin/gcc-10 + CXX: /usr/bin/g++-10 + run: | + sudo -E ./ci/setup_googletest.sh + sudo -E ./ci/setup_ci_environment.sh + - name: run w3c trace-context test server (background) + env: + CXX_STANDARD: '14' + run: | + ./ci/do_ci.sh cmake.w3c.trace-context.build-server + cd $HOME/build/ext/test/w3c_tracecontext_http_test_server + ./w3c_tracecontext_http_test_server & + - name: Checkout w3c/trace-context repo + uses: actions/checkout@v4 + with: + repository: w3c/trace-context + path: trace-context + - name: install dependencies + run: | + sudo apt update && sudo apt install python3-pip + sudo pip3 install aiohttp + - name: run w3c trace-context test suite + env: + SPEC_LEVEL: 1 + run: + | + python ${GITHUB_WORKSPACE}/trace-context/test/test.py http://localhost:30000/test TraceContextTest AdvancedTest + curl http://localhost:30000/stop diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml new file mode 100644 index 0000000000..b467c56d44 --- /dev/null +++ b/.github/workflows/clang-tidy.yaml @@ -0,0 +1,81 @@ +name: clang-tidy + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + clang-tidy: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup Environment + env: + PROTOBUF_VERSION: '23.3' + ABSEIL_CPP_VERSION: '20230125.3' + CXX_STANDARD: '14' + run: | + sudo apt update -y + sudo apt install -y --no-install-recommends --no-install-suggests \ + build-essential \ + iwyu \ + cmake \ + libssl-dev \ + libcurl4-openssl-dev \ + libprotobuf-dev \ + protobuf-compiler \ + libgmock-dev \ + libgtest-dev \ + libbenchmark-dev + + if ! command -v clang-tidy &> /dev/null; then + echo "clang-tidy could not be found" + exit 1 + fi + echo "Using clang-tidy version: $(clang-tidy --version)" + echo "clang-tidy installed at: $(which clang-tidy)" + + + - name: Prepare CMake + env: + CC: clang + CXX: clang++ + run: | + echo "Running cmake..." + cmake -B build \ + -DCMAKE_CXX_STANDARD=14 \ + -DWITH_STL=CXX14 \ + -DWITH_OTLP_HTTP=ON \ + -DWITH_OTLP_FILE=ON \ + -DWITH_PROMETHEUS=ON \ + -DWITH_ZIPKIN=ON \ + -DWITH_ELASTICSEARCH=ON \ + -DWITH_OTLP_HTTP_COMPRESSION=ON \ + -DWITH_EXAMPLES=ON \ + -DWITH_EXAMPLES_HTTP=ON \ + -DBUILD_W3CTRACECONTEXT_TEST=ON \ + -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ + -DWITH_ASYNC_EXPORT_PREVIEW=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Run clang-tidy + run: | + cmake --build build --target opentelemetry_proto + jq -r .[].file build/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build 2>&1 | tee -a clang-tidy.log + + - uses: actions/upload-artifact@v4 + with: + name: Logs (clang-tidy) + path: ./clang-tidy.log + + - name: Count warnings + run: | + COUNT=$(grep -c "warning:" clang-tidy.log) + echo "clang-tidy reported ${COUNT} warning(s)" + +# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags. diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000000..a6581634bc --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,62 @@ + +name: cppcheck + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + cppcheck: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Set up dependencies + run: | + sudo apt update -y + sudo apt install -y cppcheck + + - name: Run cppcheck + run: | + cppcheck --version | tee cppcheck.log + cppcheck \ + --force \ + --enable=warning,performance,portability \ + --inline-suppr \ + --suppress=unknownMacro:exporters/etw/include/opentelemetry/exporters/etw/TraceLoggingDynamic.h \ + --language=c++ \ + --std=c++14 \ + -I api/include \ + -I exporters/elasticsearch/include \ + -I exporters/etw/include \ + -I exporters/memory/include \ + -I exporters/ostream/include \ + -I exporters/otlp/include \ + -I exporters/prometheus/include \ + -I exporters/zipkin/include \ + -I ext/include \ + -I opentracing-shim/include \ + -I sdk/include \ + -i build \ + -i test \ + -i third_party \ + -j $(nproc) \ + . 2>&1 | tee --append cppcheck.log + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Logs (cppcheck) + path: ./cppcheck.log + + - name: Count warnings + run: | + set +e + COUNT=`grep -c -E "\[.+\]" cppcheck.log` + echo "cppcheck reported ${COUNT} warning(s)" + # TODO: uncomment to enforce failing the build + # if [ $COUNT -ne 0 ] ; then exit 1 ; fi diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 598f57e97e..573af3a803 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -39,9 +39,8 @@ jobs: -DCMAKE_CXX_STANDARD=14 \ -DWITH_STL=CXX14 \ -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \ - -DBUILD_TESTING=OFF \ - -DWITH_DEPRECATED_SDK_FACTORY=OFF \ - -DBUILD_W3CTRACECONTEXT_TEST=OFF \ + -DBUILD_TESTING=ON \ + -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_OTLP_GRPC=OFF \ -DWITH_OTLP_HTTP=ON \ -DWITH_OTLP_FILE=ON \ @@ -63,7 +62,16 @@ jobs: - name: count warnings run: | + set +e cd build - COUNT=`grep -c "Warning:" iwyu.log` - echo "include-what-you-use reported ${COUNT} warning(s)" - + readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log` + echo "include-what-you-use reported ${WARNING_COUNT} warning(s)" + # Acceptable limit, to decrease over time down to 0 + readonly WARNING_LIMIT=10 + # FAIL the build if WARNING_COUNT > WARNING_LIMIT + if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then + exit 1 + # WARN in annotations if WARNING_COUNT > 0 + elif [ $WARNING_COUNT -gt 0 ] ; then + echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s)" + fi diff --git a/.iwyu.imp b/.iwyu.imp index 53fddd24aa..a9d2c03058 100644 --- a/.iwyu.imp +++ b/.iwyu.imp @@ -6,8 +6,22 @@ [ # Work around for C++ STL { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, - # Local opentelemetry-cpp + # Local opentelemetry-cpp style + # We prefer to include for simplicity + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + + # We prefer to include for simplicity + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e234a77b..2025c36b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,15 +15,345 @@ Increment the: ## [Unreleased] +## [1.18 2024-11-25] + +* [EXPORTER] Fix crash in ElasticsearchLogRecordExporter + [#3082](https://github.com/open-telemetry/opentelemetry-cpp/pull/3082) + +* [BUILD] Avoid buggy warning with gcc <= 8 + [#3087](https://github.com/open-telemetry/opentelemetry-cpp/pull/3087) + +* [API] Jaeger Propagator should not be deprecated + [#3086](https://github.com/open-telemetry/opentelemetry-cpp/pull/3086) + +* Update bzlmod version + [#3093](https://github.com/open-telemetry/opentelemetry-cpp/pull/3093) + +* [BUILD] Remove std::make_unique + [#3098](https://github.com/open-telemetry/opentelemetry-cpp/pull/3098) + +* [BUILD] Fix compiling problems for gcc 4.8 + [#3100](https://github.com/open-telemetry/opentelemetry-cpp/pull/3100) + +* [TEST] Fix linking order and gmock linking + [#3106](https://github.com/open-telemetry/opentelemetry-cpp/pull/3106) + +* [EXPORTER] Add config options to prometheus exporter + [#3104](https://github.com/open-telemetry/opentelemetry-cpp/pull/3104) + +* [BUILD] Add a CMake option to disable shared libs + [#3095](https://github.com/open-telemetry/opentelemetry-cpp/pull/3095) + +* [EXPORTER] Remove out of date ETW exporter doc + [#3103](https://github.com/open-telemetry/opentelemetry-cpp/pull/3103) + +* [EXPORTER] Add logging for async gRPC errors + [#3108](https://github.com/open-telemetry/opentelemetry-cpp/pull/3108) + +* [BUILD] Remove aligned_storage from nostd + [#3112](https://github.com/open-telemetry/opentelemetry-cpp/pull/3112) + +* [EXPORTER] Elastic Search exporter follow ECS guidelines + [#3107](https://github.com/open-telemetry/opentelemetry-cpp/pull/3107) + +* [INSTALL] Resolve dependencies in opentelemetry-cpp-config.cmake + [#3094](https://github.com/open-telemetry/opentelemetry-cpp/pull/3094) + +* [API] Add synchronous gauge + [#3029](https://github.com/open-telemetry/opentelemetry-cpp/pull/3029) + +* [BUILD] allow building with -DWITH_OTLP_HTTP_COMPRESSION=OFF without zlib + [#3120](https://github.com/open-telemetry/opentelemetry-cpp/pull/3120) + +* [CI] Comment the arm64 CI + [#3125](https://github.com/open-telemetry/opentelemetry-cpp/pull/3125) + +* [API] Comply with W3C Trace Context + [#3115](https://github.com/open-telemetry/opentelemetry-cpp/pull/3115) + +* [EXPORTER] bump prometheus to v1.3.0 + [#3122](https://github.com/open-telemetry/opentelemetry-cpp/pull/3122) + +* [EXPORTER] Log SSL Connection Information + [#3113](https://github.com/open-telemetry/opentelemetry-cpp/pull/3113) + +* [BUILD] Improve how to handle yield() in ARM + [#3129](https://github.com/open-telemetry/opentelemetry-cpp/pull/3129) + +* [BUILD] Fix -Wmissing-template-arg-list-after-template-kw warning + [#3133](https://github.com/open-telemetry/opentelemetry-cpp/pull/3133) + +* [EXPORTER]: Elasticsearch exporter put log resource in root instead of under 'resources' + [#3131](https://github.com/open-telemetry/opentelemetry-cpp/pull/3131) + +* [TEST] Rename w3c_tracecontext_test to w3c_tracecontext_http_test_server + [#3132](https://github.com/open-telemetry/opentelemetry-cpp/pull/3132) + +* [BUILD] Patches for building on AIX + [#3127](https://github.com/open-telemetry/opentelemetry-cpp/pull/3127) + +* [SEMANTIC CONVENTIONS] Migration to weaver + [#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105) + +* [SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.28.0 + [#3139](https://github.com/open-telemetry/opentelemetry-cpp/pull/3139) + +* [EXPORTER] handling of invalid ports in UrlParser + [#3142](https://github.com/open-telemetry/opentelemetry-cpp/pull/3142) + +* [CI] speed up clang-tidy workflow + [#3148](https://github.com/open-telemetry/opentelemetry-cpp/pull/3148) + +* [EXPORTER] Allow to share gRPC clients between OTLP exporters + [#3041](https://github.com/open-telemetry/opentelemetry-cpp/pull/3041) + +* Bump codecov/codecov-action from 4 to 5 + [#3143](https://github.com/open-telemetry/opentelemetry-cpp/pull/3143) + +* [CI] Add cppcheck in the build + [#3151](https://github.com/open-telemetry/opentelemetry-cpp/pull/3151) + +* [BUILD] Fix error message + [#3152](https://github.com/open-telemetry/opentelemetry-cpp/pull/3152) + +* [EXPORTER] fix clang-tidy warnings in UrlParser + [#3146](https://github.com/open-telemetry/opentelemetry-cpp/pull/3146) + +* [EXPORTER] Upgrade to opentelemetry-proto 1.4.0 + [#3157](https://github.com/open-telemetry/opentelemetry-cpp/pull/3157) + +* [TEST] refactor UrlParser tests to use value-paramterized tests + [#3153](https://github.com/open-telemetry/opentelemetry-cpp/pull/3153) + +* [TEST] add a test for ElasticSearchRecordable + [#3154](https://github.com/open-telemetry/opentelemetry-cpp/pull/3154) + +* [BUILD] Fix missing dependency on protoc compiler + [#3159](https://github.com/open-telemetry/opentelemetry-cpp/pull/3159) + +* [bazel] Update prometheus-cpp in MODULE.bazel + [#3162](https://github.com/open-telemetry/opentelemetry-cpp/pull/3162) + +* [bazel] Enable --incompatible_disallow_empty_glob + [#2642](https://github.com/open-telemetry/opentelemetry-cpp/pull/2642) + +* [INSTALL] Fix cmake/opentelemetry-cpp-config.cmake.in + [#3165](https://github.com/open-telemetry/opentelemetry-cpp/pull/3165) + +* [BUILD] Do not set OTELCPP_PROTO_PATH in the CMake cache + [#3160](https://github.com/open-telemetry/opentelemetry-cpp/pull/3160) + +* [BUILD] Fix build for esp32 + [#3155](https://github.com/open-telemetry/opentelemetry-cpp/pull/3155) + +* [bazel] Update opentelemetry-proto in MODULE.bazel + [#3163](https://github.com/open-telemetry/opentelemetry-cpp/pull/3163) + +Important changes: + +* [API] Jaeger Propagator should not be deprecated + [#3086](https://github.com/open-telemetry/opentelemetry-cpp/pull/3086) + + * Deprecation of the Jaeger propagator, as announced on 2023-01-31 + in version 1.8.2, is now reverted. + * This deprecation turned out to be not justified, + as the Jaeger propagator can be used without the (now removed) + Jaeger exporter. + +* [EXPORTER] Change log resources location for ElasticsearchLogRecordExporter + [#3119](https://github.com/open-telemetry/opentelemetry-cpp/pull/3131) + + * Moved from `root/resources` to `root` + +* [SEMANTIC CONVENTIONS] Migration to weaver + [#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105) + + * `semantic_convention.h` header files are deprecated, + replaced by `semconv/xxx_attributes.h` header files, + for each `xxx` semantic attribute group. + * See file DEPRECATED.md for details. + +Deprecations: + +* This release contains deprecations, see file DEPRECATED.md for details. + +## [1.17 2024-10-07] + +* [CI] Add a clang-tidy build + [#3001](https://github.com/open-telemetry/opentelemetry-cpp/pull/3001) + +* [BUILD] Upgrade to opentelemetry-proto 1.3.2 + [#2991](https://github.com/open-telemetry/opentelemetry-cpp/pull/2991) + +* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY` + [#2717](https://github.com/open-telemetry/opentelemetry-cpp/pull/2717) + +* [EXPORTER] ForceFlush before canceling the running requests on shutdown + [#2727](https://github.com/open-telemetry/opentelemetry-cpp/pull/2727) + +* [SDK] Fix crash in PeriodicExportingMetricReader + [#2983](https://github.com/open-telemetry/opentelemetry-cpp/pull/2983) + +* [SDK] Fix memory leak in TlsRandomNumberGenerator() constructor + [#2661](https://github.com/open-telemetry/opentelemetry-cpp/pull/2661) + +* [EXPORTER] Ignore exception when create thread in OTLP file exporter + [#3012](https://github.com/open-telemetry/opentelemetry-cpp/pull/3012) + +* [BUILD] Update the version in MODULE.bazel + [#3015](https://github.com/open-telemetry/opentelemetry-cpp/pull/3015) + +* [BUILD] Fix build without vcpkg on Windows when gRPC is disabled + [#3016](https://github.com/open-telemetry/opentelemetry-cpp/pull/3016) + +* [BUILD] Add abi_version_no bazel flag + [#3020](https://github.com/open-telemetry/opentelemetry-cpp/pull/3020) + +* [Code health] Expand iwyu coverage to include unit tests + [#3022](https://github.com/open-telemetry/opentelemetry-cpp/pull/3022) + +* [BUILD] Version opentelemetry_proto/proto_grpc shared libraries + [#2992](https://github.com/open-telemetry/opentelemetry-cpp/pull/2992) + +* [SEMANTIC CONVENTIONS] Upgrade semantic conventions to 1.27.0 + [#3023](https://github.com/open-telemetry/opentelemetry-cpp/pull/3023) + +* [SDK] Support empty histogram buckets + [#3027](https://github.com/open-telemetry/opentelemetry-cpp/pull/3027) + +* [TEST] Fix sync problems in OTLP File exporter tests + [#3031](https://github.com/open-telemetry/opentelemetry-cpp/pull/3031) + +* [SDK] PeriodicExportingMetricReader: future is never set, blocks until timeout + [#3030](https://github.com/open-telemetry/opentelemetry-cpp/pull/3030) + +* [Code Health] Clang Tidy cleanup, Part 2 + [#3038](https://github.com/open-telemetry/opentelemetry-cpp/pull/3038) + +* [Code Health] include-what-you-use cleanup, part 3 + [#3004](https://github.com/open-telemetry/opentelemetry-cpp/pull/3004) + +* [SDK] Fix overflow in timeout logic + [#3046](https://github.com/open-telemetry/opentelemetry-cpp/pull/3046) + +* [TEST] Add missing tests to Bazel build + [#3045](https://github.com/open-telemetry/opentelemetry-cpp/pull/3045) + +* [TEST] update collector tests with debug exporter + [#3050](https://github.com/open-telemetry/opentelemetry-cpp/pull/3050) + +* [EXAMPLE] update collector example with debug exporter + [#3049](https://github.com/open-telemetry/opentelemetry-cpp/pull/3049) + +* [TEST] update references to logging exporter + [#3053](https://github.com/open-telemetry/opentelemetry-cpp/pull/3053) + +* [EXAMPLE] Clean the tracer initialization in OStream example + [#3051](https://github.com/open-telemetry/opentelemetry-cpp/pull/3051) + +* [EXPORTER] Fix the format of SpanLink for ETW + [#3054](https://github.com/open-telemetry/opentelemetry-cpp/pull/3054) + +* [EXPORTER] Add in-memory metric exporter + [#3043](https://github.com/open-telemetry/opentelemetry-cpp/pull/3043) + +* [Code Health] include-what-you-use cleanup, part 4 + [#3040](https://github.com/open-telemetry/opentelemetry-cpp/pull/3040) + +* [BUILD] add loongarch info + [#3052](https://github.com/open-telemetry/opentelemetry-cpp/pull/3052) + +* [CI] Update otel-collector version + [#3067](https://github.com/open-telemetry/opentelemetry-cpp/pull/3067) + +* [SDK] Update MetricProducer interface to match spec + [#3044](https://github.com/open-telemetry/opentelemetry-cpp/pull/3044) + +* [EXPORTER] Fix URL in ES exporter, fix ipv6 supporting for http client + [#3081](https://github.com/open-telemetry/opentelemetry-cpp/pull/3081) + +* [EXPORTER] Add HttpHeaders in ElasticsearchLogRecordExporter + [#3083](https://github.com/open-telemetry/opentelemetry-cpp/pull/3083) + +Breaking changes: + +* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY` + [#2717](https://github.com/open-telemetry/opentelemetry-cpp/pull/2717) + + * As announced in opentelemetry-cpp previous release 1.16.0, + CMake option `WITH_DEPRECATED_SDK_FACTORY` was temporary, + and to be removed by the next release. + * This option is now removed. + * Code configuring the SDK must be adjusted, as previously described: + + * [API/SDK] Provider cleanup + [#2664](https://github.com/open-telemetry/opentelemetry-cpp/pull/2664) + + * Before this fix: + * SDK factory methods such as: + * opentelemetry::sdk::trace::TracerProviderFactory::Create() + * opentelemetry::sdk::metrics::MeterProviderFactory::Create() + * opentelemetry::sdk::logs::LoggerProviderFactory::Create() + * opentelemetry::sdk::logs::EventLoggerProviderFactory::Create() + + returned an API object (opentelemetry::trace::TracerProvider) + to the caller. + + * After this fix, these methods return an SDK level object + (opentelemetry::sdk::trace::TracerProvider) to the caller. + * Returning an SDK object is necessary for the application to + cleanup and invoke SDK level methods, such as ForceFlush(), + on a provider. + * The application code that configures the SDK, by calling + the various provider factories, may need adjustment. + * All the examples have been updated, and in particular no + longer perform static_cast do convert an API object to an SDK object. + Please refer to examples for guidance on how to adjust. + +## [1.16.1 2024-07-17] + +* [BUILD] Add bazel missing BUILD file + [#2720](https://github.com/open-telemetry/opentelemetry-cpp/pull/2720) + +* [SDK] Added reserve for spans array in BatchSpanProcessor. + [#2724](https://github.com/open-telemetry/opentelemetry-cpp/pull/2724) + +* [DOC] Update "Using triplets" section in building-with-vcpkg documentation. + [#2726](https://github.com/open-telemetry/opentelemetry-cpp/pull/2726) + +* [DOC] Remove comment for unused LoggerProvider initialization params + [#2972](https://github.com/open-telemetry/opentelemetry-cpp/pull/2972) + * [SECURITY] Remove OTLP HTTP support for TLS 1.0 and TLS 1.1, require TLS 1.2 or better - [#2721](https://github.com/open-telemetry/opentelemetry-cpp/pull/2721) + [#2722](https://github.com/open-telemetry/opentelemetry-cpp/pull/2722) + +* [TEST] Fix opentelemetry-collector bind address + [#2989](https://github.com/open-telemetry/opentelemetry-cpp/pull/2989) + +* [EXPORTER] Fix references in AttributeValueVisitor + [#2985](https://github.com/open-telemetry/opentelemetry-cpp/pull/2985) + +* [Code health] include-what-you-use cleanup, part 2 + [#2704](https://github.com/open-telemetry/opentelemetry-cpp/pull/2704) + +* [Code Health] clang-tidy cleanup, part 1 + [#2990](https://github.com/open-telemetry/opentelemetry-cpp/pull/2990) + +* [CI] Build failures with ABSEIL 20240116 and CMAKE 3.30 + [#3002](https://github.com/open-telemetry/opentelemetry-cpp/pull/3002) + +* [CI] Enable bzlmod + [#2995](https://github.com/open-telemetry/opentelemetry-cpp/pull/2995) + +* [Metrics SDK] Fix hash calculation for nostd::string + [#2999](https://github.com/open-telemetry/opentelemetry-cpp/pull/2999) Breaking changes: * [SECURITY] Remove OTLP HTTP support for TLS 1.0 and TLS 1.1, require TLS 1.2 or better - [#2721](https://github.com/open-telemetry/opentelemetry-cpp/pull/2721) + [#2722](https://github.com/open-telemetry/opentelemetry-cpp/pull/2722) * The OTLP HTTP exporter no longer accept options like: * min_TLS = 1.0 * min_TLS = 1.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 711ac14c4c..6abf96cd99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,30 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.10) -# See https://cmake.org/cmake/help/v3.3/policy/CMP0057.html required by certain -# versions of gtest -cmake_policy(SET CMP0057 NEW) - -# See https://cmake.org/cmake/help/v3.12/policy/CMP0074.html required by certain -# version of zlib which CURL depends on. +# See https://cmake.org/cmake/help/latest/policy/CMP0074.html required by +# certain version of zlib which CURL depends on. if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") cmake_policy(SET CMP0074 NEW) endif() +# Allow to use normal variable for option() +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13") + cmake_policy(SET CMP0077 NEW) +endif() + # Prefer CMAKE_MSVC_RUNTIME_LIBRARY if possible if(POLICY CMP0091) cmake_policy(SET CMP0091 NEW) endif() +# MSVC RTTI flag /GR should not be not added to CMAKE_CXX_FLAGS by default. @see +# https://cmake.org/cmake/help/latest/policy/CMP0117.html +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20.0") + cmake_policy(SET CMP0117 NEW) +endif() + project(opentelemetry-cpp) # Mark variables as used so cmake doesn't complain about them @@ -60,6 +67,13 @@ else() elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) set(ARCH x86) endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc") + # AIX will report the processor as 'powerpc' even if building in 64-bit mode + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ARCH ppc64) + else() + set(ARCH ppc32) + endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") set(ARCH arm64) @@ -77,6 +91,8 @@ else() set(ARCH s390x) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(sparc.*|SPARC.*)") set(ARCH sparc) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(loongarch.*|LOONGARCH.*)") + set(ARCH loongarch) else() message( FATAL_ERROR @@ -159,14 +175,6 @@ message(STATUS "OPENTELEMETRY_VERSION=${OPENTELEMETRY_VERSION}") option(WITH_NO_DEPRECATED_CODE "Do not include deprecated code" OFF) -# This option is temporary, and will be removed. Set -# WITH_DEPRECATED_SDK_FACTORY=OFF to migrate to the new SDK code. -option(WITH_DEPRECATED_SDK_FACTORY "Use deprecated SDK provider factory" ON) - -if(WITH_DEPRECATED_SDK_FACTORY) - message(WARNING "WITH_DEPRECATED_SDK_FACTORY=ON is temporary and deprecated") -endif() - set(WITH_STL "OFF" CACHE STRING "Which version of the Standard Library for C++ to use") @@ -204,13 +212,6 @@ if(NOT WITH_STL STREQUAL "OFF") endif() endif() -if(DEFINED WITH_OTLP) - message( - FATAL_ERROR - "WITH_OTLP is deprecated. Please set either WITH_OTLP_GRPC=ON, WITH_OTLP_HTTP=ON, or both to ON." - ) -endif() - option(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW "Whether to enable mTLS support fro gRPC" OFF) @@ -228,6 +229,9 @@ option( "Whether to include gzip compression for the OTLP http exporter in the SDK" OFF) +option(WITH_CURL_LOGGING "Whether to enable select CURL verbosity in OTel logs" + OFF) + option(WITH_ZIPKIN "Whether to include the Zipkin exporter in the SDK" OFF) option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK" @@ -263,10 +267,6 @@ if(OTELCPP_VERSIONED_LIBS AND NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "OTELCPP_VERSIONED_LIBS=ON requires BUILD_SHARED_LIBS=ON") endif() -set(OTELCPP_PROTO_PATH - "" - CACHE PATH "Path to opentelemetry-proto") - if(WIN32) option(WITH_ETW "Whether to include the ETW Exporter in the SDK" ON) else() @@ -294,16 +294,16 @@ option( option(WITH_FUNC_TESTS "Whether to build functional tests" ON) -if(DEFINED WITH_LOGS_PREVIEW) - message(WARNING "WITH_LOGS_PREVIEW is removed because logs signal is stable") -endif() - option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF) # Exemplar specs status is experimental, so behind feature flag by default option(WITH_METRICS_EXEMPLAR_PREVIEW "Whether to enable exemplar within metrics" OFF) +option(OPENTELEMETRY_SKIP_DYNAMIC_LOADING_TESTS + "Whether to build test libraries that are always linked as shared libs" + OFF) + # # Verify options dependencies # @@ -364,9 +364,12 @@ if(WITH_PROMETHEUS) message(STATUS "Trying to use local prometheus-cpp from submodule") if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git) set(SAVED_ENABLE_TESTING ${ENABLE_TESTING}) + set(SAVED_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY}) set(ENABLE_TESTING OFF) + set(CMAKE_CXX_CLANG_TIDY "") add_subdirectory(third_party/prometheus-cpp) set(ENABLE_TESTING ${SAVED_ENABLE_TESTING}) + set(CMAKE_CXX_CLANG_TIDY ${SAVED_CMAKE_CXX_CLANG_TIDY}) else() message( FATAL_ERROR @@ -389,19 +392,14 @@ if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP OR WITH_OTLP_FILE) find_package(Protobuf) - if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0") - if(NOT WITH_ABSEIL) - message( - FATAL_ERROR - "Protobuf 3.22 or upper require abseil-cpp(Recommended version: 20230125 or upper)" - ) - endif() - endif() + # Protobuf 3.22 or upper require abseil-cpp, we can find it in + # opentelemetry-cpp-config.cmake if(WITH_OTLP_GRPC) find_package(gRPC) endif() - if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (NOT gRPC_FOUND)) + if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (WITH_OTLP_GRPC + AND NOT gRPC_FOUND)) if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) install_windows_deps() endif() @@ -444,7 +442,10 @@ if(WITH_OTLP_GRPC include(CMakeDependentOption) message(STATUS "PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}") + set(SAVED_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY}) + set(CMAKE_CXX_CLANG_TIDY "") include(cmake/opentelemetry-proto.cmake) + set(CMAKE_CXX_CLANG_TIDY ${SAVED_CMAKE_CXX_CLANG_TIDY}) endif() # diff --git a/DEPRECATED.md b/DEPRECATED.md index 7db5ba9d93..ec97f420fe 100644 --- a/DEPRECATED.md +++ b/DEPRECATED.md @@ -46,132 +46,94 @@ N/A ## [opentelemetry-cpp API] -### Jaeger propagator - -#### Announcement (Jaeger) - -* Version: 1.8.2 -* Date: 2023-01-31 -* PR: [DEPRECATION] Deprecate the Jaeger exporter - [#1923](https://github.com/open-telemetry/opentelemetry-cpp/pull/1923) - -This PR also listed the Jaeger propagator as deprecated. - -#### Motivation (Jaeger) - -The Jaeger Exporter is now (July 2023) removed from the OpenTelemetry specification. - -The Jaeger Propagator remains, because changing propagation is a longer -process compared to changing an export format. - -New deployments however are encouraged to use a W3C compliant propagator, -and avoid the Jaeger propagator, which is now deprecated. - -#### Scope (Jaeger) - -The following are deprecated and planned for removal: - -* the API header `opentelemetry/trace/propagation/jaeger.h`, including: - * the C++ class `JaegerPropagator` - -#### Mitigation (Jaeger) - -Use a W3C compliant propagator instead. +N/A -That is, use class HttpTraceContext and "traceparent" tags. +## [opentelemetry-cpp SDK] -Do not use class JaegerPropagator and "uber-trace-id" tags. +N/A -#### Planned removal (Jaeger) +## [opentelemetry-cpp Exporter] -No date set yet for the Jaeger Propagator. +N/A -## [opentelemetry-cpp SDK] +## [Documentation] -### SDK ProviderFactory cleanup +N/A -#### Announcement (SDK ProviderFactory cleanup) +## Semantic conventions -* Version: 1.15.0 -* Date: 2024-06-03 -* PR: [API/SDK] Provider cleanup - [#2664](https://github.com/open-telemetry/opentelemetry-cpp/pull/2664) +### Header files "semantic_conventions.h" -This PR introduces changes to SDK ProviderFactory methods. +#### Announcement (semantic_conventions.h) -#### Motivation (SDK ProviderFactory cleanup) +Deprecation is announced as part of the migration to weaver: -SDK Factory methods for signal providers, such as: +* `Version:` release following opentelemetry-cpp 1.17.0 +* `Date:` Nov 9, 2024 +* `PR:` [PR 3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105) -* opentelemetry::sdk::trace::TracerProviderFactory -* opentelemetry::sdk::metrics::MeterProviderFactory -* opentelemetry::sdk::logs::LoggerProviderFactory -* opentelemetry::sdk::logs::EventLoggerProviderFactory +#### Motivation (semantic_conventions.h) -currently returns a unique pointer on a API class. +The header files for semantic conventions are generated automatically. +The tooling to generate these files is changing: -This is incorrect, the proper return type should be -a unique pointer on a SDK class instead. +* before, the build-tool repository was used +* now, the weaver repository is used -#### Scope (SDK ProviderFactory cleanup) +Changes in tooling allows to generate code that is better organized, +with dedicated header files per group of semantic conventions, +instead of a single header file for everything. -All the current Create methods in: +#### Scope (semantic_conventions.h) -* class opentelemetry::sdk::trace::TracerProviderFactory -* class opentelemetry::sdk::metrics::MeterProviderFactory -* class opentelemetry::sdk::logs::LoggerProviderFactory -* class opentelemetry::sdk::logs::EventLoggerProviderFactory +The following files: -are marked as deprecated, as they return an API object. +* `api/include/opentelemetry/trace/semantic_conventions.h` +* `sdk/include/opentelemetry/sdk/resource/semantic_conventions.h` -Instead, another set of Create methods is provided, -with a different return type, an SDK object. +are now deprecated. -Both sets can not be exposed at the same time, -as this would cause build breaks, -so a compilation flag is defined to select which methods to use. +They correspond to semantic conventions v1.27.0, +and will no longer be maintained up to date. -When OPENTELEMETRY_DEPRECATED_SDK_FACTORY is defined, -the old, deprecated, methods are available. +These files will be removed in the future. -When OPENTELEMETRY_DEPRECATED_SDK_FACTORY is not defined, -the new methods are available. +#### Mitigation (semantic_conventions.h) -The scope of this deprecation and removal, -is to remove the flag OPENTELEMETRY_DEPRECATED_SDK_FACTORY itself, -which implies that only the new set of Create() methods, -returning an SDK object, are supported. +Two things have changed: -#### Mitigation (SDK ProviderFactory cleanup) +* the header file to use +* the symbol name to use. -Build without defining flag OPENTELEMETRY_DEPRECATED_SDK_FACTORY. +Before, the semantic convention for `url.full` was: -Existing code, such as: +* declared in file `semantic_conventions.h` +* declared as symbol `SemanticConventions::kUrlFull` -```cpp - std::shared_ptr tracer_provider; - tracer_provider = opentelemetry::sdk::trace::TracerProviderFactory::Create(...); -``` +Now, the `url.full` convention, which is part or the `url` group, is: -should be adjusted to: +* declared in file `semconv/url_attributes.h` +* declared as symbol `semconv::url::kUrlFull` -```cpp - std::shared_ptr tracer_provider; - tracer_provider = opentelemetry::sdk::trace::TracerProviderFactory::Create(...); -``` +Application code that uses semantic conventions must be adjusted +accordingly. -#### Planned removal (SDK ProviderFactory cleanup) +In addition, semantic conventions that are not marked as stable +are generated in a different header file, placed under directory +`incubating`, to better separate stable and non stable code. -Flag OPENTELEMETRY_DEPRECATED_SDK_FACTORY is introduced in release 1.16.0, -to provide a migration path. +For example, file `semconv/incubating/url_attributes.h` +defines `semconv::url::kUrlDomain`, +which is not marked as stable in semconv v1.27.0 -This flag is meant to be temporary, and short lived. -Expect removal by release 1.17.0 +#### Planned removal (semantic_conventions.h) -## [opentelemetry-cpp Exporter] +The following files: -N/A +* `api/include/opentelemetry/trace/semantic_conventions.h` +* `sdk/include/opentelemetry/sdk/resource/semantic_conventions.h` -## [Documentation] +will be removed. -N/A +The removal date is planned for July 1, 2025. +This allows more than six months for applications to adjust. diff --git a/MODULE.bazel b/MODULE.bazel index 7b84c2b719..b3c7077108 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -3,20 +3,20 @@ module( name = "opentelemetry-cpp", - version = "0", + version = "1.17.0", compatibility_level = 0, repo_name = "io_opentelemetry_cpp", ) bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl") bazel_dep(name = "bazel_skylib", version = "1.5.0") -bazel_dep(name = "curl", version = "8.4.0") -bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc") +bazel_dep(name = "curl", version = "8.8.0") +bazel_dep(name = "grpc", version = "1.63.1.bcr.1", repo_name = "com_github_grpc_grpc") bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "github_nlohmann_json") -bazel_dep(name = "opentelemetry-proto", version = "1.3.1", repo_name = "com_github_opentelemetry_proto") +bazel_dep(name = "opentelemetry-proto", version = "1.4.0", repo_name = "com_github_opentelemetry_proto") bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing") bazel_dep(name = "platforms", version = "0.0.8") -bazel_dep(name = "prometheus-cpp", version = "1.2.4", repo_name = "com_github_jupp0r_prometheus_cpp") +bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp") bazel_dep(name = "protobuf", version = "26.0", repo_name = "com_google_protobuf") bazel_dep(name = "rules_proto", version = "5.3.0-21.7") bazel_dep(name = "zlib", version = "1.3.1.bcr.1") diff --git a/RELEASING.md b/RELEASING.md index 8246e8fe44..852332e820 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,7 +2,7 @@ ## Pre Release -1: Upgrade to latest [semantic-conventions](docs/semantic-conventions.md) +1: Upgrade to latest [dependencies](docs/maintaining-dependencies.md) if required. 2: Make sure all relevant changes for this release are included under diff --git a/api/BUILD b/api/BUILD index fdfe3ca146..dfc7d3c645 100644 --- a/api/BUILD +++ b/api/BUILD @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag") +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag") package(default_visibility = ["//visibility:public"]) @@ -35,6 +35,9 @@ cc_library( ":set_cxx_stdlib_2020": ["OPENTELEMETRY_STL_VERSION=2020"], ":set_cxx_stdlib_2023": ["OPENTELEMETRY_STL_VERSION=2023"], "//conditions:default": [], + }) + select({ + ":abi_version_no_1": ["OPENTELEMETRY_ABI_VERSION_NO=1"], + ":abi_version_no_2": ["OPENTELEMETRY_ABI_VERSION_NO=2"], }), strip_include_prefix = "include", tags = ["api"], @@ -61,3 +64,18 @@ bool_flag( build_setting_default = False, deprecation = "The value of this flag is ignored. Bazel builds always depend on Abseil for its pre-adopted `std::` types. You should remove this flag from your build command.", ) + +int_flag( + name = "abi_version_no", + build_setting_default = 1, +) + +config_setting( + name = "abi_version_no_1", + flag_values = {":abi_version_no": "1"}, +) + +config_setting( + name = "abi_version_no_2", + flag_values = {":abi_version_no": "2"}, +) diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index e07275efed..78e97ad029 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -35,11 +35,6 @@ if(WITH_NO_DEPRECATED_CODE) INTERFACE OPENTELEMETRY_NO_DEPRECATED_CODE) endif() -if(WITH_DEPRECATED_SDK_FACTORY) - target_compile_definitions(opentelemetry_api - INTERFACE OPENTELEMETRY_DEPRECATED_SDK_FACTORY) -endif() - if(WITH_ABSEIL) target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL) target_link_libraries( diff --git a/api/include/opentelemetry/baggage/propagation/baggage_propagator.h b/api/include/opentelemetry/baggage/propagation/baggage_propagator.h index 6de32882c0..d75409ed60 100644 --- a/api/include/opentelemetry/baggage/propagation/baggage_propagator.h +++ b/api/include/opentelemetry/baggage/propagation/baggage_propagator.h @@ -3,9 +3,15 @@ #pragma once +#include +#include + #include "opentelemetry/baggage/baggage.h" #include "opentelemetry/baggage/baggage_context.h" +#include "opentelemetry/context/context.h" #include "opentelemetry/context/propagation/text_map_propagator.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/include/opentelemetry/common/key_value_iterable_view.h b/api/include/opentelemetry/common/key_value_iterable_view.h index fb1a6ea019..e22fb6f06f 100644 --- a/api/include/opentelemetry/common/key_value_iterable_view.h +++ b/api/include/opentelemetry/common/key_value_iterable_view.h @@ -3,9 +3,14 @@ #pragma once +#include +#include #include +#include #include +#include +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable.h" #include "opentelemetry/nostd/function_ref.h" #include "opentelemetry/nostd/span.h" diff --git a/api/include/opentelemetry/common/macros.h b/api/include/opentelemetry/common/macros.h index b4a270084d..b74c1048fc 100644 --- a/api/include/opentelemetry/common/macros.h +++ b/api/include/opentelemetry/common/macros.h @@ -387,6 +387,37 @@ point. #endif +// OPENTELEMETRY_HAVE_EXCEPTIONS +// +// Checks whether the compiler both supports and enables exceptions. Many +// compilers support a "no exceptions" mode that disables exceptions. +// +// Generally, when OPENTELEMETRY_HAVE_EXCEPTIONS is not defined: +// +// * Code using `throw` and `try` may not compile. +// * The `noexcept` specifier will still compile and behave as normal. +// * The `noexcept` operator may still return `false`. +// +// For further details, consult the compiler's documentation. +#ifndef OPENTELEMETRY_HAVE_EXCEPTIONS +# if defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__) < 306 +// Clang < 3.6 +// http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro +# if defined(__EXCEPTIONS) && OPENTELEMETRY_HAVE_FEATURE(cxx_exceptions) +# define OPENTELEMETRY_HAVE_EXCEPTIONS 1 +# endif // defined(__EXCEPTIONS) && OPENTELEMETRY_HAVE_FEATURE(cxx_exceptions) +# elif OPENTELEMETRY_HAVE_FEATURE(cxx_exceptions) +# define OPENTELEMETRY_HAVE_EXCEPTIONS 1 +// Handle remaining special cases and default to exceptions being supported. +# elif !(defined(__GNUC__) && !defined(__EXCEPTIONS) && !defined(__cpp_exceptions)) && \ + !(defined(_MSC_VER) && !defined(_CPPUNWIND)) +# define OPENTELEMETRY_HAVE_EXCEPTIONS 1 +# endif +#endif +#ifndef OPENTELEMETRY_HAVE_EXCEPTIONS +# define OPENTELEMETRY_HAVE_EXCEPTIONS 0 +#endif + /* OPENTELEMETRY_ATTRIBUTE_LIFETIME_BOUND indicates that a resource owned by a function parameter or implicit object parameter is retained by the return value of the diff --git a/api/include/opentelemetry/common/spin_lock_mutex.h b/api/include/opentelemetry/common/spin_lock_mutex.h index 369183b953..7031fa4d23 100644 --- a/api/include/opentelemetry/common/spin_lock_mutex.h +++ b/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/api/include/opentelemetry/common/string_util.h b/api/include/opentelemetry/common/string_util.h index a7070a0acd..273a65272b 100644 --- a/api/include/opentelemetry/common/string_util.h +++ b/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/api/include/opentelemetry/context/context.h b/api/include/opentelemetry/context/context.h index cf5c9cd319..620ca51c8b 100644 --- a/api/include/opentelemetry/context/context.h +++ b/api/include/opentelemetry/context/context.h @@ -4,9 +4,12 @@ #pragma once #include +#include + #include "opentelemetry/context/context_value.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h index cccc71e32f..73d4dcd908 100644 --- a/api/include/opentelemetry/context/runtime_context.h +++ b/api/include/opentelemetry/context/runtime_context.h @@ -3,8 +3,12 @@ #pragma once +#include +#include + #include "opentelemetry/common/macros.h" #include "opentelemetry/context/context.h" +#include "opentelemetry/context/context_value.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/nostd/unique_ptr.h" diff --git a/api/include/opentelemetry/logs/event_logger.h b/api/include/opentelemetry/logs/event_logger.h index b5c94a7067..d3049953bc 100644 --- a/api/include/opentelemetry/logs/event_logger.h +++ b/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/api/include/opentelemetry/logs/logger.h b/api/include/opentelemetry/logs/logger.h index dc09a0c2b4..519516f297 100644 --- a/api/include/opentelemetry/logs/logger.h +++ b/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/api/include/opentelemetry/logs/logger_type_traits.h b/api/include/opentelemetry/logs/logger_type_traits.h index 486135137d..d88a6ffbdc 100644 --- a/api/include/opentelemetry/logs/logger_type_traits.h +++ b/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/api/include/opentelemetry/metrics/noop.h b/api/include/opentelemetry/metrics/noop.h index d34a0e681b..1d508b9387 100644 --- a/api/include/opentelemetry/metrics/noop.h +++ b/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/api/include/opentelemetry/metrics/sync_instruments.h b/api/include/opentelemetry/metrics/sync_instruments.h index 4471677433..9eaec3352f 100644 --- a/api/include/opentelemetry/metrics/sync_instruments.h +++ b/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/api/include/opentelemetry/nostd/function_ref.h b/api/include/opentelemetry/nostd/function_ref.h index 1064c966d7..6f0c2dd330 100644 --- a/api/include/opentelemetry/nostd/function_ref.h +++ b/api/include/opentelemetry/nostd/function_ref.h @@ -3,8 +3,10 @@ #pragma once -#include +#include +#include // IWYU pragma: keep #include +#include #include "opentelemetry/version.h" @@ -12,7 +14,7 @@ OPENTELEMETRY_BEGIN_NAMESPACE namespace nostd { template -class function_ref; +class function_ref; // IWYU pragma: keep /** * Non-owning function reference that can be used as a more performant diff --git a/api/include/opentelemetry/nostd/internal/absl/README.md b/api/include/opentelemetry/nostd/internal/absl/README.md index 6a40855704..5dd661971f 100644 --- a/api/include/opentelemetry/nostd/internal/absl/README.md +++ b/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/api/include/opentelemetry/nostd/internal/absl/base/config.h b/api/include/opentelemetry/nostd/internal/absl/base/config.h index 3f78df3d98..e0836b9b3f 100644 --- a/api/include/opentelemetry/nostd/internal/absl/base/config.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h b/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h index 9d024a2d91..dd66e9f223 100644 --- a/api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h b/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h index 99c37ba24a..c37f43cfc8 100644 --- a/api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/base/macros.h b/api/include/opentelemetry/nostd/internal/absl/base/macros.h index 7b4f427d30..707c375ed1 100644 --- a/api/include/opentelemetry/nostd/internal/absl/base/macros.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/base/options.h b/api/include/opentelemetry/nostd/internal/absl/base/options.h index 3632b74f64..26665b151e 100644 --- a/api/include/opentelemetry/nostd/internal/absl/base/options.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h b/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h index 00c90f82d1..dbd0348871 100644 --- a/api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h b/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h index 81caa0d75c..89fe750dbd 100644 --- a/api/include/opentelemetry/nostd/internal/absl/types/bad_variant_access.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h b/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h index ee42da7c93..fc73cf5328 100644 --- a/api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/types/variant.h b/api/include/opentelemetry/nostd/internal/absl/types/variant.h index 2649a29ce3..cbce326c26 100644 --- a/api/include/opentelemetry/nostd/internal/absl/types/variant.h +++ b/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/api/include/opentelemetry/nostd/internal/absl/utility/utility.h b/api/include/opentelemetry/nostd/internal/absl/utility/utility.h index 8c15e2b8c1..62580cc5af 100644 --- a/api/include/opentelemetry/nostd/internal/absl/utility/utility.h +++ b/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/api/include/opentelemetry/nostd/string_view.h b/api/include/opentelemetry/nostd/string_view.h index 5ee86dce23..f0e5bd9e2a 100644 --- a/api/include/opentelemetry/nostd/string_view.h +++ b/api/include/opentelemetry/nostd/string_view.h @@ -12,13 +12,14 @@ #if !defined(OPENTELEMETRY_HAVE_STD_STRING_VIEW) # include -# include # include +# include # include # include # include +# include +# include -# include "opentelemetry/common/macros.h" # include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/include/opentelemetry/nostd/variant.h b/api/include/opentelemetry/nostd/variant.h index d0b2d96001..b03a9b844b 100644 --- a/api/include/opentelemetry/nostd/variant.h +++ b/api/include/opentelemetry/nostd/variant.h @@ -54,7 +54,20 @@ OPENTELEMETRY_END_NAMESPACE # ifdef HAVE_ABSEIL # include "absl/types/variant.h" # else -# include "./internal/absl/types/variant.h" +# include "opentelemetry/nostd/internal/absl/base/options.h" + +namespace absl +{ +namespace OTABSL_OPTION_NAMESPACE_NAME +{ +template +struct variant_size; +template +class variant; +} // namespace OTABSL_OPTION_NAMESPACE_NAME +} // namespace absl + +# include "opentelemetry/nostd/internal/absl/types/variant.h" # endif # ifdef _MSC_VER @@ -66,7 +79,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 +87,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/api/include/opentelemetry/plugin/dynamic_load.h b/api/include/opentelemetry/plugin/dynamic_load.h index 10b4a34af4..2da2713555 100644 --- a/api/include/opentelemetry/plugin/dynamic_load.h +++ b/api/include/opentelemetry/plugin/dynamic_load.h @@ -6,19 +6,19 @@ #include #include +#include "opentelemetry/plugin/factory.h" +#include "opentelemetry/version.h" + #ifdef _WIN32 # include "opentelemetry/plugin/detail/dynamic_load_windows.h" // IWYU pragma: export #else # include "opentelemetry/plugin/detail/dynamic_load_unix.h" // IWYU pragma: export #endif -#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace plugin { -class Factory; - /** * Load an OpenTelemetry implementation as a plugin. * @param plugin the path to the plugin to load diff --git a/api/include/opentelemetry/semconv/client_attributes.h b/api/include/opentelemetry/semconv/client_attributes.h new file mode 100644 index 0000000000..ec984cc406 --- /dev/null +++ b/api/include/opentelemetry/semconv/client_attributes.h @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace client +{ + +/** + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or + * Unix domain socket name.

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

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

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

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

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

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

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

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

  • 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/api/include/opentelemetry/semconv/exception_attributes.h b/api/include/opentelemetry/semconv/exception_attributes.h new file mode 100644 index 0000000000..fdc19ac6d0 --- /dev/null +++ b/api/include/opentelemetry/semconv/exception_attributes.h @@ -0,0 +1,59 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace exception +{ + +/** + * SHOULD be set to true if the exception event is recorded at a point where it is known that the + * exception is escaping the scope of the span.

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

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

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

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

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

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

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

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

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

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

MUST NOT be populated when this is not supported by the HTTP server framework as + * the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD + * include the application root if + * there is one. + */ +static constexpr const char *kHttpRoute = "http.route"; + +namespace HttpRequestMethodValues +{ +/** + * CONNECT method. + */ +static constexpr const char *kConnect = "CONNECT"; + +/** + * DELETE method. + */ +static constexpr const char *kDelete = "DELETE"; + +/** + * GET method. + */ +static constexpr const char *kGet = "GET"; + +/** + * HEAD method. + */ +static constexpr const char *kHead = "HEAD"; + +/** + * OPTIONS method. + */ +static constexpr const char *kOptions = "OPTIONS"; + +/** + * PATCH method. + */ +static constexpr const char *kPatch = "PATCH"; + +/** + * POST method. + */ +static constexpr const char *kPost = "POST"; + +/** + * PUT method. + */ +static constexpr const char *kPut = "PUT"; + +/** + * TRACE method. + */ +static constexpr const char *kTrace = "TRACE"; + +/** + * Any HTTP method that the instrumentation has no prior knowledge of. + */ +static constexpr const char *kOther = "_OTHER"; + +} // namespace HttpRequestMethodValues + +} // namespace http +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/http_metrics.h b/api/include/opentelemetry/semconv/http_metrics.h new file mode 100644 index 0000000000..f83172e80e --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/artifact_attributes.h b/api/include/opentelemetry/semconv/incubating/artifact_attributes.h new file mode 100644 index 0000000000..d3bb99f6e5 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/artifact_attributes.h @@ -0,0 +1,81 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace artifact +{ + +/** + * The provenance filename of the built attestation which directly relates to the build artifact + * filename. This filename SHOULD accompany the artifact at publish time. See the SLSA + * Relationship specification for more information. + */ +static constexpr const char *kArtifactAttestationFilename = "artifact.attestation.filename"; + +/** + * The full hash value (see + * glossary), of the built attestation. Some envelopes in the software attestation space also + * refer to this as the digest. + */ +static constexpr const char *kArtifactAttestationHash = "artifact.attestation.hash"; + +/** + * The id of the build software attestation. + */ +static constexpr const char *kArtifactAttestationId = "artifact.attestation.id"; + +/** + * The human readable file name of the artifact, typically generated during build and release + * processes. Often includes the package name and version in the file name.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ */ +static constexpr const char *kAwsS3UploadId = "aws.s3.upload_id"; + +namespace AwsEcsLaunchtypeValues +{ +/** + * none + */ +static constexpr const char *kEc2 = "ec2"; + +/** + * none + */ +static constexpr const char *kFargate = "fargate"; + +} // namespace AwsEcsLaunchtypeValues + +} // namespace aws +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/az_attributes.h b/api/include/opentelemetry/semconv/incubating/az_attributes.h new file mode 100644 index 0000000000..2ce360d870 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/browser_attributes.h b/api/include/opentelemetry/semconv/incubating/browser_attributes.h new file mode 100644 index 0000000000..5ddb61eae5 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/browser_attributes.h @@ -0,0 +1,65 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace browser +{ + +/** + * Array of brand name and version separated by a space + *

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

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

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

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

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

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

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

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

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

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

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

  • 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/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h b/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h new file mode 100644 index 0000000000..363feed157 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cloudevents_attributes.h @@ -0,0 +1,58 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cloudevents +{ + +/** + * The event_id + * uniquely identifies the event. + */ +static constexpr const char *kCloudeventsEventId = "cloudevents.event_id"; + +/** + * The source + * identifies the context in which an event happened. + */ +static constexpr const char *kCloudeventsEventSource = "cloudevents.event_source"; + +/** + * The version of + * the CloudEvents specification which the event uses. + */ +static constexpr const char *kCloudeventsEventSpecVersion = "cloudevents.event_spec_version"; + +/** + * The subject of + * the event in the context of the event producer (identified by source). + */ +static constexpr const char *kCloudeventsEventSubject = "cloudevents.event_subject"; + +/** + * The event_type + * contains a value describing the type of event related to the originating occurrence. + */ +static constexpr const char *kCloudeventsEventType = "cloudevents.event_type"; + +} // namespace cloudevents +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h b/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h new file mode 100644 index 0000000000..a0740e5b38 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h @@ -0,0 +1,141 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace 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 Loggregator 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/api/include/opentelemetry/semconv/incubating/code_attributes.h b/api/include/opentelemetry/semconv/incubating/code_attributes.h new file mode 100644 index 0000000000..f2715e87b6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/code_attributes.h @@ -0,0 +1,60 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace code +{ + +/** + * The column number in @code code.filepath @endcode best representing the operation. It SHOULD + * point within the code unit named in @code code.function @endcode. + */ +static constexpr const char *kCodeColumn = "code.column"; + +/** + * The source code file name that identifies the code unit as uniquely as possible (preferably an + * absolute file path). + */ +static constexpr const char *kCodeFilepath = "code.filepath"; + +/** + * The method or function name, or equivalent (usually rightmost part of the code unit's name). + */ +static constexpr const char *kCodeFunction = "code.function"; + +/** + * The line number in @code code.filepath @endcode best representing the operation. It SHOULD point + * within the code unit named in @code code.function @endcode. + */ +static constexpr const char *kCodeLineno = "code.lineno"; + +/** + * The "namespace" within which @code code.function @endcode is defined. Usually the qualified class + * or module name, such that @code code.namespace @endcode + some separator + @code code.function + * @endcode form a unique identifier for the code unit. + */ +static constexpr const char *kCodeNamespace = "code.namespace"; + +/** + * A stacktrace as a string in the natural representation for the language runtime. The + * representation is to be determined and documented by each language SIG. + */ +static constexpr const char *kCodeStacktrace = "code.stacktrace"; + +} // namespace code +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/container_attributes.h b/api/include/opentelemetry/semconv/incubating/container_attributes.h new file mode 100644 index 0000000000..2ea7810b30 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/container_metrics.h b/api/include/opentelemetry/semconv/incubating/container_metrics.h new file mode 100644 index 0000000000..ef3d9fa71d --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/container_metrics.h @@ -0,0 +1,266 @@ +/* + * 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); +} + +/** + * The time the container has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricContainerUptime = "metric.container.uptime"; +static constexpr const char *descrMetricContainerUptime = "The time the container has been running"; +static constexpr const char *unitMetricContainerUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricContainerUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerUptime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerUptime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + +} // namespace container +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/cpu_attributes.h b/api/include/opentelemetry/semconv/incubating/cpu_attributes.h new file mode 100644 index 0000000000..b5ca637e31 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/cpu_attributes.h @@ -0,0 +1,73 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace cpu +{ + +/** + * The mode of the CPU + */ +static constexpr const char *kCpuMode = "cpu.mode"; + +namespace CpuModeValues +{ +/** + * none + */ +static constexpr const char *kUser = "user"; + +/** + * none + */ +static constexpr const char *kSystem = "system"; + +/** + * none + */ +static constexpr const char *kNice = "nice"; + +/** + * none + */ +static constexpr const char *kIdle = "idle"; + +/** + * none + */ +static constexpr const char *kIowait = "iowait"; + +/** + * none + */ +static constexpr const char *kInterrupt = "interrupt"; + +/** + * none + */ +static constexpr const char *kSteal = "steal"; + +/** + * none + */ +static constexpr const char *kKernel = "kernel"; + +} // namespace CpuModeValues + +} // namespace cpu +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/db_attributes.h b/api/include/opentelemetry/semconv/incubating/db_attributes.h new file mode 100644 index 0000000000..22148fed13 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/db_attributes.h @@ -0,0 +1,923 @@ +/* + * 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.

The collection name SHOULD NOT be extracted from @code db.query.text + * @endcode, unless the query format is known to only ever have a single collection name present. + *

+ * For batch operations, if the individual operations are known to have the same collection name + * then that collection name SHOULD be used. + *

+ * 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"; + +/** + * Account or request consistency level. + */ +static constexpr const char *kDbCosmosdbConsistencyLevel = "db.cosmosdb.consistency_level"; + +/** + * 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"; + +/** + * Deprecated, no replacement at this time. + *

+ * @deprecated + * No replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; + +/** + * List of regions contacted during operation in the order that they were contacted. If there is + * more than one region listed, it indicates that the operation was performed on multiple regions + * i.e. cross-regional call.

Region name matches the format of @code displayName @endcode in Azure + * Location API + */ +static constexpr const char *kDbCosmosdbRegionsContacted = "db.cosmosdb.regions_contacted"; + +/** + * Request units consumed for the 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. + *

+ * The operation name SHOULD NOT be extracted from @code db.query.text @endcode, + * unless the query format is known to only ever have a single operation name present. + *

+ * 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 database operation parameter, with @code @endcode being the parameter name, and the + * attribute value being a string representation of the parameter value.

If a parameter has no + * name and instead is referenced only by index, then @code @endcode SHOULD be the 0-based + * index. If @code db.query.text @endcode is also captured, then @code db.operation.parameter. + * @endcode SHOULD match up with the parameterized placeholders present in @code db.query.text + * @endcode. This attribute has stability level RELEASE CANDIDATE. + */ +static constexpr const char *kDbOperationParameter = "db.operation.parameter"; + +/** + * 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.

+ * @deprecated + * Replaced by @code db.operation.parameter @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbQueryParameter = "db.query.parameter"; + +/** + * Low cardinality representation of a database query text. + *

+ * @code db.query.summary @endcode provides static summary of the query text. It describes a class + * of database queries and is useful as a grouping key, especially when analyzing telemetry for + * database calls involving complex queries. Summary may be available to the instrumentation through + * instrumentation hooks or other means. If it is not available, instrumentations that support query + * parsing SHOULD generate a summary following Generating + * query summary section. This attribute has stability level RELEASE CANDIDATE. + */ +static constexpr const char *kDbQuerySummary = "db.query.summary"; + +/** + * 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"; + +/** + * Number of rows returned by the operation. + */ +static constexpr const char *kDbResponseReturnedRows = "db.response.returned_rows"; + +/** + * 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) connection. + */ +static constexpr const char *kGateway = "gateway"; + +/** + * Direct connection. + */ +static constexpr const char *kDirect = "direct"; + +} // namespace DbCosmosdbConnectionModeValues + +namespace DbCosmosdbConsistencyLevelValues +{ +/** + * none + */ +static constexpr const char *kStrong = "Strong"; + +/** + * none + */ +static constexpr const char *kBoundedStaleness = "BoundedStaleness"; + +/** + * none + */ +static constexpr const char *kSession = "Session"; + +/** + * none + */ +static constexpr const char *kEventual = "Eventual"; + +/** + * none + */ +static constexpr const char *kConsistentPrefix = "ConsistentPrefix"; + +} // namespace DbCosmosdbConsistencyLevelValues + +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/api/include/opentelemetry/semconv/incubating/db_metrics.h b/api/include/opentelemetry/semconv/incubating/db_metrics.h new file mode 100644 index 0000000000..9543a70baa --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/db_metrics.h @@ -0,0 +1,909 @@ +/* + * 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 *kMetricDbClientConnectionsCreateTime = + "metric.db.client.connections.create_time"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsCreateTime = + "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsCreateTime = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsCreateTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsCreateTime, + descrMetricDbClientConnectionsCreateTime, + unitMetricDbClientConnectionsCreateTime); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsCreateTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsCreateTime, + descrMetricDbClientConnectionsCreateTime, + unitMetricDbClientConnectionsCreateTime); +} + +/** + * 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 *kMetricDbClientConnectionsIdleMax = + "metric.db.client.connections.idle.max"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsIdleMax = + "Deprecated, use `db.client.connection.idle.max` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsIdleMax = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsIdleMax(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsIdleMax(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsIdleMax(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsIdleMax(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); +} + +/** + * 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 *kMetricDbClientConnectionsIdleMin = + "metric.db.client.connections.idle.min"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsIdleMin = + "Deprecated, use `db.client.connection.idle.min` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsIdleMin = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsIdleMin(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsIdleMin(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsIdleMin(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsIdleMin(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); +} + +/** + * 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 *kMetricDbClientConnectionsMax = "metric.db.client.connections.max"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsMax = + "Deprecated, use `db.client.connection.max` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsMax = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsMax(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsMax(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsMax(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsMax(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); +} + +/** + * 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 *kMetricDbClientConnectionsPendingRequests = + "metric.db.client.connections.pending_requests"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsPendingRequests = + "Deprecated, use `db.client.connection.pending_requests` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsPendingRequests = "{request}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsPendingRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsPendingRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsPendingRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); +} + +/** + * 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 *kMetricDbClientConnectionsTimeouts = + "metric.db.client.connections.timeouts"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsTimeouts = + "Deprecated, use `db.client.connection.timeouts` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsTimeouts = "{timeout}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsTimeouts(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsTimeouts(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsTimeouts(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsTimeouts(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); +} + +/** + * 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 *kMetricDbClientConnectionsUsage = "metric.db.client.connections.usage"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsUsage = + "Deprecated, use `db.client.connection.count` instead."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsUsage = "{connection}"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsUsage(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientConnectionsUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientConnectionsUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); +} + +/** + * 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 *kMetricDbClientConnectionsUseTime = + "metric.db.client.connections.use_time"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsUseTime = + "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsUseTime = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsUseTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsUseTime, + descrMetricDbClientConnectionsUseTime, + unitMetricDbClientConnectionsUseTime); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsUseTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsUseTime, + descrMetricDbClientConnectionsUseTime, + unitMetricDbClientConnectionsUseTime); +} + +/** + * 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 *kMetricDbClientConnectionsWaitTime = + "metric.db.client.connections.wait_time"; +OPENTELEMETRY_DEPRECATED +static constexpr const char *descrMetricDbClientConnectionsWaitTime = + "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from " + "`ms` to `s`."; +OPENTELEMETRY_DEPRECATED +static constexpr const char *unitMetricDbClientConnectionsWaitTime = "ms"; + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientConnectionsWaitTime(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsWaitTime, + descrMetricDbClientConnectionsWaitTime, + unitMetricDbClientConnectionsWaitTime); +} + +OPENTELEMETRY_DEPRECATED +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientConnectionsWaitTime(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsWaitTime, + descrMetricDbClientConnectionsWaitTime, + unitMetricDbClientConnectionsWaitTime); +} + +/** + * Number of active client instances + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientCosmosdbActiveInstanceCount = + "metric.db.client.cosmosdb.active_instance.count"; +static constexpr const char *descrMetricDbClientCosmosdbActiveInstanceCount = + "Number of active client instances"; +static constexpr const char *unitMetricDbClientCosmosdbActiveInstanceCount = "{instance}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +/** + * Request charge consumed + * by the operation

histogram + */ +static constexpr const char *kMetricDbClientCosmosdbOperationRequestCharge = + "metric.db.client.cosmosdb.operation.request_charge"; +static constexpr const char *descrMetricDbClientCosmosdbOperationRequestCharge = + "[Request charge](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the " + "operation"; +static constexpr const char *unitMetricDbClientCosmosdbOperationRequestCharge = "{request_unit}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientCosmosdbOperationRequestCharge(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientCosmosdbOperationRequestCharge, + descrMetricDbClientCosmosdbOperationRequestCharge, + unitMetricDbClientCosmosdbOperationRequestCharge); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientCosmosdbOperationRequestCharge(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientCosmosdbOperationRequestCharge, + descrMetricDbClientCosmosdbOperationRequestCharge, + unitMetricDbClientCosmosdbOperationRequestCharge); +} + +/** + * 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); +} + +/** + * The actual number of records returned by the database operation. + *

+ * histogram + */ +static constexpr const char *kMetricDbClientResponseReturnedRows = + "metric.db.client.response.returned_rows"; +static constexpr const char *descrMetricDbClientResponseReturnedRows = + "The actual number of records returned by the database operation."; +static constexpr const char *unitMetricDbClientResponseReturnedRows = "{row}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientResponseReturnedRows(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientResponseReturnedRows, + descrMetricDbClientResponseReturnedRows, + unitMetricDbClientResponseReturnedRows); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientResponseReturnedRows(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientResponseReturnedRows, + descrMetricDbClientResponseReturnedRows, + unitMetricDbClientResponseReturnedRows); +} + +} // namespace db +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/deployment_attributes.h b/api/include/opentelemetry/semconv/incubating/deployment_attributes.h new file mode 100644 index 0000000000..9c4594b7f3 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/deployment_attributes.h @@ -0,0 +1,76 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace deployment +{ + +/** + * 'Deprecated, use @code deployment.environment.name @endcode instead.' + *

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

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

    + *
  • @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/api/include/opentelemetry/semconv/incubating/destination_attributes.h b/api/include/opentelemetry/semconv/incubating/destination_attributes.h new file mode 100644 index 0000000000..5069fc03b7 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/destination_attributes.h @@ -0,0 +1,37 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace destination +{ + +/** + * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address + * or Unix domain socket name.

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

+ * The device identifier MUST only be defined using the values outlined below. This value is not an + * advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value + * MUST be equal to the vendor + * identifier. On Android (Java or Kotlin), this value MUST be equal to the Firebase + * Installation ID or a globally unique UUID which is persisted across sessions in your application. + * More information can be found here on best practices + * and exact implementation details. Caution should be taken when storing personal data or anything + * which can identify a user. GDPR and data protection laws may apply, ensure you do your own due + * diligence. + */ +static constexpr const char *kDeviceId = "device.id"; + +/** + * The name of the device manufacturer + *

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

+ * It's recommended this value represents a machine-readable version of the model identifier rather + * than the market or consumer-friendly name of the device. + */ +static constexpr const char *kDeviceModelIdentifier = "device.model.identifier"; + +/** + * The marketing name for the device model + *

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

+ * If the name field contains non-printable characters (below 32 or above 126), those characters + * should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be + * escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n + * respectively. + */ +static constexpr const char *kDnsQuestionName = "dns.question.name"; + +} // namespace dns +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/dns_metrics.h b/api/include/opentelemetry/semconv/incubating/dns_metrics.h new file mode 100644 index 0000000000..7f3915870b --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/enduser_attributes.h b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h new file mode 100644 index 0000000000..217d5dd414 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h @@ -0,0 +1,51 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace enduser +{ + +/** + * Deprecated, use @code user.id @endcode instead. + *

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

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

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

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

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

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

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

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

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

  • 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/api/include/opentelemetry/semconv/incubating/event_attributes.h b/api/include/opentelemetry/semconv/incubating/event_attributes.h new file mode 100644 index 0000000000..c2faa437cf --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/event_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace event +{ + +/** + * Identifies the class / type of event. + *

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

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

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

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

  • 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/api/include/opentelemetry/semconv/incubating/faas_metrics.h b/api/include/opentelemetry/semconv/incubating/faas_metrics.h new file mode 100644 index 0000000000..73dc2989a6 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h new file mode 100644 index 0000000000..9616fc14e0 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h @@ -0,0 +1,123 @@ +/* + * 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 for the flag evaluation context. For example, the targeting key. + */ +static constexpr const char *kFeatureFlagContextId = "feature_flag.context.id"; + +/** + * A message explaining the nature of an error occurring during flag evaluation. + */ +static constexpr const char *kFeatureFlagEvaluationErrorMessage = + "feature_flag.evaluation.error.message"; + +/** + * The reason code which shows how a feature flag value was determined. + */ +static constexpr const char *kFeatureFlagEvaluationReason = "feature_flag.evaluation.reason"; + +/** + * The lookup key of the feature flag. + */ +static constexpr const char *kFeatureFlagKey = "feature_flag.key"; + +/** + * Identifies the feature flag provider. + */ +static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name"; + +/** + * The identifier of the flag + * set to which the feature flag belongs. + */ +static constexpr const char *kFeatureFlagSetId = "feature_flag.set.id"; + +/** + * A semantic identifier for an evaluated flag value. + *

+ * 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. + */ +static constexpr const char *kFeatureFlagVariant = "feature_flag.variant"; + +/** + * The version of the ruleset used during the evaluation. This may be any stable value which + * uniquely identifies the ruleset. + */ +static constexpr const char *kFeatureFlagVersion = "feature_flag.version"; + +namespace FeatureFlagEvaluationReasonValues +{ +/** + * The resolved value is static (no dynamic evaluation). + */ +static constexpr const char *kStatic = "static"; + +/** + * The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic + * evaluation yielded no result). + */ +static constexpr const char *kDefault = "default"; + +/** + * The resolved value was the result of a dynamic evaluation, such as a rule or specific + * user-targeting. + */ +static constexpr const char *kTargetingMatch = "targeting_match"; + +/** + * The resolved value was the result of pseudorandom assignment. + */ +static constexpr const char *kSplit = "split"; + +/** + * The resolved value was retrieved from cache. + */ +static constexpr const char *kCached = "cached"; + +/** + * The resolved value was the result of the flag being disabled in the management system. + */ +static constexpr const char *kDisabled = "disabled"; + +/** + * The reason for the resolved value could not be determined. + */ +static constexpr const char *kUnknown = "unknown"; + +/** + * The resolved value is non-authoritative or possibly out of date + */ +static constexpr const char *kStale = "stale"; + +/** + * The resolved value was the result of an error. + */ +static constexpr const char *kError = "error"; + +} // namespace FeatureFlagEvaluationReasonValues + +} // namespace feature_flag +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/file_attributes.h b/api/include/opentelemetry/semconv/incubating/file_attributes.h new file mode 100644 index 0000000000..2ac4fc4b55 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/gcp_attributes.h b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h new file mode 100644 index 0000000000..53518251bb --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h @@ -0,0 +1,64 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace gcp +{ + +/** + * Identifies the Google Cloud service for which the official client library is intended. + *

+ * Intended to be a stable identifier for Google Cloud client libraries that is uniform across + * implementation languages. The value should be derived from the canonical service domain for the + * service; for example, 'foo.googleapis.com' should result in a value of 'foo'. + */ +static constexpr const char *kGcpClientService = "gcp.client.service"; + +/** + * The name of the Cloud Run execution being run for the + * Job, as set by the @code + * CLOUD_RUN_EXECUTION @endcode environment variable. + */ +static constexpr const char *kGcpCloudRunJobExecution = "gcp.cloud_run.job.execution"; + +/** + * The index for a task within an execution as provided by the @code + * CLOUD_RUN_TASK_INDEX @endcode environment variable. + */ +static constexpr const char *kGcpCloudRunJobTaskIndex = "gcp.cloud_run.job.task_index"; + +/** + * The hostname of a GCE instance. This is the full value of the default or custom hostname. + */ +static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostname"; + +/** + * The instance name of a GCE instance. This is the value provided by @code host.name @endcode, the + * visible name of the instance in the Cloud Console UI, and the prefix for the default hostname of + * the instance as defined by the default + * internal DNS name. + */ +static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; + +} // namespace gcp +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h new file mode 100644 index 0000000000..b56e98f178 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h @@ -0,0 +1,299 @@ +/* + * 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, default, 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"; + +/** + * A fingerprint to track any eventual change in the Generative AI environment. + */ +static constexpr const char *kGenAiOpenaiResponseSystemFingerprint = + "gen_ai.openai.response.system_fingerprint"; + +/** + * 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 encoding formats requested in an embeddings operation, if specified. + *

+ * In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems + * only accept a single format per request. + */ +static constexpr const char *kGenAiRequestEncodingFormats = "gen_ai.request.encoding_formats"; + +/** + * 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"; + +/** + * Embeddings operation such as OpenAI Create embeddings + * API + */ +static constexpr const char *kEmbeddings = "embeddings"; + +} // 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"; + +/** + * Azure AI Inference + */ +static constexpr const char *kAzAiInference = "az.ai.inference"; + +/** + * IBM Watsonx AI + */ +static constexpr const char *kIbmWatsonxAi = "ibm.watsonx.ai"; + +/** + * AWS Bedrock + */ +static constexpr const char *kAwsBedrock = "aws.bedrock"; + +} // namespace GenAiSystemValues + +namespace GenAiTokenTypeValues +{ +/** + * Input tokens (prompt, input, etc.) + */ +static constexpr const char *kInput = "input"; + +/** + * Output tokens (completion, response, etc.) + */ +static constexpr const char *kCompletion = "output"; + +} // namespace GenAiTokenTypeValues + +} // namespace gen_ai +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h b/api/include/opentelemetry/semconv/incubating/gen_ai_metrics.h new file mode 100644 index 0000000000..6a9064c3e7 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/geo_attributes.h b/api/include/opentelemetry/semconv/incubating/geo_attributes.h new file mode 100644 index 0000000000..b50240e228 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/geo_attributes.h @@ -0,0 +1,102 @@ +/* + * 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 geo +{ + +/** + * Two-letter code representing continent’s name. + */ +static constexpr const char *kGeoContinentCode = "geo.continent.code"; + +/** + * Two-letter ISO Country Code (ISO 3166-1 + * alpha2). + */ +static constexpr const char *kGeoCountryIsoCode = "geo.country.iso_code"; + +/** + * Locality name. Represents the name of a city, town, village, or similar populated place. + */ +static constexpr const char *kGeoLocalityName = "geo.locality.name"; + +/** + * Latitude of the geo location in WGS84. + */ +static constexpr const char *kGeoLocationLat = "geo.location.lat"; + +/** + * Longitude of the geo location in WGS84. + */ +static constexpr const char *kGeoLocationLon = "geo.location.lon"; + +/** + * Postal code associated with the location. Values appropriate for this field may also be known as + * a postcode or ZIP code and will vary widely from country to country. + */ +static constexpr const char *kGeoPostalCode = "geo.postal_code"; + +/** + * Region ISO code (ISO 3166-2). + */ +static constexpr const char *kGeoRegionIsoCode = "geo.region.iso_code"; + +namespace GeoContinentCodeValues +{ +/** + * Africa + */ +static constexpr const char *kAf = "AF"; + +/** + * Antarctica + */ +static constexpr const char *kAn = "AN"; + +/** + * Asia + */ +static constexpr const char *kAs = "AS"; + +/** + * Europe + */ +static constexpr const char *kEu = "EU"; + +/** + * North America + */ +static constexpr const char *kNa = "NA"; + +/** + * Oceania + */ +static constexpr const char *kOc = "OC"; + +/** + * South America + */ +static constexpr const char *kSa = "SA"; + +} // namespace GeoContinentCodeValues + +} // namespace geo +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/graphql_attributes.h b/api/include/opentelemetry/semconv/incubating/graphql_attributes.h new file mode 100644 index 0000000000..fe899d1c69 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/graphql_attributes.h @@ -0,0 +1,60 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace graphql +{ + +/** + * The GraphQL document being executed. + *

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

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

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

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

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

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

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

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

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

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

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

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

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

+ * The resend count SHOULD be updated each time an HTTP request gets resent by the client, + * regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 + * Server Unavailable, network issues, or any other). + */ +static constexpr const char *kHttpRequestResendCount = "http.request.resend_count"; + +/** + * The total size of the request in bytes. This should be the total number of bytes sent over the + * wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request + * body if any. + */ +static constexpr const char *kHttpRequestSize = "http.request.size"; + +/** + * Deprecated, use @code http.request.header. @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/api/include/opentelemetry/semconv/incubating/http_metrics.h b/api/include/opentelemetry/semconv/incubating/http_metrics.h new file mode 100644 index 0000000000..9142b6c44f --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/hw_attributes.h b/api/include/opentelemetry/semconv/incubating/hw_attributes.h new file mode 100644 index 0000000000..d87fe1f3db --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/hw_metrics.h b/api/include/opentelemetry/semconv/incubating/hw_metrics.h new file mode 100644 index 0000000000..3a87fd2506 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/k8s_attributes.h b/api/include/opentelemetry/semconv/incubating/k8s_attributes.h new file mode 100644 index 0000000000..ba40b45409 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/k8s_metrics.h b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h new file mode 100644 index 0000000000..2495f0bc70 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h @@ -0,0 +1,505 @@ +/* + * 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); +} + +/** + * Node network errors + *

+ * counter + */ +static constexpr const char *kMetricK8sNodeNetworkErrors = "metric.k8s.node.network.errors"; +static constexpr const char *descrMetricK8sNodeNetworkErrors = "Node network errors"; +static constexpr const char *unitMetricK8sNodeNetworkErrors = "{error}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, + unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, + unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, unitMetricK8sNodeNetworkErrors); +} + +/** + * Network bytes for the Node + *

+ * counter + */ +static constexpr const char *kMetricK8sNodeNetworkIo = "metric.k8s.node.network.io"; +static constexpr const char *descrMetricK8sNodeNetworkIo = "Network bytes for the Node"; +static constexpr const char *unitMetricK8sNodeNetworkIo = "By"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +/** + * The time the Node has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricK8sNodeUptime = "metric.k8s.node.uptime"; +static constexpr const char *descrMetricK8sNodeUptime = "The time the Node has been running"; +static constexpr const char *unitMetricK8sNodeUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + +/** + * 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); +} + +/** + * Pod network errors + *

+ * counter + */ +static constexpr const char *kMetricK8sPodNetworkErrors = "metric.k8s.pod.network.errors"; +static constexpr const char *descrMetricK8sPodNetworkErrors = "Pod network errors"; +static constexpr const char *unitMetricK8sPodNetworkErrors = "{error}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, + unitMetricK8sPodNetworkErrors); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodNetworkErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, + unitMetricK8sPodNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, unitMetricK8sPodNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, unitMetricK8sPodNetworkErrors); +} + +/** + * Network bytes for the Pod + *

+ * counter + */ +static constexpr const char *kMetricK8sPodNetworkIo = "metric.k8s.pod.network.io"; +static constexpr const char *descrMetricK8sPodNetworkIo = "Network bytes for the Pod"; +static constexpr const char *unitMetricK8sPodNetworkIo = "By"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +/** + * The time the Pod has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricK8sPodUptime = "metric.k8s.pod.uptime"; +static constexpr const char *descrMetricK8sPodUptime = "The time the Pod has been running"; +static constexpr const char *unitMetricK8sPodUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + +} // namespace k8s +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/linux_attributes.h b/api/include/opentelemetry/semconv/incubating/linux_attributes.h new file mode 100644 index 0000000000..024e2b60e6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/linux_attributes.h @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace linux +{ + +/** + * The Linux Slab memory state + */ +static constexpr const char *kLinuxMemorySlabState = "linux.memory.slab.state"; + +namespace LinuxMemorySlabStateValues +{ +/** + * none + */ +static constexpr const char *kReclaimable = "reclaimable"; + +/** + * none + */ +static constexpr const char *kUnreclaimable = "unreclaimable"; + +} // namespace LinuxMemorySlabStateValues + +} // namespace linux +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/log_attributes.h b/api/include/opentelemetry/semconv/incubating/log_attributes.h new file mode 100644 index 0000000000..f9224f1bba --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/log_attributes.h @@ -0,0 +1,82 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace log +{ + +/** + * The basename of the file. + */ +static constexpr const char *kLogFileName = "log.file.name"; + +/** + * The basename of the file, with symlinks resolved. + */ +static constexpr const char *kLogFileNameResolved = "log.file.name_resolved"; + +/** + * The full path to the file. + */ +static constexpr const char *kLogFilePath = "log.file.path"; + +/** + * The full path to the file, with symlinks resolved. + */ +static constexpr const char *kLogFilePathResolved = "log.file.path_resolved"; + +/** + * The stream associated with the log. See below for a list of well-known values. + */ +static constexpr const char *kLogIostream = "log.iostream"; + +/** + * The complete 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/api/include/opentelemetry/semconv/incubating/message_attributes.h b/api/include/opentelemetry/semconv/incubating/message_attributes.h new file mode 100644 index 0000000000..508a1e58f6 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/message_attributes.h @@ -0,0 +1,74 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace message +{ + +/** + * Deprecated, use @code rpc.message.compressed_size @endcode instead. + *

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

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

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

+ * @deprecated + * Replaced by @code rpc.message.uncompressed_size @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size"; + +namespace MessageTypeValues +{ +/** + * none + */ +static constexpr const char *kSent = "SENT"; + +/** + * none + */ +static constexpr const char *kReceived = "RECEIVED"; + +} // namespace MessageTypeValues + +} // namespace message +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/messaging_attributes.h b/api/include/opentelemetry/semconv/incubating/messaging_attributes.h new file mode 100644 index 0000000000..4cf20365ab --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/messaging_metrics.h b/api/include/opentelemetry/semconv/incubating/messaging_metrics.h new file mode 100644 index 0000000000..9c29fb86b3 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/net_attributes.h b/api/include/opentelemetry/semconv/incubating/net_attributes.h new file mode 100644 index 0000000000..9562299223 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/net_attributes.h @@ -0,0 +1,209 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace net +{ + +/** + * Deprecated, use @code network.local.address @endcode. + *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ * @deprecated + * Replaced by @code network.transport @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetTransport = "net.transport"; + +namespace NetSockFamilyValues +{ +/** + * IPv4 address + */ +static constexpr const char *kInet = "inet"; + +/** + * IPv6 address + */ +static constexpr const char *kInet6 = "inet6"; + +/** + * Unix domain socket path + */ +static constexpr const char *kUnix = "unix"; + +} // namespace NetSockFamilyValues + +namespace NetTransportValues +{ +/** + * none + */ +static constexpr const char *kIpTcp = "ip_tcp"; + +/** + * none + */ +static constexpr const char *kIpUdp = "ip_udp"; + +/** + * Named or anonymous pipe. + */ +static constexpr const char *kPipe = "pipe"; + +/** + * In-process communication. + */ +static constexpr const char *kInproc = "inproc"; + +/** + * Something else (non IP-based). + */ +static constexpr const char *kOther = "other"; + +} // namespace NetTransportValues + +} // namespace net +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/network_attributes.h b/api/include/opentelemetry/semconv/incubating/network_attributes.h new file mode 100644 index 0000000000..5096937112 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/network_attributes.h @@ -0,0 +1,313 @@ +/* + * 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 interface name. + */ +static constexpr const char *kNetworkInterfaceName = "network.interface.name"; + +/** + * The network IO operation direction. + */ +static constexpr const char *kNetworkIoDirection = "network.io.direction"; + +/** + * Local address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkLocalAddress = "network.local.address"; + +/** + * Local port number of the network connection. + */ +static constexpr const char *kNetworkLocalPort = "network.local.port"; + +/** + * Peer address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkPeerAddress = "network.peer.address"; + +/** + * Peer port number of the network connection. + */ +static constexpr const char *kNetworkPeerPort = "network.peer.port"; + +/** + * OSI application layer or non-OSI + * equivalent.

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

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

The value SHOULD be normalized to lowercase.

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

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

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

+ * The causal relationship between a child Span and a parent Span. + */ +static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; + +namespace OpentracingRefTypeValues +{ +/** + * The parent Span depends on the child Span in some capacity + */ +static constexpr const char *kChildOf = "child_of"; + +/** + * The parent Span doesn't depend in any way on the result of the child Span + */ +static constexpr const char *kFollowsFrom = "follows_from"; + +} // namespace OpentracingRefTypeValues + +} // namespace opentracing +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/os_attributes.h b/api/include/opentelemetry/semconv/incubating/os_attributes.h new file mode 100644 index 0000000000..807deaaf92 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/os_attributes.h @@ -0,0 +1,110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace os +{ + +/** + * Unique identifier for a particular build or compilation of the operating system. + */ +static constexpr const char *kOsBuildId = "os.build_id"; + +/** + * Human readable (not intended to be parsed) OS version information, like e.g. reported by @code + * ver @endcode or @code lsb_release -a @endcode commands. + */ +static constexpr const char *kOsDescription = "os.description"; + +/** + * Human readable operating system name. + */ +static constexpr const char *kOsName = "os.name"; + +/** + * The operating system type. + */ +static constexpr const char *kOsType = "os.type"; + +/** + * The version string of the operating system as defined in Version Attributes. + */ +static constexpr const char *kOsVersion = "os.version"; + +namespace OsTypeValues +{ +/** + * Microsoft Windows + */ +static constexpr const char *kWindows = "windows"; + +/** + * Linux + */ +static constexpr const char *kLinux = "linux"; + +/** + * Apple Darwin + */ +static constexpr const char *kDarwin = "darwin"; + +/** + * FreeBSD + */ +static constexpr const char *kFreebsd = "freebsd"; + +/** + * NetBSD + */ +static constexpr const char *kNetbsd = "netbsd"; + +/** + * OpenBSD + */ +static constexpr const char *kOpenbsd = "openbsd"; + +/** + * DragonFly BSD + */ +static constexpr const char *kDragonflybsd = "dragonflybsd"; + +/** + * HP-UX (Hewlett Packard Unix) + */ +static constexpr const char *kHpux = "hpux"; + +/** + * AIX (Advanced Interactive eXecutive) + */ +static constexpr const char *kAix = "aix"; + +/** + * SunOS, Oracle Solaris + */ +static constexpr const char *kSolaris = "solaris"; + +/** + * IBM z/OS + */ +static constexpr const char *kZOs = "z_os"; + +} // namespace OsTypeValues + +} // namespace os +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/otel_attributes.h b/api/include/opentelemetry/semconv/incubating/otel_attributes.h new file mode 100644 index 0000000000..e3a3251005 --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/other_attributes.h b/api/include/opentelemetry/semconv/incubating/other_attributes.h new file mode 100644 index 0000000000..bc6d26ef16 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/other_attributes.h @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace other +{ + +/** + * Deprecated, use @code db.client.connection.state @endcode instead. + *

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

+ * @deprecated + * Replaced by @code db.client.connection.pool.name @endcode. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kPoolName = "pool.name"; + +} // namespace pool +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/process_attributes.h b/api/include/opentelemetry/semconv/incubating/process_attributes.h new file mode 100644 index 0000000000..f211c3e41a --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/process_attributes.h @@ -0,0 +1,284 @@ +/* + * 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 *kProcessExecutableBuildIdHtlhash = + "process.executable.build_id.htlhash"; + +/** + * "Deprecated, use @code process.executable.build_id.htlhash @endcode instead." + *

+ * @deprecated + * Replaced by @code process.executable.build_id.htlhash @endcode + */ +OPENTELEMETRY_DEPRECATED +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 control group associated with the process. + *

+ * Control groups (cgroups) are a kernel feature used to organize and manage process resources. This + * attribute provides the path(s) to the cgroup(s) associated with the process, which should match + * the contents of the /proc//cgroup file. + */ +static constexpr const char *kProcessLinuxCgroup = "process.linux.cgroup"; + +/** + * 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/api/include/opentelemetry/semconv/incubating/process_metrics.h b/api/include/opentelemetry/semconv/incubating/process_metrics.h new file mode 100644 index 0000000000..a8bb4cb637 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/process_metrics.h @@ -0,0 +1,458 @@ +/* + * 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 a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +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"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricProcessUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); +} + +} // namespace process +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/profile_attributes.h b/api/include/opentelemetry/semconv/incubating/profile_attributes.h new file mode 100644 index 0000000000..076177904f --- /dev/null +++ b/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/api/include/opentelemetry/semconv/incubating/rpc_attributes.h b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h new file mode 100644 index 0000000000..49ba418512 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h @@ -0,0 +1,355 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace rpc +{ + +/** + * The error codes of the Connect + * request. Error codes are always string values. + */ +static constexpr const char *kRpcConnectRpcErrorCode = "rpc.connect_rpc.error_code"; + +/** + * Connect request metadata, @code @endcode being the normalized Connect Metadata key + * (lowercase), the value being the metadata values.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ * @deprecated + * Removed, report shared memory usage with @code metric.system.memory.shared @endcode metric + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kShared = "shared"; + +/** + * none + */ +static constexpr const char *kBuffers = "buffers"; + +/** + * none + */ +static constexpr const char *kCached = "cached"; + +} // namespace SystemMemoryStateValues + +namespace SystemNetworkStateValues +{ +/** + * none + */ +static constexpr const char *kClose = "close"; + +/** + * none + */ +static constexpr const char *kCloseWait = "close_wait"; + +/** + * none + */ +static constexpr const char *kClosing = "closing"; + +/** + * none + */ +static constexpr const char *kDelete = "delete"; + +/** + * none + */ +static constexpr const char *kEstablished = "established"; + +/** + * none + */ +static constexpr const char *kFinWait1 = "fin_wait_1"; + +/** + * none + */ +static constexpr const char *kFinWait2 = "fin_wait_2"; + +/** + * none + */ +static constexpr const char *kLastAck = "last_ack"; + +/** + * none + */ +static constexpr const char *kListen = "listen"; + +/** + * none + */ +static constexpr const char *kSynRecv = "syn_recv"; + +/** + * none + */ +static constexpr const char *kSynSent = "syn_sent"; + +/** + * none + */ +static constexpr const char *kTimeWait = "time_wait"; + +} // namespace SystemNetworkStateValues + +namespace SystemPagingDirectionValues +{ +/** + * none + */ +static constexpr const char *kIn = "in"; + +/** + * none + */ +static constexpr const char *kOut = "out"; + +} // namespace SystemPagingDirectionValues + +namespace SystemPagingStateValues +{ +/** + * none + */ +static constexpr const char *kUsed = "used"; + +/** + * none + */ +static constexpr const char *kFree = "free"; + +} // namespace SystemPagingStateValues + +namespace SystemPagingTypeValues +{ +/** + * none + */ +static constexpr const char *kMajor = "major"; + +/** + * none + */ +static constexpr const char *kMinor = "minor"; + +} // namespace SystemPagingTypeValues + +namespace SystemProcessStatusValues +{ +/** + * none + */ +static constexpr const char *kRunning = "running"; + +/** + * none + */ +static constexpr const char *kSleeping = "sleeping"; + +/** + * none + */ +static constexpr const char *kStopped = "stopped"; + +/** + * none + */ +static constexpr const char *kDefunct = "defunct"; + +} // namespace SystemProcessStatusValues + +namespace SystemProcessesStatusValues +{ +/** + * none + */ +static constexpr const char *kRunning = "running"; + +/** + * none + */ +static constexpr const char *kSleeping = "sleeping"; + +/** + * none + */ +static constexpr const char *kStopped = "stopped"; + +/** + * none + */ +static constexpr const char *kDefunct = "defunct"; + +} // namespace SystemProcessesStatusValues + +} // namespace system +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/system_metrics.h b/api/include/opentelemetry/semconv/incubating/system_metrics.h new file mode 100644 index 0000000000..37ea70a213 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/system_metrics.h @@ -0,0 +1,1326 @@ +/* + * 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); +} + +/** + * The time the system has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricSystemUptime = "metric.system.uptime"; +static constexpr const char *descrMetricSystemUptime = "The time the system has been running"; +static constexpr const char *unitMetricSystemUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + +} // namespace system +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h b/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h new file mode 100644 index 0000000000..5504febaba --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/telemetry_attributes.h @@ -0,0 +1,125 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace telemetry +{ + +/** + * The name of the auto instrumentation agent or distribution, if used. + *

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

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

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

+ * @deprecated + * Replaced by @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/api/include/opentelemetry/semconv/incubating/url_attributes.h b/api/include/opentelemetry/semconv/incubating/url_attributes.h new file mode 100644 index 0000000000..781521fa03 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/url_attributes.h @@ -0,0 +1,172 @@ +/* + * 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.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode: + *

+ *

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code https://www.example.com/path?color=blue&sig=REDACTED @endcode. + */ +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.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode:

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code q=OpenTelemetry&sig=REDACTED @endcode. + */ +static constexpr const char *kUrlQuery = "url.query"; + +/** + * The highest registered url domain, stripped of the subdomain. + *

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

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

This + * value can be determined precisely with the public suffix + * list. + */ +static constexpr const char *kUrlTopLevelDomain = "url.top_level_domain"; + +} // namespace url +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h b/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h new file mode 100644 index 0000000000..1ebffd13ec --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/user_agent_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 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"; + +/** + * Specifies the category of synthetic traffic, such as tests or bots. + *

+ * This attribute MAY be derived from the contents of the @code user_agent.original @endcode + * attribute. Components that populate the attribute are responsible for determining what they + * consider to be synthetic bot or test traffic. This attribute can either be set for + * self-identification purposes, or on telemetry detected to be generated as a result of a synthetic + * request. This attribute is useful for distinguishing between genuine client traffic and synthetic + * traffic generated by bots or tests. + */ +static constexpr const char *kUserAgentSyntheticType = "user_agent.synthetic.type"; + +/** + * 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 UserAgentSyntheticTypeValues +{ +/** + * Bot source. + */ +static constexpr const char *kBot = "bot"; + +/** + * Synthetic test source. + */ +static constexpr const char *kTest = "test"; + +} // namespace UserAgentSyntheticTypeValues + +} // namespace user_agent +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/user_attributes.h b/api/include/opentelemetry/semconv/incubating/user_attributes.h new file mode 100644 index 0000000000..cc5a80d069 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/user_attributes.h @@ -0,0 +1,57 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace user +{ + +/** + * User email address. + */ +static constexpr const char *kUserEmail = "user.email"; + +/** + * User's full name + */ +static constexpr const char *kUserFullName = "user.full_name"; + +/** + * Unique user hash to correlate information for a user in anonymized form. + *

+ * Useful if @code user.id @endcode or @code user.name @endcode contain confidential information and + * cannot be used. + */ +static constexpr const char *kUserHash = "user.hash"; + +/** + * Unique identifier of the user. + */ +static constexpr const char *kUserId = "user.id"; + +/** + * Short name or login/username of the user. + */ +static constexpr const char *kUserName = "user.name"; + +/** + * Array of user roles at the time of the event. + */ +static constexpr const char *kUserRoles = "user.roles"; + +} // namespace user +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h new file mode 100644 index 0000000000..b5f05d38da --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h @@ -0,0 +1,284 @@ +/* + * 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/changelist) if applicable. This is usually a + * unique (within repository) identifier generated by the VCS system. + */ +static constexpr const char *kVcsChangeId = "vcs.change.id"; + +/** + * The state of the change (pull request/merge request/changelist). + */ +static constexpr const char *kVcsChangeState = "vcs.change.state"; + +/** + * The human readable title of the change (pull request/merge request/changelist). 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 *kVcsChangeTitle = "vcs.change.title"; + +/** + * The type of line change being measured on a branch or change. + */ +static constexpr const char *kVcsLineChangeType = "vcs.line_change.type"; + +/** + * The name of the reference such as + * branch or tag in the repository. + */ +static constexpr const char *kVcsRefBaseName = "vcs.ref.base.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.base.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 *kVcsRefBaseRevision = "vcs.ref.base.revision"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRefBaseType = "vcs.ref.base.type"; + +/** + * The name of the reference such as + * branch or tag in the repository. + */ +static constexpr const char *kVcsRefHeadName = "vcs.ref.head.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.head.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 *kVcsRefHeadRevision = "vcs.ref.head.revision"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRefHeadType = "vcs.ref.head.type"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRefType = "vcs.ref.type"; + +/** + * Deprecated, use @code vcs.change.id @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.change.id @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryChangeId = "vcs.repository.change.id"; + +/** + * Deprecated, use @code vcs.change.title @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.change.title @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryChangeTitle = "vcs.repository.change.title"; + +/** + * Deprecated, use @code vcs.ref.head.name @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.name @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryRefName = "vcs.repository.ref.name"; + +/** + * Deprecated, use @code vcs.ref.head.revision @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.revision @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryRefRevision = "vcs.repository.ref.revision"; + +/** + * Deprecated, use @code vcs.ref.head.type @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.type @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +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"; + +/** + * The type of revision comparison. + */ +static constexpr const char *kVcsRevisionDeltaDirection = "vcs.revision_delta.direction"; + +namespace VcsChangeStateValues +{ +/** + * Open means the change is currently active and under review. It hasn't been merged into the target + * branch yet, and it's still possible to make changes or add comments. + */ +static constexpr const char *kOpen = "open"; + +/** + * WIP (work-in-progress, draft) means the change is still in progress and not yet ready for a full + * review. It might still undergo significant changes. + */ +static constexpr const char *kWip = "wip"; + +/** + * Closed means the merge request has been closed without merging. This can happen for various + * reasons, such as the changes being deemed unnecessary, the issue being resolved in another way, + * or the author deciding to withdraw the request. + */ +static constexpr const char *kClosed = "closed"; + +/** + * Merged indicates that the change has been successfully integrated into the target codebase. + */ +static constexpr const char *kMerged = "merged"; + +} // namespace VcsChangeStateValues + +namespace VcsLineChangeTypeValues +{ +/** + * How many lines were added. + */ +static constexpr const char *kAdded = "added"; + +/** + * How many lines were removed. + */ +static constexpr const char *kRemoved = "removed"; + +} // namespace VcsLineChangeTypeValues + +namespace VcsRefBaseTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefBaseTypeValues + +namespace VcsRefHeadTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefHeadTypeValues + +namespace VcsRefTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefTypeValues + +namespace VcsRepositoryRefTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRepositoryRefTypeValues + +namespace VcsRevisionDeltaDirectionValues +{ +/** + * How many revisions the change is behind the target ref. + */ +static constexpr const char *kBehind = "behind"; + +/** + * How many revisions the change is ahead of the target ref. + */ +static constexpr const char *kAhead = "ahead"; + +} // namespace VcsRevisionDeltaDirectionValues + +} // namespace vcs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/vcs_metrics.h b/api/include/opentelemetry/semconv/incubating/vcs_metrics.h new file mode 100644 index 0000000000..ef5749fabe --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/vcs_metrics.h @@ -0,0 +1,394 @@ +/* + * 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 vcs +{ + +/** + * The number of changes (pull requests/merge requests/changelists) in a repository, categorized by + * their state (e.g. open or merged)

updowncounter + */ +static constexpr const char *kMetricVcsChangeCount = "metric.vcs.change.count"; +static constexpr const char *descrMetricVcsChangeCount = + "The number of changes (pull requests/merge requests/changelists) in a repository, categorized " + "by their state (e.g. open or merged)"; +static constexpr const char *unitMetricVcsChangeCount = "{change}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsChangeCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricVcsChangeCount, descrMetricVcsChangeCount, unitMetricVcsChangeCount); +} + +/** + * The time duration a change (pull request/merge request/changelist) has been in a given state. + *

+ * gauge + */ +static constexpr const char *kMetricVcsChangeDuration = "metric.vcs.change.duration"; +static constexpr const char *descrMetricVcsChangeDuration = + "The time duration a change (pull request/merge request/changelist) has been in a given state."; +static constexpr const char *unitMetricVcsChangeDuration = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsChangeDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsChangeDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsChangeDuration(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +/** + * The amount of time since its creation it took a change (pull request/merge request/changelist) to + * get the first approval

gauge + */ +static constexpr const char *kMetricVcsChangeTimeToApproval = "metric.vcs.change.time_to_approval"; +static constexpr const char *descrMetricVcsChangeTimeToApproval = + "The amount of time since its creation it took a change (pull request/merge " + "request/changelist) to get the first approval"; +static constexpr const char *unitMetricVcsChangeTimeToApproval = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsChangeTimeToApproval, descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +/** + * The number of unique contributors to a repository + *

+ * gauge + */ +static constexpr const char *kMetricVcsContributorCount = "metric.vcs.contributor.count"; +static constexpr const char *descrMetricVcsContributorCount = + "The number of unique contributors to a repository"; +static constexpr const char *unitMetricVcsContributorCount = "{contributor}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsContributorCount( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsContributorCount, descrMetricVcsContributorCount, + unitMetricVcsContributorCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsContributorCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsContributorCount, descrMetricVcsContributorCount, + unitMetricVcsContributorCount); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsContributorCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsContributorCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount); +} + +/** + * The number of refs of type branch or tag in a repository + *

+ * updowncounter + */ +static constexpr const char *kMetricVcsRefCount = "metric.vcs.ref.count"; +static constexpr const char *descrMetricVcsRefCount = + "The number of refs of type branch or tag in a repository"; +static constexpr const char *unitMetricVcsRefCount = "{ref}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +/** + * The number of lines added/removed in a ref (branch) relative to the ref from the @code + * vcs.ref.base.name @endcode attribute

This metric should be reported for each @code + * vcs.line_change.type @endcode value. For example if a ref added 3 lines and removed 2 lines, + * instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers). + * If number of lines added/removed should be calculated from the start of time, then @code + * vcs.ref.base.name @endcode SHOULD be set to an empty string.

gauge + */ +static constexpr const char *kMetricVcsRefLinesDelta = "metric.vcs.ref.lines_delta"; +static constexpr const char *descrMetricVcsRefLinesDelta = + "The number of lines added/removed in a ref (branch) relative to the ref from the " + "`vcs.ref.base.name` attribute"; +static constexpr const char *unitMetricVcsRefLinesDelta = "{line}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefLinesDelta( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefLinesDelta( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRefLinesDelta(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRefLinesDelta(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +/** + * The number of revisions (commits) a ref (branch) is ahead/behind the branch from the @code + * vcs.ref.base.name @endcode attribute

This metric should be reported for each @code + * vcs.revision_delta.direction @endcode value. For example if branch @code a @endcode is 3 commits + * behind and 2 commits ahead of @code trunk @endcode, instrumentation SHOULD report two + * measurements: 3 and 2 (both positive numbers) and @code vcs.ref.base.name @endcode is set to + * @code trunk @endcode.

gauge + */ +static constexpr const char *kMetricVcsRefRevisionsDelta = "metric.vcs.ref.revisions_delta"; +static constexpr const char *descrMetricVcsRefRevisionsDelta = + "The number of revisions (commits) a ref (branch) is ahead/behind the branch from the " + "`vcs.ref.base.name` attribute"; +static constexpr const char *unitMetricVcsRefRevisionsDelta = "{revision}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefRevisionsDelta( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, + unitMetricVcsRefRevisionsDelta); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefRevisionsDelta( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, + unitMetricVcsRefRevisionsDelta); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRefRevisionsDelta(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRefRevisionsDelta(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta); +} + +/** + * Time a ref (branch) created from the default branch (trunk) has existed. The @code ref.type + * @endcode attribute will always be @code branch @endcode

gauge + */ +static constexpr const char *kMetricVcsRefTime = "metric.vcs.ref.time"; +static constexpr const char *descrMetricVcsRefTime = + "Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` " + "attribute will always be `branch`"; +static constexpr const char *unitMetricVcsRefTime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime, + unitMetricVcsRefTime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime, + unitMetricVcsRefTime); +} + +/** + * The number of repositories in an organization + *

+ * updowncounter + */ +static constexpr const char *kMetricVcsRepositoryCount = "metric.vcs.repository.count"; +static constexpr const char *descrMetricVcsRepositoryCount = + "The number of repositories in an organization"; +static constexpr const char *unitMetricVcsRepositoryCount = "{repository}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, + unitMetricVcsRepositoryCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, + unitMetricVcsRepositoryCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount); +} + +} // namespace vcs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/webengine_attributes.h b/api/include/opentelemetry/semconv/incubating/webengine_attributes.h new file mode 100644 index 0000000000..16283b43cb --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/webengine_attributes.h @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace webengine +{ + +/** + * Additional description of the web engine (e.g. detailed version and edition information). + */ +static constexpr const char *kWebengineDescription = "webengine.description"; + +/** + * The name of the web engine. + */ +static constexpr const char *kWebengineName = "webengine.name"; + +/** + * The version of the web engine. + */ +static constexpr const char *kWebengineVersion = "webengine.version"; + +} // namespace webengine +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/network_attributes.h b/api/include/opentelemetry/semconv/network_attributes.h new file mode 100644 index 0000000000..832a343a66 --- /dev/null +++ b/api/include/opentelemetry/semconv/network_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 network +{ + +/** + * The network interface name. + */ +static constexpr const char *kNetworkInterfaceName = "network.interface.name"; + +/** + * Local address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkLocalAddress = "network.local.address"; + +/** + * Local port number of the network connection. + */ +static constexpr const char *kNetworkLocalPort = "network.local.port"; + +/** + * Peer address of the network connection - IP address or Unix domain socket name. + */ +static constexpr const char *kNetworkPeerAddress = "network.peer.address"; + +/** + * Peer port number of the network connection. + */ +static constexpr const char *kNetworkPeerPort = "network.peer.port"; + +/** + * OSI application layer or non-OSI + * equivalent.

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

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

The value SHOULD be normalized to lowercase.

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

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

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

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

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

+ * The OpenTelemetry SDK MUST set the @code telemetry.sdk.name @endcode attribute to @code + * opentelemetry @endcode. If another SDK, like a fork or a vendor-provided implementation, is used, + * this SDK MUST set the + * @code telemetry.sdk.name @endcode attribute to the fully-qualified class or module name of this + * SDK's main entry point or another suitable identifier depending on the language. The identifier + * @code opentelemetry @endcode is reserved and MUST NOT be used in this case. All custom + * identifiers SHOULD be stable across different versions of an implementation. + */ +static constexpr const char *kTelemetrySdkName = "telemetry.sdk.name"; + +/** + * The version string of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkVersion = "telemetry.sdk.version"; + +namespace TelemetrySdkLanguageValues +{ +/** + * none + */ +static constexpr const char *kCpp = "cpp"; + +/** + * none + */ +static constexpr const char *kDotnet = "dotnet"; + +/** + * none + */ +static constexpr const char *kErlang = "erlang"; + +/** + * none + */ +static constexpr const char *kGo = "go"; + +/** + * none + */ +static constexpr const char *kJava = "java"; + +/** + * none + */ +static constexpr const char *kNodejs = "nodejs"; + +/** + * none + */ +static constexpr const char *kPhp = "php"; + +/** + * none + */ +static constexpr const char *kPython = "python"; + +/** + * none + */ +static constexpr const char *kRuby = "ruby"; + +/** + * none + */ +static constexpr const char *kRust = "rust"; + +/** + * none + */ +static constexpr const char *kSwift = "swift"; + +/** + * none + */ +static constexpr const char *kWebjs = "webjs"; + +} // namespace TelemetrySdkLanguageValues + +} // namespace telemetry +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/url_attributes.h b/api/include/opentelemetry/semconv/url_attributes.h new file mode 100644 index 0000000000..9a9c2bb671 --- /dev/null +++ b/api/include/opentelemetry/semconv/url_attributes.h @@ -0,0 +1,101 @@ +/* + * 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.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode: + *

+ *

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code https://www.example.com/path?color=blue&sig=REDACTED @endcode. + */ +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.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode:

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code q=OpenTelemetry&sig=REDACTED @endcode. + */ +static constexpr const char *kUrlQuery = "url.query"; + +/** + * The URI scheme component + * identifying the used protocol. + */ +static constexpr const char *kUrlScheme = "url.scheme"; + +} // namespace url +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/user_agent_attributes.h b/api/include/opentelemetry/semconv/user_agent_attributes.h new file mode 100644 index 0000000000..dd1d493278 --- /dev/null +++ b/api/include/opentelemetry/semconv/user_agent_attributes.h @@ -0,0 +1,30 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace user_agent +{ + +/** + * Value of the HTTP + * User-Agent header sent by the client. + */ +static constexpr const char *kUserAgentOriginal = "user_agent.original"; + +} // namespace user_agent +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/trace/default_span.h b/api/include/opentelemetry/trace/default_span.h index 7e3979501e..7ad6a3726e 100644 --- a/api/include/opentelemetry/trace/default_span.h +++ b/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/api/include/opentelemetry/trace/noop.h b/api/include/opentelemetry/trace/noop.h index 345c4ba0c9..fa0c7957df 100644 --- a/api/include/opentelemetry/trace/noop.h +++ b/api/include/opentelemetry/trace/noop.h @@ -7,15 +7,21 @@ // This file is part of the internal implementation of OpenTelemetry. Nothing in this file should be // used directly. Please refer to span.h and tracer.h for documentation on these interfaces. -#include +#include +#include -#include "opentelemetry/context/runtime_context.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context_value.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/nostd/unique_ptr.h" #include "opentelemetry/trace/span.h" #include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_context_kv_iterable.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/span_startoptions.h" #include "opentelemetry/trace/tracer.h" #include "opentelemetry/trace/tracer_provider.h" #include "opentelemetry/version.h" diff --git a/api/include/opentelemetry/trace/propagation/http_trace_context.h b/api/include/opentelemetry/trace/propagation/http_trace_context.h index a6b7e3b219..81d4c308ec 100644 --- a/api/include/opentelemetry/trace/propagation/http_trace_context.h +++ b/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/api/include/opentelemetry/trace/propagation/jaeger.h b/api/include/opentelemetry/trace/propagation/jaeger.h index 1f0195a248..45a9370919 100644 --- a/api/include/opentelemetry/trace/propagation/jaeger.h +++ b/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/api/include/opentelemetry/trace/provider.h b/api/include/opentelemetry/trace/provider.h index d5a52a02f6..1439b579be 100644 --- a/api/include/opentelemetry/trace/provider.h +++ b/api/include/opentelemetry/trace/provider.h @@ -5,18 +5,16 @@ #include -#include "opentelemetry/common/macros.h" #include "opentelemetry/common/spin_lock_mutex.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/trace/noop.h" +#include "opentelemetry/trace/tracer_provider.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace trace { -class TracerProvider; - /** * Stores the singleton global TracerProvider. */ diff --git a/api/include/opentelemetry/trace/scope.h b/api/include/opentelemetry/trace/scope.h index 11ded4ab6c..20c415cc72 100644 --- a/api/include/opentelemetry/trace/scope.h +++ b/api/include/opentelemetry/trace/scope.h @@ -3,9 +3,11 @@ #pragma once +#include "opentelemetry/context/context.h" #include "opentelemetry/context/runtime_context.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/trace/span.h" #include "opentelemetry/trace/span_metadata.h" #include "opentelemetry/version.h" @@ -13,8 +15,6 @@ OPENTELEMETRY_BEGIN_NAMESPACE namespace trace { -class Span; - /** * Controls how long a span is active. * diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index a9290bff44..d6d6591149 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/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 @@ -22,7 +26,7 @@ namespace SemanticConventions /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.26.0"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.27.0"; /** * Uniquely identifies the framework API revision offered by a version ({@code os.version}) of the @@ -31,6 +35,69 @@ static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.26 */ static constexpr const char *kAndroidOsApiLevel = "android.os.api_level"; +/** + * 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. + * + *

Notes: +

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

Notes: +

  • 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"; + /** * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason */ @@ -397,6 +464,12 @@ href="https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.ht */ static constexpr const char *kAwsS3UploadId = "aws.s3.upload_id"; +/** + * 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"; + /** * Array of brand name and version separated by a space * @@ -443,6 +516,39 @@ provides. */ static constexpr const char *kBrowserPlatform = "browser.platform"; +/** + * 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"; + /** * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. @@ -523,7 +629,7 @@ 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 invokable with multiple different +the resolved function version, as the same runtime instance may be invocable with multiple different aliases.
  • GCP: The URI of the resource
  • Azure: The identify Docker @@ -688,26 +789,36 @@ static constexpr const char *kContainerName = "container.name"; */ static constexpr const char *kContainerRuntime = "container.runtime"; +/** + * The mode of the CPU + */ +static constexpr const char *kCpuMode = "cpu.mode"; + /** * 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 {@code server.address} and {@code server.port} attributes formatted as {@code - * server.address:server.port}. + * 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}, {@code server.port}, and {@code db.namespace}, formatted as {@code + * server.address:server.port/db.namespace}. Instrumentations that generate connection pool name + * following different patterns SHOULD document it. */ -static constexpr const char *kDbClientConnectionsPoolName = "db.client.connections.pool.name"; +static constexpr const char *kDbClientConnectionPoolName = "db.client.connection.pool.name"; /** * The state of a connection in the pool */ -static constexpr const char *kDbClientConnectionsState = "db.client.connections.state"; +static constexpr const char *kDbClientConnectionState = "db.client.connection.state"; /** * The name of a collection (table, container) within the database. * *

    Notes: -

    • If the collection name is parsed from the query, it SHOULD match the value provided in -the query and may be qualified with the schema and database name. It is RECOMMENDED to capture the -value as provided by the application without attempting to do any case normalization.
    +
    • 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} SHOULD NOT be captured.
    */ static constexpr const char *kDbCollectionName = "db.collection.name"; @@ -725,17 +836,42 @@ provided by the application without attempting to do any case normalization.
  • batch operation. + * + *

    Notes: +

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

    Notes:

    • It is RECOMMENDED to capture the value as provided by the application without attempting - to do any case normalization.
    +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}, otherwise {@code db.operation.name} SHOULD be {@code BATCH} or some other database system +specific term if more applicable. */ static constexpr const char *kDbOperationName = "db.operation.name"; /** * The database query being executed. + * + *

    Notes: +

    • For sanitization see Sanitization of {@code +db.query.text}. 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 ;} or some other database system specific separator if more +applicable. Even though parameterized query text can potentially have sensitive data, by using a +parameterized query the user is giving a strong signal that any sensitive data will be passed as +parameter values, and the benefit to observability of capturing the static part of the query text by +default outweighs the risk.
    */ static constexpr const char *kDbQueryText = "db.query.text"; @@ -817,11 +953,6 @@ static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; */ static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; -/** - * Represents the identifier of an Elasticsearch cluster. - */ -static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; - /** * Represents the human-readable identifier of the node/instance to which a request was routed. */ @@ -832,15 +963,30 @@ static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.n environment (aka deployment tier). * *

    Notes: -

    • {@code deployment.environment} does not affect the uniqueness constraints defined through -the {@code service.namespace}, {@code service.name} and {@code service.instance.id} resource +
      • {@code deployment.environment.name} does not affect the uniqueness constraints defined +through the {@code service.namespace}, {@code service.name} and {@code service.instance.id} resource attributes. This implies that resources carrying the following attribute combinations MUST be considered to be identifying the same service:
      • {@code service.name=frontend}, {@code -deployment.environment=production}
      • {@code service.name=frontend}, {@code -deployment.environment=staging}.
      • +deployment.environment.name=production}
      • {@code service.name=frontend}, {@code +deployment.environment.name=staging}.
      */ -static constexpr const char *kDeploymentEnvironment = "deployment.environment"; +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"; /** * Deprecated use the {@code device.app.lifecycle} event definition including {@code android.state} @@ -853,6 +999,14 @@ static constexpr const char *kDeploymentEnvironment = "deployment.environment"; */ static constexpr const char *kAndroidState = "android.state"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kContainerCpuState = "container.cpu.state"; + /** * Deprecated, use {@code db.collection.name} instead. * @@ -877,6 +1031,14 @@ static constexpr const char *kDbConnectionString = "db.connection_string"; OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; +/** + * Deprecated, use {@code db.namespace} instead. + * + * @deprecated Deprecated, use `db.namespace` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; + /** * Deprecated, no general replacement at this time. For Elasticsearch, use {@code * db.elasticsearch.node.name} instead. @@ -961,21 +1123,85 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbUser = "db.user"; /** - * Deprecated, use {@code db.client.connections.pool.name} instead. + * Deprecated, use {@code db.client.connection.pool.name} instead. + * + * @deprecated Deprecated, use `db.client.connection.pool.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsPoolName = "db.client.connections.pool.name"; + +/** + * Deprecated, use {@code db.client.connection.state} instead. + * + * @deprecated Deprecated, use `db.client.connection.state` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsState = "db.client.connections.state"; + +/** + * Deprecated, use {@code db.client.connection.pool.name} instead. * - * @deprecated Deprecated, use `db.client.connections.pool.name` instead. + * @deprecated Deprecated, use `db.client.connection.pool.name` instead. */ OPENTELEMETRY_DEPRECATED static constexpr const char *kPoolName = "pool.name"; /** - * Deprecated, use {@code db.client.connections.state} instead. + * Deprecated, use {@code db.client.connection.state} instead. * - * @deprecated Deprecated, use `db.client.connections.state` instead. + * @deprecated Deprecated, use `db.client.connection.state` instead. */ OPENTELEMETRY_DEPRECATED static constexpr const char *kState = "state"; +/** + * 'Deprecated, use {@code deployment.environment.name} instead.' + * + * @deprecated 'Deprecated, use `deployment.environment.name` instead.'. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDeploymentEnvironment = "deployment.environment"; + +/** + * Deprecated, use {@code user.id} instead. + * + * @deprecated Deprecated, use `user.id` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserId = "enduser.id"; + +/** + * Deprecated, use {@code user.roles} instead. + * + * @deprecated Deprecated, use `user.roles` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserRole = "enduser.role"; + +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserScope = "enduser.scope"; + +/** + * Deprecated, use {@code gen_ai.usage.output_tokens} instead. + * + * @deprecated Deprecated, use `gen_ai.usage.output_tokens` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsageCompletionTokens = "gen_ai.usage.completion_tokens"; + +/** + * Deprecated, use {@code gen_ai.usage.input_tokens} instead. + * + * @deprecated Deprecated, use `gen_ai.usage.input_tokens` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsagePromptTokens = "gen_ai.usage.prompt_tokens"; + /** * Deprecated, use {@code client.address} instead. * @@ -1107,6 +1333,41 @@ static constexpr const char *kHttpUserAgent = "http.user_agent"; OPENTELEMETRY_DEPRECATED static constexpr const char *kIosState = "ios.state"; +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishAnonymous = + "messaging.destination_publish.anonymous"; + +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishName = + "messaging.destination_publish.name"; + +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingEventhubsConsumerGroup = + "messaging.eventhubs.consumer.group"; + +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.consumer.group"; + /** * Deprecated, use {@code messaging.destination.partition.id} instead. * @@ -1116,6 +1377,14 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingKafkaDestinationPartition = "messaging.kafka.destination.partition"; +/** + * Deprecated, use {@code messaging.kafka.offset} instead. + * + * @deprecated Deprecated, use `messaging.kafka.offset` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaMessageOffset = "messaging.kafka.message.offset"; + /** * Deprecated, use {@code messaging.operation.type} instead. * @@ -1124,6 +1393,23 @@ static constexpr const char *kMessagingKafkaDestinationPartition = OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingOperation = "messaging.operation"; +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingRocketmqClientGroup = "messaging.rocketmq.client_group"; + +/** + * Deprecated, use {@code messaging.servicebus.destination.subscription_name} instead. + * + * @deprecated Deprecated, use `messaging.servicebus.destination.subscription_name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingServicebusDestinationSubscriptionName = + "messaging.servicebus.destination.subscription_name"; + /** * Deprecated, use {@code network.local.address}. * @@ -1247,21 +1533,29 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kNetTransport = "net.transport"; /** - * None * - * @deprecated None. + * + * @deprecated . */ OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryName = "otel.library.name"; /** - * None * - * @deprecated None. + * + * @deprecated . */ OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryVersion = "otel.library.version"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kProcessCpuState = "process.cpu.state"; + /** * Deprecated, use {@code rpc.message.compressed_size} instead. * @@ -1294,6 +1588,14 @@ static constexpr const char *kMessageType = "message.type"; OPENTELEMETRY_DEPRECATED static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kSystemCpuState = "system.cpu.state"; + /** * Deprecated, use {@code system.process.status} instead. * @@ -1302,6 +1604,14 @@ static constexpr const char *kMessageUncompressedSize = "message.uncompressed_si OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemProcessesStatus = "system.processes.status"; +/** + * Deprecated, use {@code server.address} instead. + * + * @deprecated Deprecated, use `server.address` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kTlsClientServerName = "tls.client.server_name"; + /** * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. @@ -1380,29 +1690,6 @@ static constexpr const char *kDiskIoDirection = "disk.io.direction"; */ static constexpr const char *kDnsQuestionName = "dns.question.name"; -/** - * Username or client_id extracted from the access token or Authorization header in the inbound - * request from outside the system. - */ -static constexpr const char *kEnduserId = "enduser.id"; - -/** - * Actual/assumed role the client is making the request under extracted from token or application - * security context. - */ -static constexpr const char *kEnduserRole = "enduser.role"; - -/** - * Scopes or granted authorities the client currently possesses extracted from token or application - * security context. The value would come from the scope associated with an OAuth 2.0 Access Token or an attribute - * value in a SAML 2.0 - * Assertion. - */ -static constexpr const char *kEnduserScope = "enduser.scope"; - /** * Describes a class of error the operation ended with. * @@ -1428,9 +1715,9 @@ static constexpr const char *kErrorType = "error.type"; * *

      Notes:

      • 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.
      + href="/docs/general/attribute-naming.md">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"; @@ -1665,6 +1952,16 @@ static constexpr const char *kFilePath = "file.path"; */ static constexpr const char *kFileSize = "file.size"; +/** + * Identifies the Google Cloud service for which the official client library is intended. + * + *

    Notes: +

    • 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 @@ -1697,7 +1994,7 @@ static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostnam static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; /** - * The full response received from the LLM. + * The full response received from the GenAI model. * *

    Notes:

    */ static constexpr const char *kDbOperationName = "db.operation.name"; /** * The database query being executed. + * + *

    Notes: +

    • For sanitization see Sanitization of {@code +db.query.text}. 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 ;} or some other database system specific separator if more +applicable. Even though parameterized query text can potentially have sensitive data, by using a +parameterized query the user is giving a strong signal that any sensitive data will be passed as +parameter values, and the benefit to observability of capturing the static part of the query text by +default outweighs the risk.
    */ static constexpr const char *kDbQueryText = "db.query.text"; @@ -819,11 +955,6 @@ static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; */ static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; -/** - * Represents the identifier of an Elasticsearch cluster. - */ -static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; - /** * Represents the human-readable identifier of the node/instance to which a request was routed. */ @@ -834,15 +965,30 @@ static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.n environment (aka deployment tier). * *

    Notes: -

    • {@code deployment.environment} does not affect the uniqueness constraints defined through -the {@code service.namespace}, {@code service.name} and {@code service.instance.id} resource +
      • {@code deployment.environment.name} does not affect the uniqueness constraints defined +through the {@code service.namespace}, {@code service.name} and {@code service.instance.id} resource attributes. This implies that resources carrying the following attribute combinations MUST be considered to be identifying the same service:
      • {@code service.name=frontend}, {@code -deployment.environment=production}
      • {@code service.name=frontend}, {@code -deployment.environment=staging}.
      • +deployment.environment.name=production}
      • {@code service.name=frontend}, {@code +deployment.environment.name=staging}.
      */ -static constexpr const char *kDeploymentEnvironment = "deployment.environment"; +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"; /** * Deprecated use the {@code device.app.lifecycle} event definition including {@code android.state} @@ -855,6 +1001,14 @@ static constexpr const char *kDeploymentEnvironment = "deployment.environment"; */ static constexpr const char *kAndroidState = "android.state"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kContainerCpuState = "container.cpu.state"; + /** * Deprecated, use {@code db.collection.name} instead. * @@ -879,6 +1033,14 @@ static constexpr const char *kDbConnectionString = "db.connection_string"; OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; +/** + * Deprecated, use {@code db.namespace} instead. + * + * @deprecated Deprecated, use `db.namespace` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; + /** * Deprecated, no general replacement at this time. For Elasticsearch, use {@code * db.elasticsearch.node.name} instead. @@ -963,21 +1125,85 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbUser = "db.user"; /** - * Deprecated, use {@code db.client.connections.pool.name} instead. + * Deprecated, use {@code db.client.connection.pool.name} instead. + * + * @deprecated Deprecated, use `db.client.connection.pool.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsPoolName = "db.client.connections.pool.name"; + +/** + * Deprecated, use {@code db.client.connection.state} instead. + * + * @deprecated Deprecated, use `db.client.connection.state` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDbClientConnectionsState = "db.client.connections.state"; + +/** + * Deprecated, use {@code db.client.connection.pool.name} instead. * - * @deprecated Deprecated, use `db.client.connections.pool.name` instead. + * @deprecated Deprecated, use `db.client.connection.pool.name` instead. */ OPENTELEMETRY_DEPRECATED static constexpr const char *kPoolName = "pool.name"; /** - * Deprecated, use {@code db.client.connections.state} instead. + * Deprecated, use {@code db.client.connection.state} instead. * - * @deprecated Deprecated, use `db.client.connections.state` instead. + * @deprecated Deprecated, use `db.client.connection.state` instead. */ OPENTELEMETRY_DEPRECATED static constexpr const char *kState = "state"; +/** + * 'Deprecated, use {@code deployment.environment.name} instead.' + * + * @deprecated 'Deprecated, use `deployment.environment.name` instead.'. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kDeploymentEnvironment = "deployment.environment"; + +/** + * Deprecated, use {@code user.id} instead. + * + * @deprecated Deprecated, use `user.id` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserId = "enduser.id"; + +/** + * Deprecated, use {@code user.roles} instead. + * + * @deprecated Deprecated, use `user.roles` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserRole = "enduser.role"; + +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kEnduserScope = "enduser.scope"; + +/** + * Deprecated, use {@code gen_ai.usage.output_tokens} instead. + * + * @deprecated Deprecated, use `gen_ai.usage.output_tokens` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsageCompletionTokens = "gen_ai.usage.completion_tokens"; + +/** + * Deprecated, use {@code gen_ai.usage.input_tokens} instead. + * + * @deprecated Deprecated, use `gen_ai.usage.input_tokens` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kGenAiUsagePromptTokens = "gen_ai.usage.prompt_tokens"; + /** * Deprecated, use {@code client.address} instead. * @@ -1109,6 +1335,41 @@ static constexpr const char *kHttpUserAgent = "http.user_agent"; OPENTELEMETRY_DEPRECATED static constexpr const char *kIosState = "ios.state"; +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishAnonymous = + "messaging.destination_publish.anonymous"; + +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingDestinationPublishName = + "messaging.destination_publish.name"; + +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingEventhubsConsumerGroup = + "messaging.eventhubs.consumer.group"; + +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.consumer.group"; + /** * Deprecated, use {@code messaging.destination.partition.id} instead. * @@ -1118,6 +1379,14 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingKafkaDestinationPartition = "messaging.kafka.destination.partition"; +/** + * Deprecated, use {@code messaging.kafka.offset} instead. + * + * @deprecated Deprecated, use `messaging.kafka.offset` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingKafkaMessageOffset = "messaging.kafka.message.offset"; + /** * Deprecated, use {@code messaging.operation.type} instead. * @@ -1126,6 +1395,23 @@ static constexpr const char *kMessagingKafkaDestinationPartition = OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingOperation = "messaging.operation"; +/** + * Deprecated, use {@code messaging.consumer.group.name} instead. + * + * @deprecated Deprecated, use `messaging.consumer.group.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingRocketmqClientGroup = "messaging.rocketmq.client_group"; + +/** + * Deprecated, use {@code messaging.servicebus.destination.subscription_name} instead. + * + * @deprecated Deprecated, use `messaging.servicebus.destination.subscription_name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kMessagingServicebusDestinationSubscriptionName = + "messaging.servicebus.destination.subscription_name"; + /** * Deprecated, use {@code network.local.address}. * @@ -1249,21 +1535,29 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kNetTransport = "net.transport"; /** - * None * - * @deprecated None. + * + * @deprecated . */ OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryName = "otel.library.name"; /** - * None * - * @deprecated None. + * + * @deprecated . */ OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryVersion = "otel.library.version"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kProcessCpuState = "process.cpu.state"; + /** * Deprecated, use {@code rpc.message.compressed_size} instead. * @@ -1296,6 +1590,14 @@ static constexpr const char *kMessageType = "message.type"; OPENTELEMETRY_DEPRECATED static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size"; +/** + * Deprecated, use {@code cpu.mode} instead. + * + * @deprecated Deprecated, use `cpu.mode` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kSystemCpuState = "system.cpu.state"; + /** * Deprecated, use {@code system.process.status} instead. * @@ -1304,6 +1606,14 @@ static constexpr const char *kMessageUncompressedSize = "message.uncompressed_si OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemProcessesStatus = "system.processes.status"; +/** + * Deprecated, use {@code server.address} instead. + * + * @deprecated Deprecated, use `server.address` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kTlsClientServerName = "tls.client.server_name"; + /** * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. @@ -1382,29 +1692,6 @@ static constexpr const char *kDiskIoDirection = "disk.io.direction"; */ static constexpr const char *kDnsQuestionName = "dns.question.name"; -/** - * Username or client_id extracted from the access token or Authorization header in the inbound - * request from outside the system. - */ -static constexpr const char *kEnduserId = "enduser.id"; - -/** - * Actual/assumed role the client is making the request under extracted from token or application - * security context. - */ -static constexpr const char *kEnduserRole = "enduser.role"; - -/** - * Scopes or granted authorities the client currently possesses extracted from token or application - * security context. The value would come from the scope associated with an OAuth 2.0 Access Token or an attribute - * value in a SAML 2.0 - * Assertion. - */ -static constexpr const char *kEnduserScope = "enduser.scope"; - /** * Describes a class of error the operation ended with. * @@ -1430,9 +1717,9 @@ static constexpr const char *kErrorType = "error.type"; * *

      Notes:

      • 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.
      + href="/docs/general/attribute-naming.md">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"; @@ -1667,6 +1954,16 @@ static constexpr const char *kFilePath = "file.path"; */ static constexpr const char *kFileSize = "file.size"; +/** + * Identifies the Google Cloud service for which the official client library is intended. + * + *

    Notes: +

    • 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 @@ -1699,7 +1996,7 @@ static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostnam static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; /** - * The full response received from the LLM. + * The full response received from the GenAI model. * *

    Notes:

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

      Notes:

      • It's RECOMMENDED to format prompts as JSON string matching Notes: -
        • 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} is set to - {@code openai} based on the instrumentation's best knowledge.
        +
        • The {@code gen_ai.system} describes a family of GenAI models with specific model +identified by {@code gen_ai.request.model} and {@code gen_ai.response.model} 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} is set to {@code +openai} 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} SHOULD be set to +{@code _OTHER}.
        */ static constexpr const char *kGenAiSystem = "gen_ai.system"; /** - * The number of tokens used in the LLM response (completion). + * The type of token being counted. */ -static constexpr const char *kGenAiUsageCompletionTokens = "gen_ai.usage.completion_tokens"; +static constexpr const char *kGenAiTokenType = "gen_ai.token.type"; /** - * The number of tokens used in the LLM prompt. + * The number of tokens used in the GenAI input (prompt). */ -static constexpr const char *kGenAiUsagePromptTokens = "gen_ai.usage.prompt_tokens"; +static constexpr const char *kGenAiUsageInputTokens = "gen_ai.usage.input_tokens"; /** - * The GraphQL document being executed. - * - *

        Notes: -

        • The value may be sanitized to exclude sensitive information.
        + * The number of tokens used in the GenAI response (completion). */ -static constexpr const char *kGraphqlDocument = "graphql.document"; +static constexpr const char *kGenAiUsageOutputTokens = "gen_ai.usage.output_tokens"; + +/** + * The type of memory. + */ +static constexpr const char *kGoMemoryType = "go.memory.type"; + +/** + * The GraphQL document being executed. + * + *

        Notes: +

        • The value may be sanitized to exclude sensitive information.
        + */ +static constexpr const char *kGraphqlDocument = "graphql.document"; /** * The name of the operation being executed. @@ -2178,6 +2520,11 @@ static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name"; */ static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid"; +/** + * The Linux Slab memory state + */ +static constexpr const char *kLinuxMemorySlabState = "linux.memory.slab.state"; + /** * The stream associated with the log. See below for a list of well-known values. */ @@ -2203,6 +2550,16 @@ static constexpr const char *kLogFilePath = "log.file.path"; */ static constexpr const char *kLogFilePathResolved = "log.file.path_resolved"; +/** + * The complete orignal Log Record. + * + *

        Notes: +

        • 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. * @@ -2231,6 +2588,16 @@ static constexpr const char *kMessagingBatchMessageCount = "messaging.batch.mess */ static constexpr const char *kMessagingClientId = "messaging.client.id"; +/** + * The name of the consumer group with which a consumer is associated. + * + *

        Notes: +

        • Semantic conventions for individual messaging systems SHOULD document whether {@code + messaging.consumer.group.name} 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). @@ -2254,6 +2621,17 @@ static constexpr const char *kMessagingDestinationName = "messaging.destination. static constexpr const char *kMessagingDestinationPartitionId = "messaging.destination.partition.id"; +/** + * The name of the destination subscription from which a message is consumed. + * + *

        Notes: +

        • Semantic conventions for individual messaging systems SHOULD document whether {@code + messaging.destination.subscription.name} 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 * @@ -2271,24 +2649,6 @@ static constexpr const char *kMessagingDestinationTemplate = "messaging.destinat */ static constexpr const char *kMessagingDestinationTemporary = "messaging.destination.temporary"; -/** - * A boolean that is true if the publish message destination is anonymous (could be unnamed or have - * auto-generated name). - */ -static constexpr const char *kMessagingDestinationPublishAnonymous = - "messaging.destination_publish.anonymous"; - -/** - * The name of the original destination the message was published to - * - *

        Notes: -

        • The name SHOULD uniquely identify a specific queue, topic, or other entity within the -broker. If the broker doesn't have such notion, the original destination name SHOULD uniquely -identify the broker.
        - */ -static constexpr const char *kMessagingDestinationPublishName = - "messaging.destination_publish.name"; - /** * The size of the message body in bytes. * @@ -2341,12 +2701,6 @@ static constexpr const char *kMessagingOperationType = "messaging.operation.type */ static constexpr const char *kMessagingSystem = "messaging.system"; -/** - * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not - * producers. - */ -static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.consumer.group"; - /** * 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} in that they're not unique. If the @@ -2360,14 +2714,14 @@ static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.con static constexpr const char *kMessagingKafkaMessageKey = "messaging.kafka.message.key"; /** - * The offset of a record in the corresponding Kafka partition. + * A boolean that is true if the message is a tombstone. */ -static constexpr const char *kMessagingKafkaMessageOffset = "messaging.kafka.message.offset"; +static constexpr const char *kMessagingKafkaMessageTombstone = "messaging.kafka.message.tombstone"; /** - * A boolean that is true if the message is a tombstone. + * The offset of a record in the corresponding Kafka partition. */ -static constexpr const char *kMessagingKafkaMessageTombstone = "messaging.kafka.message.tombstone"; +static constexpr const char *kMessagingKafkaOffset = "messaging.kafka.offset"; /** * RabbitMQ message routing key. @@ -2381,12 +2735,6 @@ static constexpr const char *kMessagingRabbitmqDestinationRoutingKey = static constexpr const char *kMessagingRabbitmqMessageDeliveryTag = "messaging.rabbitmq.message.delivery_tag"; -/** - * Name of the RocketMQ producer/consumer group that is handling the message. The client type is - * identified by the SpanKind. - */ -static constexpr const char *kMessagingRocketmqClientGroup = "messaging.rocketmq.client_group"; - /** * Model of message consumption. This only applies to consumer spans. */ @@ -2456,12 +2804,6 @@ static constexpr const char *kMessagingGcpPubsubMessageDeliveryAttempt = static constexpr const char *kMessagingGcpPubsubMessageOrderingKey = "messaging.gcp_pubsub.message.ordering_key"; -/** - * The name of the subscription in the topic messages are received from. - */ -static constexpr const char *kMessagingServicebusDestinationSubscriptionName = - "messaging.servicebus.destination.subscription_name"; - /** * Describes the
        settlement @@ -2482,12 +2824,6 @@ static constexpr const char *kMessagingServicebusMessageDeliveryCount = static constexpr const char *kMessagingServicebusMessageEnqueuedTime = "messaging.servicebus.message.enqueued_time"; -/** - * The name of the consumer group the event consumer is associated with. - */ -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. */ @@ -2771,8 +3107,7 @@ static constexpr const char *kProcessRealUserName = "process.real_user.name"; static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; /** - * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of - * the compiler. + * The name of the runtime of this process. */ static constexpr const char *kProcessRuntimeName = "process.runtime.name"; @@ -2816,11 +3151,6 @@ static constexpr const char *kProcessUserName = "process.user.name"; */ static constexpr const char *kProcessVpid = "process.vpid"; -/** - * The CPU state of the process. - */ -static constexpr const char *kProcessCpuState = "process.cpu.state"; - /** * The error codes of the Connect * request. Error codes are always string values. @@ -3040,11 +3370,6 @@ static constexpr const char *kSystemDevice = "system.device"; */ static constexpr const char *kSystemCpuLogicalNumber = "system.cpu.logical_number"; -/** - * The state of the CPU - */ -static constexpr const char *kSystemCpuState = "system.cpu.state"; - /** * The memory state */ @@ -3136,6 +3461,27 @@ static constexpr const char *kTelemetryDistroName = "telemetry.distro.name"; */ static constexpr const char *kTelemetryDistroVersion = "telemetry.distro.version"; +/** + * 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"; + /** * Current "managed" thread ID (as opposed to OS thread ID). */ @@ -3215,12 +3561,6 @@ static constexpr const char *kTlsClientNotAfter = "tls.client.not_after"; */ static constexpr const char *kTlsClientNotBefore = "tls.client.not_before"; -/** - * Also called an SNI, this tells the server which hostname to which the client is attempting to - * connect to. - */ -static constexpr const char *kTlsClientServerName = "tls.client.server_name"; - /** * Distinguished name of subject of the x.509 certificate presented by the client. */ @@ -3483,6 +3823,102 @@ static constexpr const char *kUserAgentOriginal = "user_agent.original"; */ static constexpr const char *kUserAgentVersion = "user_agent.version"; +/** + * 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. + * + *

        Notes: +

        • Useful if {@code user.id} or {@code user.name} 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"; + +/** + * The type of garbage collection. + */ +static constexpr const char *kV8jsGcType = "v8js.gc.type"; + +/** + * The name of the space type of heap memory. + * + *

        Notes: +

        + */ +static constexpr const char *kV8jsHeapSpaceName = "v8js.heap.space.name"; + +/** + * 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. + * + *

        Notes: +

        • 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}, 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"; + /** * Additional description of the web engine (e.g. detailed version and edition information). */ @@ -3539,6 +3975,16 @@ static constexpr const char *kEc2 = "ec2"; static constexpr const char *kFargate = "fargate"; } // namespace AwsEcsLaunchtypeValues +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 CloudPlatformValues { /** Alibaba Cloud Elastic Compute Service. */ @@ -3617,132 +4063,144 @@ static constexpr const char *kIbmCloud = "ibm_cloud"; static constexpr const char *kTencentCloud = "tencent_cloud"; } // namespace CloudProviderValues -namespace ContainerCpuStateValues +namespace CpuModeValues { -/** When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode - * (Windows). */ +/** user. */ static constexpr const char *kUser = "user"; -/** When CPU is used by the system (host OS). */ +/** system. */ 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). */ +/** nice. */ +static constexpr const char *kNice = "nice"; +/** idle. */ +static constexpr const char *kIdle = "idle"; +/** iowait. */ +static constexpr const char *kIowait = "iowait"; +/** interrupt. */ +static constexpr const char *kInterrupt = "interrupt"; +/** steal. */ +static constexpr const char *kSteal = "steal"; +/** kernel. */ static constexpr const char *kKernel = "kernel"; -} // namespace ContainerCpuStateValues +} // namespace CpuModeValues -namespace DbClientConnectionsStateValues +namespace DbClientConnectionStateValues { /** idle. */ static constexpr const char *kIdle = "idle"; /** used. */ static constexpr const char *kUsed = "used"; -} // namespace DbClientConnectionsStateValues +} // namespace DbClientConnectionStateValues namespace DbSystemValues { /** Some other SQL database. Fallback only. See notes. */ static constexpr const char *kOtherSql = "other_sql"; -/** Microsoft SQL Server. */ -static constexpr const char *kMssql = "mssql"; -/** Microsoft SQL Server Compact. */ -static constexpr const char *kMssqlcompact = "mssqlcompact"; -/** MySQL. */ -static constexpr const char *kMysql = "mysql"; -/** Oracle Database. */ -static constexpr const char *kOracle = "oracle"; -/** IBM Db2. */ -static constexpr const char *kDb2 = "db2"; -/** PostgreSQL. */ -static constexpr const char *kPostgresql = "postgresql"; -/** Amazon Redshift. */ -static constexpr const char *kRedshift = "redshift"; -/** Apache Hive. */ -static constexpr const char *kHive = "hive"; -/** Cloudscape. */ -static constexpr const char *kCloudscape = "cloudscape"; -/** HyperSQL DataBase. */ -static constexpr const char *kHsqldb = "hsqldb"; -/** Progress Database. */ -static constexpr const char *kProgress = "progress"; -/** SAP MaxDB. */ -static constexpr const char *kMaxdb = "maxdb"; -/** SAP HANA. */ -static constexpr const char *kHanadb = "hanadb"; -/** Ingres. */ -static constexpr const char *kIngres = "ingres"; -/** FirstSQL. */ -static constexpr const char *kFirstsql = "firstsql"; -/** EnterpriseDB. */ -static constexpr const char *kEdb = "edb"; -/** InterSystems Caché. */ -static constexpr const char *kCache = "cache"; /** Adabas (Adaptable Database System). */ static constexpr const char *kAdabas = "adabas"; -/** Firebird. */ -static constexpr const char *kFirebird = "firebird"; +/** Deprecated, use `intersystems_cache` instead. */ +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 `other_sql` instead. */ +static constexpr const char *kCloudscape = "cloudscape"; +/** CockroachDB. */ +static constexpr const char *kCockroachdb = "cockroachdb"; +/** Deprecated, no replacement at this time. */ +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 `other_sql` instead. */ +static constexpr const char *kFirstsql = "firstsql"; +/** Apache Geode. */ +static constexpr const char *kGeode = "geode"; +/** H2. */ +static constexpr const char *kH2 = "h2"; +/** SAP HANA. */ +static constexpr const char *kHanadb = "hanadb"; +/** Apache HBase. */ +static constexpr const char *kHbase = "hbase"; +/** Apache Hive. */ +static constexpr const char *kHive = "hive"; +/** HyperSQL DataBase. */ +static constexpr const char *kHsqldb = "hsqldb"; +/** InfluxDB. */ +static constexpr const char *kInfluxdb = "influxdb"; /** Informix. */ static constexpr const char *kInformix = "informix"; +/** Ingres. */ +static constexpr const char *kIngres = "ingres"; /** InstantDB. */ static constexpr const char *kInstantdb = "instantdb"; /** InterBase. */ static constexpr const char *kInterbase = "interbase"; /** MariaDB. */ static constexpr const char *kMariadb = "mariadb"; +/** SAP MaxDB. */ +static constexpr const char *kMaxdb = "maxdb"; +/** Memcached. */ +static constexpr const char *kMemcached = "memcached"; +/** MongoDB. */ +static constexpr const char *kMongodb = "mongodb"; +/** Microsoft SQL Server. */ +static constexpr const char *kMssql = "mssql"; +/** Deprecated, Microsoft SQL Server Compact is discontinued. */ +static constexpr const char *kMssqlcompact = "mssqlcompact"; +/** MySQL. */ +static constexpr const char *kMysql = "mysql"; +/** Neo4j. */ +static constexpr const char *kNeo4j = "neo4j"; /** Netezza. */ static constexpr const char *kNetezza = "netezza"; +/** OpenSearch. */ +static constexpr const char *kOpensearch = "opensearch"; +/** Oracle Database. */ +static constexpr const char *kOracle = "oracle"; /** Pervasive PSQL. */ static constexpr const char *kPervasive = "pervasive"; /** PointBase. */ static constexpr const char *kPointbase = "pointbase"; +/** PostgreSQL. */ +static constexpr const char *kPostgresql = "postgresql"; +/** Progress Database. */ +static constexpr const char *kProgress = "progress"; +/** Redis. */ +static constexpr const char *kRedis = "redis"; +/** Amazon Redshift. */ +static constexpr const char *kRedshift = "redshift"; +/** Cloud Spanner. */ +static constexpr const char *kSpanner = "spanner"; /** SQLite. */ static constexpr const char *kSqlite = "sqlite"; /** Sybase. */ static constexpr const char *kSybase = "sybase"; /** Teradata. */ static constexpr const char *kTeradata = "teradata"; -/** Vertica. */ -static constexpr const char *kVertica = "vertica"; -/** H2. */ -static constexpr const char *kH2 = "h2"; -/** ColdFusion IMQ. */ -static constexpr const char *kColdfusion = "coldfusion"; -/** Apache Cassandra. */ -static constexpr const char *kCassandra = "cassandra"; -/** Apache HBase. */ -static constexpr const char *kHbase = "hbase"; -/** MongoDB. */ -static constexpr const char *kMongodb = "mongodb"; -/** Redis. */ -static constexpr const char *kRedis = "redis"; -/** Couchbase. */ -static constexpr const char *kCouchbase = "couchbase"; -/** CouchDB. */ -static constexpr const char *kCouchdb = "couchdb"; -/** Microsoft Azure Cosmos DB. */ -static constexpr const char *kCosmosdb = "cosmosdb"; -/** Amazon DynamoDB. */ -static constexpr const char *kDynamodb = "dynamodb"; -/** Neo4j. */ -static constexpr const char *kNeo4j = "neo4j"; -/** Apache Geode. */ -static constexpr const char *kGeode = "geode"; -/** Elasticsearch. */ -static constexpr const char *kElasticsearch = "elasticsearch"; -/** Memcached. */ -static constexpr const char *kMemcached = "memcached"; -/** CockroachDB. */ -static constexpr const char *kCockroachdb = "cockroachdb"; -/** OpenSearch. */ -static constexpr const char *kOpensearch = "opensearch"; -/** ClickHouse. */ -static constexpr const char *kClickhouse = "clickhouse"; -/** Cloud Spanner. */ -static constexpr const char *kSpanner = "spanner"; /** Trino. */ static constexpr const char *kTrino = "trino"; +/** Vertica. */ +static constexpr const char *kVertica = "vertica"; } // namespace DbSystemValues namespace DbCassandraConsistencyLevelValues @@ -3813,6 +4271,14 @@ static constexpr const char *kQueryPlan = "QueryPlan"; static constexpr const char *kExecuteJavascript = "ExecuteJavaScript"; } // namespace DbCosmosdbOperationTypeValues +namespace DeploymentStatusValues +{ +/** failed. */ +static constexpr const char *kFailed = "failed"; +/** succeeded. */ +static constexpr const char *kSucceeded = "succeeded"; +} // namespace DeploymentStatusValues + namespace AndroidStateValues { /** Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has @@ -3826,6 +4292,26 @@ static constexpr const char *kBackground = "background"; static constexpr const char *kForeground = "foreground"; } // namespace AndroidStateValues +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 DbClientConnectionsStateValues +{ +/** idle. */ +static constexpr const char *kIdle = "idle"; +/** used. */ +static constexpr const char *kUsed = "used"; +} // namespace DbClientConnectionsStateValues + namespace StateValues { /** idle. */ @@ -3890,6 +4376,16 @@ static constexpr const char *kInproc = "inproc"; static constexpr const char *kOther = "other"; } // namespace NetTransportValues +namespace ProcessCpuStateValues +{ +/** system. */ +static constexpr const char *kSystem = "system"; +/** user. */ +static constexpr const char *kUser = "user"; +/** wait. */ +static constexpr const char *kWait = "wait"; +} // namespace ProcessCpuStateValues + namespace MessageTypeValues { /** sent. */ @@ -3898,6 +4394,24 @@ static constexpr const char *kSent = "SENT"; static constexpr const char *kReceived = "RECEIVED"; } // namespace MessageTypeValues +namespace SystemCpuStateValues +{ +/** user. */ +static constexpr const char *kUser = "user"; +/** system. */ +static constexpr const char *kSystem = "system"; +/** nice. */ +static constexpr const char *kNice = "nice"; +/** idle. */ +static constexpr const char *kIdle = "idle"; +/** iowait. */ +static constexpr const char *kIowait = "iowait"; +/** interrupt. */ +static constexpr const char *kInterrupt = "interrupt"; +/** steal. */ +static constexpr const char *kSteal = "steal"; +} // namespace SystemCpuStateValues + namespace SystemProcessesStatusValues { /** running. */ @@ -3962,12 +4476,46 @@ static constexpr const char *kTimer = "timer"; static constexpr const char *kOther = "other"; } // namespace FaasTriggerValues +namespace GenAiOperationNameValues +{ +/** Chat completion operation such as [OpenAI Chat + * API](https://platform.openai.com/docs/api-reference/chat). */ +static constexpr const char *kChat = "chat"; +/** Text completions operation such as [OpenAI Completions API + * (Legacy)](https://platform.openai.com/docs/api-reference/completions). */ +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 GoMemoryTypeValues +{ +/** Memory allocated from the heap that is reserved for stack space, whether or not it is currently + * in-use. */ +static constexpr const char *kStack = "stack"; +/** Memory used by the Go runtime, excluding other categories of memory usage described in this + * enumeration. */ +static constexpr const char *kOther = "other"; +} // namespace GoMemoryTypeValues + namespace GraphqlOperationTypeValues { /** GraphQL query. */ @@ -4056,6 +4604,14 @@ static constexpr const char *kTimedWaiting = "timed_waiting"; static constexpr const char *kTerminated = "terminated"; } // namespace JvmThreadStateValues +namespace LinuxMemorySlabStateValues +{ +/** reclaimable. */ +static constexpr const char *kReclaimable = "reclaimable"; +/** unreclaimable. */ +static constexpr const char *kUnreclaimable = "unreclaimable"; +} // namespace LinuxMemorySlabStateValues + namespace LogIostreamValues { /** Logs from stdout stream. */ @@ -4076,10 +4632,12 @@ static constexpr const char *kCreate = "create"; /** One or more messages are requested by a consumer. This operation refers to pull-based scenarios, * where consumers explicitly call methods of messaging SDKs to receive messages. */ static constexpr const char *kReceive = "receive"; -/** One or more messages are delivered to or processed by a consumer. */ -static constexpr const char *kDeliver = "process"; +/** 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 `process` instead. */ +static constexpr const char *kDeliver = "deliver"; } // namespace MessagingOperationTypeValues namespace MessagingSystemValues @@ -4104,6 +4662,8 @@ static constexpr const char *kKafka = "kafka"; 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 MessagingRocketmqConsumptionModelValues @@ -4216,6 +4776,8 @@ static constexpr const char *kUdp = "udp"; 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 @@ -4285,16 +4847,6 @@ static constexpr const char *kMajor = "major"; static constexpr const char *kMinor = "minor"; } // namespace ProcessPagingFaultTypeValues -namespace ProcessCpuStateValues -{ -/** system. */ -static constexpr const char *kSystem = "system"; -/** user. */ -static constexpr const char *kUser = "user"; -/** wait. */ -static constexpr const char *kWait = "wait"; -} // namespace ProcessCpuStateValues - namespace RpcConnectRpcErrorCodeValues { /** cancelled. */ @@ -4411,24 +4963,6 @@ static constexpr const char *kLongPolling = "long_polling"; static constexpr const char *kWebSockets = "web_sockets"; } // namespace SignalrTransportValues -namespace SystemCpuStateValues -{ -/** user. */ -static constexpr const char *kUser = "user"; -/** system. */ -static constexpr const char *kSystem = "system"; -/** nice. */ -static constexpr const char *kNice = "nice"; -/** idle. */ -static constexpr const char *kIdle = "idle"; -/** iowait. */ -static constexpr const char *kIowait = "iowait"; -/** interrupt. */ -static constexpr const char *kInterrupt = "interrupt"; -/** steal. */ -static constexpr const char *kSteal = "steal"; -} // namespace SystemCpuStateValues - namespace SystemMemoryStateValues { /** used. */ @@ -4561,6 +5095,30 @@ static constexpr const char *kSwift = "swift"; static constexpr const char *kWebjs = "webjs"; } // namespace TelemetrySdkLanguageValues +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 TlsProtocolNameValues { /** ssl. */ @@ -4569,6 +5127,40 @@ static constexpr const char *kSsl = "ssl"; static constexpr const char *kTls = "tls"; } // namespace TlsProtocolNameValues +namespace V8jsGcTypeValues +{ +/** Major (Mark Sweep Compact). */ +static constexpr const char *kMajor = "major"; +/** Minor (Scavenge). */ +static constexpr const char *kMinor = "minor"; +/** Incremental (Incremental Marking). */ +static constexpr const char *kIncremental = "incremental"; +/** Weak Callbacks (Process Weak Callbacks). */ +static constexpr const char *kWeakcb = "weakcb"; +} // namespace V8jsGcTypeValues + +namespace V8jsHeapSpaceNameValues +{ +/** New memory space. */ +static constexpr const char *kNewSpace = "new_space"; +/** Old memory space. */ +static constexpr const char *kOldSpace = "old_space"; +/** Code memory space. */ +static constexpr const char *kCodeSpace = "code_space"; +/** Map memory space. */ +static constexpr const char *kMapSpace = "map_space"; +/** Large object memory space. */ +static constexpr const char *kLargeObjectSpace = "large_object_space"; +} // namespace V8jsHeapSpaceNameValues + +namespace VcsRepositoryRefTypeValues +{ +/** [branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch). */ +static constexpr const char *kBranch = "branch"; +/** [tag](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag). */ +static constexpr const char *kTag = "tag"; +} // namespace VcsRepositoryRefTypeValues + } // namespace SemanticConventions } // namespace resource } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h index d5054d9218..e44e9fa320 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h @@ -27,7 +27,7 @@ namespace trace class ParentBasedSampler : public Sampler { public: - explicit ParentBasedSampler(std::shared_ptr delegate_sampler) noexcept; + explicit ParentBasedSampler(const std::shared_ptr &delegate_sampler) noexcept; /** The decision either respects the parent span's sampling decision or delegates to * delegateSampler for root spans * @return Returns DROP always diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/parent_factory.h b/sdk/include/opentelemetry/sdk/trace/samplers/parent_factory.h index 68557ace79..d5cf598311 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/parent_factory.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/parent_factory.h @@ -23,7 +23,7 @@ class ParentBasedSamplerFactory /** * Create a ParentBasedSampler. */ - static std::unique_ptr Create(std::shared_ptr delegate_sampler); + static std::unique_ptr Create(const std::shared_ptr &delegate_sampler); }; } // namespace trace diff --git a/sdk/include/opentelemetry/sdk/trace/simple_processor.h b/sdk/include/opentelemetry/sdk/trace/simple_processor.h index dee8e80bb8..ce6d378b79 100644 --- a/sdk/include/opentelemetry/sdk/trace/simple_processor.h +++ b/sdk/include/opentelemetry/sdk/trace/simple_processor.h @@ -7,12 +7,15 @@ #include #include #include +#include #include "opentelemetry/common/spin_lock_mutex.h" #include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/exporter_utils.h" #include "opentelemetry/sdk/trace/exporter.h" #include "opentelemetry/sdk/trace/processor.h" #include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/trace/span_data.h b/sdk/include/opentelemetry/sdk/trace/span_data.h index 8e301c1a01..96b8e5deee 100644 --- a/sdk/include/opentelemetry/sdk/trace/span_data.h +++ b/sdk/include/opentelemetry/sdk/trace/span_data.h @@ -11,14 +11,18 @@ #include #include "opentelemetry/common/attribute_value.h" -#include "opentelemetry/common/macros.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/common/timestamp.h" #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/trace/recordable.h" -#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_flags.h" #include "opentelemetry/trace/trace_id.h" #include "opentelemetry/version.h" @@ -253,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/sdk/include/opentelemetry/sdk/trace/tracer.h b/sdk/include/opentelemetry/sdk/trace/tracer.h index fb8342c1d5..f738203b4f 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer.h @@ -4,12 +4,10 @@ #pragma once #include -#include #include "opentelemetry/common/key_value_iterable.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" -#include "opentelemetry/nostd/unique_ptr.h" #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/trace/id_generator.h" diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_context.h b/sdk/include/opentelemetry/sdk/trace/tracer_context.h index 73bbe4f84b..e1b2cb25d2 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_context.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_context.h @@ -39,7 +39,7 @@ class TracerContext public: explicit TracerContext( std::vector> &&processor, - opentelemetry::sdk::resource::Resource resource = + const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr sampler = std::unique_ptr(new AlwaysOnSampler), std::unique_ptr id_generator = diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_provider.h b/sdk/include/opentelemetry/sdk/trace/tracer_provider.h index 0d05a94043..44d5840558 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_provider.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_provider.h @@ -4,7 +4,6 @@ #pragma once #include -#include #include #include @@ -43,7 +42,7 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T */ explicit TracerProvider( std::unique_ptr processor, - opentelemetry::sdk::resource::Resource resource = + const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr sampler = std::unique_ptr(new AlwaysOnSampler), std::unique_ptr id_generator = @@ -51,7 +50,7 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T explicit TracerProvider( std::vector> &&processors, - opentelemetry::sdk::resource::Resource resource = + const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr sampler = std::unique_ptr(new AlwaysOnSampler), std::unique_ptr id_generator = diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_provider_factory.h b/sdk/include/opentelemetry/sdk/trace/tracer_provider_factory.h index 7c4b6903de..ed451a8c99 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_provider_factory.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_provider_factory.h @@ -28,68 +28,6 @@ namespace trace class OPENTELEMETRY_EXPORT TracerProviderFactory { public: -#ifdef OPENTELEMETRY_DEPRECATED_SDK_FACTORY - -# ifndef OPENTELEMETRY_NO_DEPRECATED_CODE - - /* Serie of builders with a single processor. */ - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::unique_ptr processor); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler, - std::unique_ptr id_generator); - - /* Serie of builders with a vector of processor. */ - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::vector> &&processors); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler); - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler, - std::unique_ptr id_generator); - - /* Create with a tracer context. */ - - OPENTELEMETRY_DEPRECATED - static std::unique_ptr Create( - std::unique_ptr context); - -# endif /* OPENTELEMETRY_NO_DEPRECATED_CODE */ - -#else - /* Serie of builders with a single processor. */ static std::unique_ptr Create( @@ -134,8 +72,6 @@ class OPENTELEMETRY_EXPORT TracerProviderFactory static std::unique_ptr Create( std::unique_ptr context); - -#endif /* OPENTELEMETRY_DEPRECATED_SDK_FACTORY */ }; } // namespace trace diff --git a/sdk/include/opentelemetry/sdk/version/version.h b/sdk/include/opentelemetry/sdk/version/version.h index bfc93238b4..387eb64fab 100644 --- a/sdk/include/opentelemetry/sdk/version/version.h +++ b/sdk/include/opentelemetry/sdk/version/version.h @@ -3,7 +3,7 @@ #pragma once -#define OPENTELEMETRY_SDK_VERSION "1.16.0" +#define OPENTELEMETRY_SDK_VERSION "1.18.0" #include "opentelemetry/version.h" diff --git a/sdk/src/common/CMakeLists.txt b/sdk/src/common/CMakeLists.txt index 664db38e17..16229e0820 100644 --- a/sdk/src/common/CMakeLists.txt +++ b/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/sdk/src/common/base64.cc b/sdk/src/common/base64.cc index 3c572fe344..a78b88ad68 100644 --- a/sdk/src/common/base64.cc +++ b/sdk/src/common/base64.cc @@ -200,15 +200,10 @@ static int Base64UnescapeInternal(unsigned char *dst, ++line_len; if (src[i] == padding_char) { - if (++j > 2) + if (++j > 2 || (valid_slen & 3) == 1 || (valid_slen & 3) == 2) { return -2; } - else if ((valid_slen & 3) == 1 || (valid_slen & 3) == 2) - { - // First and second char of every group can not be padding char - return -2; - } } else { diff --git a/sdk/src/common/global_log_handler.cc b/sdk/src/common/global_log_handler.cc index 40968f2b7e..f60527eee8 100644 --- a/sdk/src/common/global_log_handler.cc +++ b/sdk/src/common/global_log_handler.cc @@ -31,7 +31,7 @@ void DefaultLogHandler::Handle(LogLevel level, { output_s << msg; } - output_s << std::endl; + output_s << '\n'; // TBD - print attributes switch (level) diff --git a/sdk/src/common/random.cc b/sdk/src/common/random.cc index 77b88cfa2a..9b696dea65 100644 --- a/sdk/src/common/random.cc +++ b/sdk/src/common/random.cc @@ -5,6 +5,7 @@ #include "src/common/random.h" #include "src/common/platform/fork.h" +#include #include #include @@ -26,12 +27,17 @@ class TlsRandomNumberGenerator TlsRandomNumberGenerator() noexcept { Seed(); - platform::AtFork(nullptr, nullptr, OnFork); + if (!flag.test_and_set()) + { + platform::AtFork(nullptr, nullptr, OnFork); + } } static FastRandomNumberGenerator &engine() noexcept { return engine_; } private: + static std::atomic_flag flag; + static thread_local FastRandomNumberGenerator engine_; static void OnFork() noexcept { Seed(); } @@ -44,6 +50,7 @@ class TlsRandomNumberGenerator } }; +std::atomic_flag TlsRandomNumberGenerator::flag; thread_local FastRandomNumberGenerator TlsRandomNumberGenerator::engine_{}; } // namespace diff --git a/sdk/src/logs/BUILD b/sdk/src/logs/BUILD index f1a0828527..93642e99b6 100644 --- a/sdk/src/logs/BUILD +++ b/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/sdk/src/logs/event_logger.cc b/sdk/src/logs/event_logger.cc index 6b0afacfaf..df9ba44c31 100644 --- a/sdk/src/logs/event_logger.cc +++ b/sdk/src/logs/event_logger.cc @@ -21,7 +21,7 @@ namespace logs EventLogger::EventLogger( opentelemetry::nostd::shared_ptr delegate_logger, opentelemetry::nostd::string_view event_domain) noexcept - : delegate_logger_(delegate_logger), event_domain_(event_domain) + : delegate_logger_(std::move(delegate_logger)), event_domain_(event_domain) {} const opentelemetry::nostd::string_view EventLogger::GetName() noexcept diff --git a/sdk/src/logs/event_logger_provider_factory.cc b/sdk/src/logs/event_logger_provider_factory.cc index 7f5c8cadf1..daff8a8590 100644 --- a/sdk/src/logs/event_logger_provider_factory.cc +++ b/sdk/src/logs/event_logger_provider_factory.cc @@ -11,22 +11,11 @@ namespace sdk namespace logs { -#ifdef OPENTELEMETRY_DEPRECATED_SDK_FACTORY - -std::unique_ptr EventLoggerProviderFactory::Create() -{ - return std::unique_ptr(new EventLoggerProvider()); -} - -#else - std::unique_ptr EventLoggerProviderFactory::Create() { return std::unique_ptr(new EventLoggerProvider()); } -#endif /* OPENTELEMETRY_DEPRECATED_SDK_FACTORY */ - } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/logs/logger.cc b/sdk/src/logs/logger.cc index e9935c5107..2d57ab9faa 100644 --- a/sdk/src/logs/logger.cc +++ b/sdk/src/logs/logger.cc @@ -38,7 +38,7 @@ Logger::Logger( std::unique_ptr instrumentation_scope) noexcept : logger_name_(std::string(name)), instrumentation_scope_(std::move(instrumentation_scope)), - context_(context) + context_(std::move(context)) {} const opentelemetry::nostd::string_view Logger::GetName() noexcept diff --git a/sdk/src/logs/logger_context.cc b/sdk/src/logs/logger_context.cc index 2bfb89161e..a6eb063661 100644 --- a/sdk/src/logs/logger_context.cc +++ b/sdk/src/logs/logger_context.cc @@ -19,7 +19,7 @@ namespace logs { LoggerContext::LoggerContext(std::vector> &&processors, - opentelemetry::sdk::resource::Resource resource) noexcept + const opentelemetry::sdk::resource::Resource &resource) noexcept : resource_(resource), processor_( std::unique_ptr(new MultiLogRecordProcessor(std::move(processors)))) diff --git a/sdk/src/logs/logger_provider.cc b/sdk/src/logs/logger_provider.cc index 1eaa0d186e..46bf1ade33 100644 --- a/sdk/src/logs/logger_provider.cc +++ b/sdk/src/logs/logger_provider.cc @@ -27,17 +27,17 @@ namespace logs { LoggerProvider::LoggerProvider(std::unique_ptr &&processor, - opentelemetry::sdk::resource::Resource resource) noexcept + const opentelemetry::sdk::resource::Resource &resource) noexcept { std::vector> processors; processors.emplace_back(std::move(processor)); - context_ = std::make_shared(std::move(processors), std::move(resource)); + context_ = std::make_shared(std::move(processors), resource); OTEL_INTERNAL_LOG_DEBUG("[LoggerProvider] LoggerProvider created."); } LoggerProvider::LoggerProvider(std::vector> &&processors, - opentelemetry::sdk::resource::Resource resource) noexcept - : context_{std::make_shared(std::move(processors), std::move(resource))} + const opentelemetry::sdk::resource::Resource &resource) noexcept + : context_{std::make_shared(std::move(processors), resource)} {} LoggerProvider::LoggerProvider() noexcept diff --git a/sdk/src/logs/logger_provider_factory.cc b/sdk/src/logs/logger_provider_factory.cc index 08567c65d9..530d1c2db4 100644 --- a/sdk/src/logs/logger_provider_factory.cc +++ b/sdk/src/logs/logger_provider_factory.cc @@ -18,50 +18,6 @@ namespace sdk namespace logs { -#ifdef OPENTELEMETRY_DEPRECATED_SDK_FACTORY - -std::unique_ptr LoggerProviderFactory::Create( - std::unique_ptr &&processor) -{ - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - return Create(std::move(processor), resource); -} - -std::unique_ptr LoggerProviderFactory::Create( - std::unique_ptr &&processor, - const opentelemetry::sdk::resource::Resource &resource) -{ - std::unique_ptr provider( - new LoggerProvider(std::move(processor), resource)); - return provider; -} - -std::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors) -{ - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - return Create(std::move(processors), resource); -} - -std::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource) -{ - std::unique_ptr provider( - new LoggerProvider(std::move(processors), resource)); - return provider; -} - -std::unique_ptr LoggerProviderFactory::Create( - std::unique_ptr context) -{ - std::unique_ptr provider( - new LoggerProvider(std::move(context))); - return provider; -} - -#else - std::unique_ptr LoggerProviderFactory::Create( std::unique_ptr &&processor) { @@ -102,8 +58,6 @@ std::unique_ptr LoggerProviderFactory: return provider; } -#endif /* OPENTELEMETRY_DEPRECATED_SDK_FACTORY */ - } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/metrics/BUILD b/sdk/src/metrics/BUILD index ff8d244da1..78f224b5ab 100644 --- a/sdk/src/metrics/BUILD +++ b/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/sdk/src/metrics/aggregation/histogram_aggregation.cc b/sdk/src/metrics/aggregation/histogram_aggregation.cc index da725cf09c..d6b4c90a0b 100644 --- a/sdk/src/metrics/aggregation/histogram_aggregation.cc +++ b/sdk/src/metrics/aggregation/histogram_aggregation.cc @@ -28,7 +28,7 @@ namespace metrics LongHistogramAggregation::LongHistogramAggregation(const AggregationConfig *aggregation_config) { auto ac = static_cast(aggregation_config); - if (ac && ac->boundaries_.size()) + if (ac) { point_data_.boundaries_ = ac->boundaries_; } @@ -109,7 +109,7 @@ PointType LongHistogramAggregation::ToPoint() const noexcept DoubleHistogramAggregation::DoubleHistogramAggregation(const AggregationConfig *aggregation_config) { auto ac = static_cast(aggregation_config); - if (ac && ac->boundaries_.size()) + if (ac) { point_data_.boundaries_ = ac->boundaries_; } diff --git a/sdk/src/metrics/aggregation/lastvalue_aggregation.cc b/sdk/src/metrics/aggregation/lastvalue_aggregation.cc index 0380015234..2bc0eddb0e 100644 --- a/sdk/src/metrics/aggregation/lastvalue_aggregation.cc +++ b/sdk/src/metrics/aggregation/lastvalue_aggregation.cc @@ -28,9 +28,7 @@ LongLastValueAggregation::LongLastValueAggregation() point_data_.value_ = static_cast(0); } -LongLastValueAggregation::LongLastValueAggregation(LastValuePointData &&data) - : point_data_{std::move(data)} -{} +LongLastValueAggregation::LongLastValueAggregation(LastValuePointData &&data) : point_data_{data} {} LongLastValueAggregation::LongLastValueAggregation(const LastValuePointData &data) : point_data_{data} @@ -51,12 +49,12 @@ std::unique_ptr LongLastValueAggregation::Merge( if (nostd::get(ToPoint()).sample_ts_.time_since_epoch() > nostd::get(delta.ToPoint()).sample_ts_.time_since_epoch()) { - LastValuePointData merge_data = std::move(nostd::get(ToPoint())); + LastValuePointData merge_data = nostd::get(ToPoint()); return std::unique_ptr(new LongLastValueAggregation(std::move(merge_data))); } else { - LastValuePointData merge_data = std::move(nostd::get(delta.ToPoint())); + LastValuePointData merge_data = nostd::get(delta.ToPoint()); return std::unique_ptr(new LongLastValueAggregation(std::move(merge_data))); } } @@ -66,12 +64,12 @@ std::unique_ptr LongLastValueAggregation::Diff(const Aggregation &n if (nostd::get(ToPoint()).sample_ts_.time_since_epoch() > nostd::get(next.ToPoint()).sample_ts_.time_since_epoch()) { - LastValuePointData diff_data = std::move(nostd::get(ToPoint())); + LastValuePointData diff_data = nostd::get(ToPoint()); return std::unique_ptr(new LongLastValueAggregation(std::move(diff_data))); } else { - LastValuePointData diff_data = std::move(nostd::get(next.ToPoint())); + LastValuePointData diff_data = nostd::get(next.ToPoint()); return std::unique_ptr(new LongLastValueAggregation(std::move(diff_data))); } } @@ -89,7 +87,7 @@ DoubleLastValueAggregation::DoubleLastValueAggregation() } DoubleLastValueAggregation::DoubleLastValueAggregation(LastValuePointData &&data) - : point_data_{std::move(data)} + : point_data_{data} {} DoubleLastValueAggregation::DoubleLastValueAggregation(const LastValuePointData &data) @@ -111,12 +109,12 @@ std::unique_ptr DoubleLastValueAggregation::Merge( if (nostd::get(ToPoint()).sample_ts_.time_since_epoch() > nostd::get(delta.ToPoint()).sample_ts_.time_since_epoch()) { - LastValuePointData merge_data = std::move(nostd::get(ToPoint())); + LastValuePointData merge_data = nostd::get(ToPoint()); return std::unique_ptr(new DoubleLastValueAggregation(std::move(merge_data))); } else { - LastValuePointData merge_data = std::move(nostd::get(delta.ToPoint())); + LastValuePointData merge_data = nostd::get(delta.ToPoint()); return std::unique_ptr(new DoubleLastValueAggregation(std::move(merge_data))); } } @@ -127,12 +125,12 @@ std::unique_ptr DoubleLastValueAggregation::Diff( if (nostd::get(ToPoint()).sample_ts_.time_since_epoch() > nostd::get(next.ToPoint()).sample_ts_.time_since_epoch()) { - LastValuePointData diff_data = std::move(nostd::get(ToPoint())); + LastValuePointData diff_data = nostd::get(ToPoint()); return std::unique_ptr(new DoubleLastValueAggregation(std::move(diff_data))); } else { - LastValuePointData diff_data = std::move(nostd::get(next.ToPoint())); + LastValuePointData diff_data = nostd::get(next.ToPoint()); return std::unique_ptr(new DoubleLastValueAggregation(std::move(diff_data))); } } diff --git a/sdk/src/metrics/aggregation/sum_aggregation.cc b/sdk/src/metrics/aggregation/sum_aggregation.cc index 1e0442e92c..cd518e5460 100644 --- a/sdk/src/metrics/aggregation/sum_aggregation.cc +++ b/sdk/src/metrics/aggregation/sum_aggregation.cc @@ -4,7 +4,6 @@ #include #include #include -#include #include "opentelemetry/common/spin_lock_mutex.h" #include "opentelemetry/nostd/variant.h" @@ -27,7 +26,7 @@ LongSumAggregation::LongSumAggregation(bool is_monotonic) point_data_.is_monotonic_ = is_monotonic; } -LongSumAggregation::LongSumAggregation(SumPointData &&data) : point_data_{std::move(data)} {} +LongSumAggregation::LongSumAggregation(SumPointData &&data) : point_data_{data} {} LongSumAggregation::LongSumAggregation(const SumPointData &data) : point_data_{data} {} @@ -81,7 +80,7 @@ DoubleSumAggregation::DoubleSumAggregation(bool is_monotonic) point_data_.is_monotonic_ = is_monotonic; } -DoubleSumAggregation::DoubleSumAggregation(SumPointData &&data) : point_data_(std::move(data)) {} +DoubleSumAggregation::DoubleSumAggregation(SumPointData &&data) : point_data_(data) {} DoubleSumAggregation::DoubleSumAggregation(const SumPointData &data) : point_data_(data) {} diff --git a/sdk/src/metrics/async_instruments.cc b/sdk/src/metrics/async_instruments.cc index 311efc1e7e..709957d68e 100644 --- a/sdk/src/metrics/async_instruments.cc +++ b/sdk/src/metrics/async_instruments.cc @@ -20,9 +20,9 @@ namespace metrics ObservableInstrument::ObservableInstrument(InstrumentDescriptor instrument_descriptor, std::unique_ptr storage, std::shared_ptr observable_registry) - : instrument_descriptor_(instrument_descriptor), + : instrument_descriptor_(std::move(instrument_descriptor)), storage_(std::move(storage)), - observable_registry_{observable_registry} + observable_registry_{std::move(observable_registry)} {} diff --git a/sdk/src/metrics/exemplar/reservoir.cc b/sdk/src/metrics/exemplar/reservoir.cc index 4e7501799e..264a000828 100644 --- a/sdk/src/metrics/exemplar/reservoir.cc +++ b/sdk/src/metrics/exemplar/reservoir.cc @@ -3,9 +3,11 @@ #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +# include + # include "opentelemetry/sdk/metrics/exemplar/aligned_histogram_bucket_exemplar_reservoir.h" # include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" # include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" # include "opentelemetry/sdk/metrics/exemplar/simple_fixed_size_exemplar_reservoir.h" @@ -20,8 +22,8 @@ nostd::shared_ptr ExemplarReservoir::GetSimpleFixedSizeExempl std::shared_ptr reservoir_cell_selector, MapAndResetCellType map_and_reset_cell) { - return nostd::shared_ptr{ - new SimpleFixedSizeExemplarReservoir{size, reservoir_cell_selector, map_and_reset_cell}}; + return nostd::shared_ptr{new SimpleFixedSizeExemplarReservoir{ + size, std::move(reservoir_cell_selector), map_and_reset_cell}}; } nostd::shared_ptr ExemplarReservoir::GetAlignedHistogramBucketExemplarReservoir( @@ -30,7 +32,7 @@ nostd::shared_ptr ExemplarReservoir::GetAlignedHistogramBucke MapAndResetCellType map_and_reset_cell) { return nostd::shared_ptr{new AlignedHistogramBucketExemplarReservoir{ - size, reservoir_cell_selector, map_and_reset_cell}}; + size, std::move(reservoir_cell_selector), map_and_reset_cell}}; } nostd::shared_ptr ExemplarReservoir::GetNoExemplarReservoir() diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index f6ae47977d..682badf3a4 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -29,6 +28,10 @@ # include #endif +#if OPENTELEMETRY_HAVE_EXCEPTIONS +# include +#endif + OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -90,31 +93,64 @@ void PeriodicExportingMetricReader::DoBackgroundWork() bool PeriodicExportingMetricReader::CollectAndExportOnce() { std::atomic cancel_export_for_timeout{false}; - auto future_receive = std::async(std::launch::async, [this, &cancel_export_for_timeout] { - Collect([this, &cancel_export_for_timeout](ResourceMetrics &metric_data) { - if (cancel_export_for_timeout) - { - OTEL_INTERNAL_LOG_ERROR( - "[Periodic Exporting Metric Reader] Collect took longer configured time: " - << export_timeout_millis_.count() << " ms, and timed out"); - return false; - } - this->exporter_->Export(metric_data); - return true; - }); - }); - std::future_status status; std::uint64_t notify_force_flush = force_flush_pending_sequence_.load(std::memory_order_acquire); - do + std::unique_ptr task_thread; + +#if OPENTELEMETRY_HAVE_EXCEPTIONS + try { - status = future_receive.wait_for(std::chrono::milliseconds(export_timeout_millis_)); - if (status == std::future_status::timeout) +#endif + std::promise sender; + auto receiver = sender.get_future(); + + task_thread.reset( + new std::thread([this, &cancel_export_for_timeout, sender = std::move(sender)] { + this->Collect([this, &cancel_export_for_timeout](ResourceMetrics &metric_data) { + if (cancel_export_for_timeout.load(std::memory_order_acquire)) + { + OTEL_INTERNAL_LOG_ERROR( + "[Periodic Exporting Metric Reader] Collect took longer configured time: " + << this->export_timeout_millis_.count() << " ms, and timed out"); + return false; + } + this->exporter_->Export(metric_data); + return true; + }); + + const_cast &>(sender).set_value(); + })); + + std::future_status status; + do { - cancel_export_for_timeout = true; - break; - } - } while (status != std::future_status::ready); + status = receiver.wait_for(std::chrono::milliseconds(export_timeout_millis_)); + if (status == std::future_status::timeout) + { + cancel_export_for_timeout.store(true, std::memory_order_release); + break; + } + } while (status != std::future_status::ready); +#if OPENTELEMETRY_HAVE_EXCEPTIONS + } + catch (std::exception &e) + { + OTEL_INTERNAL_LOG_ERROR("[Periodic Exporting Metric Reader] Collect failed with exception " + << e.what()); + return false; + } + catch (...) + { + OTEL_INTERNAL_LOG_ERROR( + "[Periodic Exporting Metric Reader] Collect failed with unknown exception"); + return false; + } +#endif + + if (task_thread && task_thread->joinable()) + { + task_thread->join(); + } std::uint64_t notified_sequence = force_flush_notified_sequence_.load(std::memory_order_acquire); while (notify_force_flush > notified_sequence) @@ -180,7 +216,7 @@ bool PeriodicExportingMetricReader::OnForceFlush(std::chrono::microseconds timeo // - If original `timeout` is `zero`, use that in exporter::forceflush // - Else if remaining `timeout_steady` more than zero, use that in exporter::forceflush // - Else don't invoke exporter::forceflush ( as remaining time is zero or less) - if (timeout <= std::chrono::steady_clock::duration::zero()) + if (timeout <= std::chrono::milliseconds::duration::zero()) { result = exporter_->ForceFlush(std::chrono::duration_cast(timeout)); diff --git a/sdk/src/metrics/meter.cc b/sdk/src/metrics/meter.cc index 8b4413113b..6d09f264db 100644 --- a/sdk/src/metrics/meter.cc +++ b/sdk/src/metrics/meter.cc @@ -53,7 +53,7 @@ Meter::Meter( std::weak_ptr meter_context, std::unique_ptr instrumentation_scope) noexcept : scope_{std::move(instrumentation_scope)}, - meter_context_{meter_context}, + meter_context_{std::move(meter_context)}, observable_registry_(new ObservableRegistry()) {} @@ -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, @@ -455,7 +499,7 @@ std::vector Meter::Collect(CollectorHandle *collector, for (auto &metric_storage : storage_registry_) { metric_storage.second->Collect(collector, ctx->GetCollectors(), ctx->GetSDKStartTime(), - collect_ts, [&metric_data_list](MetricData metric_data) { + collect_ts, [&metric_data_list](const MetricData &metric_data) { metric_data_list.push_back(metric_data); return true; }); diff --git a/sdk/src/metrics/meter_context.cc b/sdk/src/metrics/meter_context.cc index de32c469d8..15e689706a 100644 --- a/sdk/src/metrics/meter_context.cc +++ b/sdk/src/metrics/meter_context.cc @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -36,7 +35,7 @@ namespace metrics { MeterContext::MeterContext(std::unique_ptr views, - opentelemetry::sdk::resource::Resource resource) noexcept + const opentelemetry::sdk::resource::Resource &resource) noexcept : resource_{resource}, views_(std::move(views)), sdk_start_ts_{std::chrono::system_clock::now()} {} @@ -82,7 +81,7 @@ opentelemetry::common::SystemTimestamp MeterContext::GetSDKStartTime() noexcept void MeterContext::AddMetricReader(std::shared_ptr reader) noexcept { - auto collector = std::shared_ptr{new MetricCollector(this, reader)}; + auto collector = std::shared_ptr{new MetricCollector(this, std::move(reader))}; collectors_.push_back(collector); } @@ -107,7 +106,7 @@ ExemplarFilterType MeterContext::GetExemplarFilter() const noexcept #endif // ENABLE_METRICS_EXEMPLAR_PREVIEW -void MeterContext::AddMeter(std::shared_ptr meter) +void MeterContext::AddMeter(const std::shared_ptr &meter) { std::lock_guard guard(meter_lock_); meters_.push_back(meter); @@ -168,46 +167,36 @@ bool MeterContext::ForceFlush(std::chrono::microseconds timeout) noexcept bool result = true; // Simultaneous flush not allowed. const std::lock_guard locked(forceflush_lock_); - // Convert to nanos to prevent overflow - auto timeout_ns = (std::chrono::nanoseconds::max)(); - if (std::chrono::duration_cast(timeout_ns) > timeout) - { - timeout_ns = std::chrono::duration_cast(timeout); - } - - auto current_time = std::chrono::system_clock::now(); - std::chrono::system_clock::time_point expire_time; - auto overflow_checker = (std::chrono::system_clock::time_point::max)(); - // check if the expected expire time doesn't overflow. - if (overflow_checker - current_time > timeout_ns) + auto time_remaining = (std::chrono::steady_clock::duration::max)(); + if (std::chrono::duration_cast(time_remaining) > timeout) { - expire_time = - current_time + std::chrono::duration_cast(timeout_ns); + time_remaining = timeout; } - else + + auto current_time = std::chrono::steady_clock::now(); + auto expire_time = (std::chrono::steady_clock::time_point::max)(); + if (expire_time - current_time > time_remaining) { - // overflow happens, reset expire time to max. - expire_time = overflow_checker; + expire_time = current_time + time_remaining; } for (auto &collector : collectors_) { if (!std::static_pointer_cast(collector)->ForceFlush( - std::chrono::duration_cast(timeout_ns))) + std::chrono::duration_cast(time_remaining))) { result = false; } - current_time = std::chrono::system_clock::now(); - + current_time = std::chrono::steady_clock::now(); if (expire_time >= current_time) { - timeout_ns = std::chrono::duration_cast(expire_time - current_time); + time_remaining = expire_time - current_time; } else { - timeout_ns = std::chrono::nanoseconds::zero(); + time_remaining = std::chrono::steady_clock::duration::zero(); } } if (!result) diff --git a/sdk/src/metrics/meter_provider.cc b/sdk/src/metrics/meter_provider.cc index 6ddba6aa7c..4f2ca4b44f 100644 --- a/sdk/src/metrics/meter_provider.cc +++ b/sdk/src/metrics/meter_provider.cc @@ -37,7 +37,7 @@ MeterProvider::MeterProvider(std::unique_ptr context) noexcept {} MeterProvider::MeterProvider(std::unique_ptr views, - sdk::resource::Resource resource) noexcept + const sdk::resource::Resource &resource) noexcept : context_(std::make_shared(std::move(views), resource)) { OTEL_INTERNAL_LOG_DEBUG("[MeterProvider] MeterProvider created."); @@ -110,7 +110,7 @@ const resource::Resource &MeterProvider::GetResource() const noexcept void MeterProvider::AddMetricReader(std::shared_ptr reader) noexcept { - context_->AddMetricReader(reader); + context_->AddMetricReader(std::move(reader)); } void MeterProvider::AddView(std::unique_ptr instrument_selector, diff --git a/sdk/src/metrics/meter_provider_factory.cc b/sdk/src/metrics/meter_provider_factory.cc index 7749a13124..c5e368aca6 100644 --- a/sdk/src/metrics/meter_provider_factory.cc +++ b/sdk/src/metrics/meter_provider_factory.cc @@ -18,40 +18,6 @@ namespace sdk namespace metrics { -#ifdef OPENTELEMETRY_DEPRECATED_SDK_FACTORY - -std::unique_ptr MeterProviderFactory::Create() -{ - auto views = ViewRegistryFactory::Create(); - return Create(std::move(views)); -} - -std::unique_ptr MeterProviderFactory::Create( - std::unique_ptr views) -{ - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - return Create(std::move(views), resource); -} - -std::unique_ptr MeterProviderFactory::Create( - std::unique_ptr views, - const opentelemetry::sdk::resource::Resource &resource) -{ - std::unique_ptr provider( - new opentelemetry::sdk::metrics::MeterProvider(std::move(views), resource)); - return provider; -} - -std::unique_ptr MeterProviderFactory::Create( - std::unique_ptr context) -{ - std::unique_ptr provider( - new opentelemetry::sdk::metrics::MeterProvider(std::move(context))); - return provider; -} - -#else - std::unique_ptr MeterProviderFactory::Create() { auto views = ViewRegistryFactory::Create(); @@ -82,8 +48,6 @@ std::unique_ptr MeterProviderFactory return provider; } -#endif /* OPENTELEMETRY_DEPRECATED_SDK_FACTORY */ - } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/metrics/metric_reader.cc b/sdk/src/metrics/metric_reader.cc index e2f5bc1f1c..024f91fe0f 100644 --- a/sdk/src/metrics/metric_reader.cc +++ b/sdk/src/metrics/metric_reader.cc @@ -26,7 +26,7 @@ bool MetricReader::Collect( if (!metric_producer_) { OTEL_INTERNAL_LOG_WARN( - "MetricReader::Collect Cannot invoke Collect(). No MetricProducer registered for " + "MetricReader::Collect Cannot invoke Produce(). No MetricProducer registered for " "collection!") return false; } @@ -36,7 +36,15 @@ bool MetricReader::Collect( OTEL_INTERNAL_LOG_WARN("MetricReader::Collect invoked while Shutdown in progress!"); } - return metric_producer_->Collect(callback); + auto result = metric_producer_->Produce(); + + // According to the spec, + // When the Produce operation fails, the MetricProducer MAY return successfully collected + // results and a failed reasons list to the caller. + // So we invoke the callback with whatever points we get back, even if the overall operation may + // have failed. + auto success = callback(result.points_); + return (result.status_ == MetricProducer::Status::kSuccess) && success; } bool MetricReader::Shutdown(std::chrono::microseconds timeout) noexcept diff --git a/sdk/src/metrics/state/metric_collector.cc b/sdk/src/metrics/state/metric_collector.cc index 5ecf41cecf..e0c61e66e6 100644 --- a/sdk/src/metrics/state/metric_collector.cc +++ b/sdk/src/metrics/state/metric_collector.cc @@ -8,7 +8,6 @@ #include #include -#include "opentelemetry/nostd/function_ref.h" #include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/export/metric_producer.h" @@ -17,6 +16,7 @@ #include "opentelemetry/sdk/metrics/meter_context.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -24,10 +24,11 @@ namespace sdk { namespace metrics { +using opentelemetry::sdk::resource::Resource; MetricCollector::MetricCollector(opentelemetry::sdk::metrics::MeterContext *context, std::shared_ptr metric_reader) - : meter_context_{context}, metric_reader_{metric_reader} + : meter_context_{context}, metric_reader_{std::move(metric_reader)} { metric_reader_->SetMetricProducer(this); } @@ -35,20 +36,30 @@ 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; } -bool MetricCollector::Collect( - nostd::function_ref callback) noexcept +MetricProducer::Result MetricCollector::Produce() noexcept { if (!meter_context_) { OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Collect] - Error during collecting." << "The metric context is invalid"); - return false; + return {{}, MetricProducer::Status::kFailure}; } ResourceMetrics resource_metrics; - meter_context_->ForEachMeter([&](std::shared_ptr meter) noexcept { + meter_context_->ForEachMeter([&](const std::shared_ptr &meter) noexcept { auto collection_ts = std::chrono::system_clock::now(); auto metric_data = meter->Collect(this, collection_ts); if (!metric_data.empty()) @@ -61,8 +72,7 @@ bool MetricCollector::Collect( return true; }); resource_metrics.resource_ = &meter_context_->GetResource(); - callback(resource_metrics); - return true; + return {resource_metrics, MetricProducer::Status::kSuccess}; } bool MetricCollector::ForceFlush(std::chrono::microseconds timeout) noexcept diff --git a/sdk/src/metrics/state/sync_metric_storage.cc b/sdk/src/metrics/state/sync_metric_storage.cc index fe736e64f3..ad6ea27821 100644 --- a/sdk/src/metrics/state/sync_metric_storage.cc +++ b/sdk/src/metrics/state/sync_metric_storage.cc @@ -39,7 +39,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector, } return temporal_metric_storage_.buildMetrics(collector, collectors, sdk_start_ts, collection_ts, - std::move(delta_metrics), callback); + delta_metrics, callback); } } // namespace metrics diff --git a/sdk/src/metrics/state/temporal_metric_storage.cc b/sdk/src/metrics/state/temporal_metric_storage.cc index 2ba74d9213..c26339a79f 100644 --- a/sdk/src/metrics/state/temporal_metric_storage.cc +++ b/sdk/src/metrics/state/temporal_metric_storage.cc @@ -35,7 +35,7 @@ namespace metrics TemporalMetricStorage::TemporalMetricStorage(InstrumentDescriptor instrument_descriptor, AggregationType aggregation_type, const AggregationConfig *aggregation_config) - : instrument_descriptor_(instrument_descriptor), + : instrument_descriptor_(std::move(instrument_descriptor)), aggregation_type_(aggregation_type), aggregation_config_(aggregation_config) {} @@ -44,7 +44,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, nostd::span> collectors, opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, - std::shared_ptr delta_metrics, + const std::shared_ptr &delta_metrics, nostd::function_ref callback) noexcept { std::lock_guard guard(lock_); diff --git a/sdk/src/metrics/sync_instruments.cc b/sdk/src/metrics/sync_instruments.cc index a99fa80868..de66e93054 100644 --- a/sdk/src/metrics/sync_instruments.cc +++ b/sdk/src/metrics/sync_instruments.cc @@ -20,7 +20,7 @@ namespace sdk { namespace metrics { -LongCounter::LongCounter(InstrumentDescriptor instrument_descriptor, +LongCounter::LongCounter(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) { @@ -80,7 +80,7 @@ void LongCounter::Add(uint64_t value, const opentelemetry::context::Context &con return storage_->RecordLong(value, context); } -DoubleCounter::DoubleCounter(InstrumentDescriptor instrument_descriptor, +DoubleCounter::DoubleCounter(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) { @@ -164,7 +164,7 @@ void DoubleCounter::Add(double value, const opentelemetry::context::Context &con return storage_->RecordDouble(value, context); } -LongUpDownCounter::LongUpDownCounter(InstrumentDescriptor instrument_descriptor, +LongUpDownCounter::LongUpDownCounter(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) { @@ -228,7 +228,7 @@ void LongUpDownCounter::Add(int64_t value, const opentelemetry::context::Context return storage_->RecordLong(value, context); } -DoubleUpDownCounter::DoubleUpDownCounter(InstrumentDescriptor instrument_descriptor, +DoubleUpDownCounter::DoubleUpDownCounter(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) { @@ -292,7 +292,128 @@ void DoubleUpDownCounter::Add(double value, const opentelemetry::context::Contex return storage_->RecordDouble(value, context); } -LongHistogram::LongHistogram(InstrumentDescriptor instrument_descriptor, +#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)) { @@ -355,7 +476,7 @@ void LongHistogram::Record(uint64_t value) noexcept } #endif -DoubleHistogram::DoubleHistogram(InstrumentDescriptor instrument_descriptor, +DoubleHistogram::DoubleHistogram(const InstrumentDescriptor &instrument_descriptor, std::unique_ptr storage) : Synchronous(instrument_descriptor, std::move(storage)) { diff --git a/sdk/src/metrics/view/view_factory.cc b/sdk/src/metrics/view/view_factory.cc index 36496f62d6..319c10b956 100644 --- a/sdk/src/metrics/view/view_factory.cc +++ b/sdk/src/metrics/view/view_factory.cc @@ -53,7 +53,7 @@ std::unique_ptr ViewFactory::Create(const std::string &name, auto attributes_processor = std::unique_ptr(new DefaultAttributesProcessor()); - return Create(name, description, unit, aggregation_type, aggregation_config, + return Create(name, description, unit, aggregation_type, std::move(aggregation_config), std::move(attributes_processor)); } @@ -64,7 +64,8 @@ std::unique_ptr ViewFactory::Create(const std::string &name, std::shared_ptr aggregation_config, std::unique_ptr attributes_processor) { - std::unique_ptr view(new View(name, description, unit, aggregation_type, aggregation_config, + std::unique_ptr view(new View(name, description, unit, aggregation_type, + std::move(aggregation_config), std::move(attributes_processor))); return view; } diff --git a/sdk/src/resource/BUILD b/sdk/src/resource/BUILD index 6cff52723a..8845629990 100644 --- a/sdk/src/resource/BUILD +++ b/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/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 919624686d..5ae5446e80 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -8,8 +8,10 @@ #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/semconv/incubating/process_attributes.h" +#include "opentelemetry/semconv/service_attributes.h" +#include "opentelemetry/semconv/telemetry_attributes.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -36,16 +38,16 @@ Resource Resource::Create(const ResourceAttributes &attributes, const std::strin auto resource = Resource::GetDefault().Merge(otel_resource).Merge(Resource{attributes, schema_url}); - if (resource.attributes_.find(SemanticConventions::kServiceName) == resource.attributes_.end()) + if (resource.attributes_.find(semconv::service::kServiceName) == resource.attributes_.end()) { std::string default_service_name = "unknown_service"; auto it_process_executable_name = - resource.attributes_.find(SemanticConventions::kProcessExecutableName); + resource.attributes_.find(semconv::process::kProcessExecutableName); if (it_process_executable_name != resource.attributes_.end()) { default_service_name += ":" + nostd::get(it_process_executable_name->second); } - resource.attributes_[SemanticConventions::kServiceName] = default_service_name; + resource.attributes_[semconv::service::kServiceName] = default_service_name; } return resource; } @@ -59,9 +61,9 @@ Resource &Resource::GetEmpty() Resource &Resource::GetDefault() { static Resource default_resource( - {{SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, + {{semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, std::string{}); return default_resource; } diff --git a/sdk/src/resource/resource_detector.cc b/sdk/src/resource/resource_detector.cc index b7c7c7e614..cab8ce748a 100644 --- a/sdk/src/resource/resource_detector.cc +++ b/sdk/src/resource/resource_detector.cc @@ -4,7 +4,7 @@ #include "opentelemetry/sdk/resource/resource_detector.h" #include "opentelemetry/sdk/common/env_variables.h" #include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/semconv/service_attributes.h" #include "opentelemetry/version.h" #include @@ -55,7 +55,7 @@ Resource OTELResourceDetector::Detect() noexcept if (service_name_exists) { - attributes[SemanticConventions::kServiceName] = service_name; + attributes[semconv::service::kServiceName] = service_name; } return Resource(attributes); diff --git a/sdk/src/trace/batch_span_processor.cc b/sdk/src/trace/batch_span_processor.cc index 03b79f6ebb..f0f55d20e8 100644 --- a/sdk/src/trace/batch_span_processor.cc +++ b/sdk/src/trace/batch_span_processor.cc @@ -29,7 +29,6 @@ #include "opentelemetry/version.h" using opentelemetry::sdk::common::AtomicUniquePtr; -using opentelemetry::sdk::common::CircularBuffer; using opentelemetry::sdk::common::CircularBufferRange; using opentelemetry::trace::SpanContext; @@ -67,7 +66,7 @@ void BatchSpanProcessor::OnEnd(std::unique_ptr &&span) noexcept return; } - if (buffer_.Add(span) == false) + if (buffer_.Add(std::move(span)) == false) { OTEL_INTERNAL_LOG_WARN("BatchSpanProcessor queue is full - dropping span."); return; diff --git a/sdk/src/trace/samplers/parent.cc b/sdk/src/trace/samplers/parent.cc index a69ede92d4..9bffb7b030 100644 --- a/sdk/src/trace/samplers/parent.cc +++ b/sdk/src/trace/samplers/parent.cc @@ -22,7 +22,7 @@ namespace sdk { namespace trace { -ParentBasedSampler::ParentBasedSampler(std::shared_ptr delegate_sampler) noexcept +ParentBasedSampler::ParentBasedSampler(const std::shared_ptr &delegate_sampler) noexcept : delegate_sampler_(delegate_sampler), description_("ParentBased{" + std::string{delegate_sampler->GetDescription()} + "}") {} diff --git a/sdk/src/trace/samplers/parent_factory.cc b/sdk/src/trace/samplers/parent_factory.cc index 978fb75946..25a2e94f65 100644 --- a/sdk/src/trace/samplers/parent_factory.cc +++ b/sdk/src/trace/samplers/parent_factory.cc @@ -1,8 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/samplers/parent_factory.h" +#include + +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/parent.h" +#include "opentelemetry/sdk/trace/samplers/parent_factory.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -12,7 +15,7 @@ namespace trace { std::unique_ptr ParentBasedSamplerFactory::Create( - std::shared_ptr delegate_sampler) + const std::shared_ptr &delegate_sampler) { std::unique_ptr sampler(new ParentBasedSampler(delegate_sampler)); return sampler; diff --git a/sdk/src/trace/span.cc b/sdk/src/trace/span.cc index ca3a475707..2b9e9d2908 100644 --- a/sdk/src/trace/span.cc +++ b/sdk/src/trace/span.cc @@ -78,7 +78,7 @@ Span::Span(std::shared_ptr &&tracer, return true; }); - links.ForEachKeyValue([&](opentelemetry::trace::SpanContext span_context, + links.ForEachKeyValue([&](const opentelemetry::trace::SpanContext &span_context, const common::KeyValueIterable &attributes) { recordable_->AddLink(span_context, attributes); return true; diff --git a/sdk/src/trace/tracer.cc b/sdk/src/trace/tracer.cc index fd02548c7b..73fc08d5dc 100644 --- a/sdk/src/trace/tracer.cc +++ b/sdk/src/trace/tracer.cc @@ -39,7 +39,7 @@ namespace trace Tracer::Tracer(std::shared_ptr context, std::unique_ptr instrumentation_scope) noexcept - : instrumentation_scope_{std::move(instrumentation_scope)}, context_{context} + : instrumentation_scope_{std::move(instrumentation_scope)}, context_{std::move(context)} {} nostd::shared_ptr Tracer::StartSpan( diff --git a/sdk/src/trace/tracer_context.cc b/sdk/src/trace/tracer_context.cc index 0fb4fd35cf..65300d6f22 100644 --- a/sdk/src/trace/tracer_context.cc +++ b/sdk/src/trace/tracer_context.cc @@ -22,7 +22,7 @@ namespace trace namespace resource = opentelemetry::sdk::resource; TracerContext::TracerContext(std::vector> &&processors, - resource::Resource resource, + const resource::Resource &resource, std::unique_ptr sampler, std::unique_ptr id_generator) noexcept : resource_(resource), diff --git a/sdk/src/trace/tracer_provider.cc b/sdk/src/trace/tracer_provider.cc index 9440e3d469..3b5462a083 100644 --- a/sdk/src/trace/tracer_provider.cc +++ b/sdk/src/trace/tracer_provider.cc @@ -38,7 +38,7 @@ TracerProvider::TracerProvider(std::unique_ptr context) noexcept } TracerProvider::TracerProvider(std::unique_ptr processor, - resource::Resource resource, + const resource::Resource &resource, std::unique_ptr sampler, std::unique_ptr id_generator) noexcept { @@ -49,7 +49,7 @@ TracerProvider::TracerProvider(std::unique_ptr processor, } TracerProvider::TracerProvider(std::vector> &&processors, - resource::Resource resource, + const resource::Resource &resource, std::unique_ptr sampler, std::unique_ptr id_generator) noexcept { diff --git a/sdk/src/trace/tracer_provider_factory.cc b/sdk/src/trace/tracer_provider_factory.cc index eeb18a1e59..eaeb669b91 100644 --- a/sdk/src/trace/tracer_provider_factory.cc +++ b/sdk/src/trace/tracer_provider_factory.cc @@ -22,90 +22,6 @@ namespace sdk namespace trace { -#ifdef OPENTELEMETRY_DEPRECATED_SDK_FACTORY - -std::unique_ptr TracerProviderFactory::Create( - std::unique_ptr processor) -{ - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - return Create(std::move(processor), resource); -} - -std::unique_ptr TracerProviderFactory::Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource) -{ - auto sampler = AlwaysOnSamplerFactory::Create(); - return Create(std::move(processor), resource, std::move(sampler)); -} - -std::unique_ptr TracerProviderFactory::Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler) -{ - auto id_generator = RandomIdGeneratorFactory::Create(); - return Create(std::move(processor), resource, std::move(sampler), std::move(id_generator)); -} - -std::unique_ptr TracerProviderFactory::Create( - std::unique_ptr processor, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler, - std::unique_ptr id_generator) -{ - std::unique_ptr provider( - new opentelemetry::sdk::trace::TracerProvider(std::move(processor), resource, - std::move(sampler), std::move(id_generator))); - return provider; -} - -std::unique_ptr TracerProviderFactory::Create( - std::vector> &&processors) -{ - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - return Create(std::move(processors), resource); -} - -std::unique_ptr TracerProviderFactory::Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource) -{ - auto sampler = AlwaysOnSamplerFactory::Create(); - return Create(std::move(processors), resource, std::move(sampler)); -} - -std::unique_ptr TracerProviderFactory::Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler) -{ - auto id_generator = RandomIdGeneratorFactory::Create(); - return Create(std::move(processors), resource, std::move(sampler), std::move(id_generator)); -} - -std::unique_ptr TracerProviderFactory::Create( - std::vector> &&processors, - const opentelemetry::sdk::resource::Resource &resource, - std::unique_ptr sampler, - std::unique_ptr id_generator) -{ - std::unique_ptr provider( - new opentelemetry::sdk::trace::TracerProvider(std::move(processors), resource, - std::move(sampler), std::move(id_generator))); - return provider; -} - -std::unique_ptr TracerProviderFactory::Create( - std::unique_ptr context) -{ - std::unique_ptr provider( - new opentelemetry::sdk::trace::TracerProvider(std::move(context))); - return provider; -} - -#else - std::unique_ptr TracerProviderFactory::Create( std::unique_ptr processor) { @@ -186,8 +102,6 @@ std::unique_ptr TracerProviderFactory return provider; } -#endif /* OPENTELEMETRY_DEPRECATED_SDK_FACTORY */ - } // namespace trace } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/version/version.cc b/sdk/src/version/version.cc index e5fdbda99d..078bafe2ea 100644 --- a/sdk/src/version/version.cc +++ b/sdk/src/version/version.cc @@ -12,13 +12,13 @@ namespace sdk namespace version { const int major_version = 1; -const int minor_version = 16; +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.16.0"; -const char *full_version = "1.16.0-NONE-NONE"; -const char *build_date = "Fri Jun 21 16:41:17 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/sdk/test/common/attribute_utils_test.cc b/sdk/test/common/attribute_utils_test.cc index b7ef17244f..9b1f6bd56e 100644 --- a/sdk/test/common/attribute_utils_test.cc +++ b/sdk/test/common/attribute_utils_test.cc @@ -1,13 +1,17 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/common/attribute_utils.h" - #include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attribute_utils.h" TEST(AttributeMapTest, DefaultConstruction) { - opentelemetry::sdk::common::AttributeMap attribute_map; EXPECT_EQ(attribute_map.GetAttributes().size(), 0); } diff --git a/sdk/test/common/attributemap_hash_benchmark.cc b/sdk/test/common/attributemap_hash_benchmark.cc index 811ecb23dd..e0641fb961 100644 --- a/sdk/test/common/attributemap_hash_benchmark.cc +++ b/sdk/test/common/attributemap_hash_benchmark.cc @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #include + +#include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/common/attributemap_hash.h" using namespace opentelemetry::sdk::common; diff --git a/sdk/test/common/circular_buffer_benchmark.cc b/sdk/test/common/circular_buffer_benchmark.cc index 1f2b9b42cf..7ffc452135 100644 --- a/sdk/test/common/circular_buffer_benchmark.cc +++ b/sdk/test/common/circular_buffer_benchmark.cc @@ -1,18 +1,24 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "benchmark/benchmark.h" - +#include #include #include +#include +#include #include #include #include #include #include +#include "benchmark/benchmark.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/atomic_unique_ptr.h" #include "opentelemetry/sdk/common/circular_buffer.h" +#include "opentelemetry/sdk/common/circular_buffer_range.h" #include "test/common/baseline_circular_buffer.h" + using opentelemetry::sdk::common::AtomicUniquePtr; using opentelemetry::sdk::common::CircularBuffer; using opentelemetry::sdk::common::CircularBufferRange; diff --git a/sdk/test/common/circular_buffer_range_test.cc b/sdk/test/common/circular_buffer_range_test.cc index 5852704687..ed2f028978 100644 --- a/sdk/test/common/circular_buffer_range_test.cc +++ b/sdk/test/common/circular_buffer_range_test.cc @@ -1,11 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/common/circular_buffer_range.h" +#include -#include +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/circular_buffer_range.h" -#include using opentelemetry::sdk::common::CircularBufferRange; TEST(CircularBufferRangeTest, ForEach) diff --git a/sdk/test/common/circular_buffer_test.cc b/sdk/test/common/circular_buffer_test.cc index a20c3e42aa..8a3292ca60 100644 --- a/sdk/test/common/circular_buffer_test.cc +++ b/sdk/test/common/circular_buffer_test.cc @@ -1,14 +1,24 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/common/circular_buffer.h" - +#include +#include #include +#include #include +#include +#include +#include +#include #include #include +#include + +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/atomic_unique_ptr.h" +#include "opentelemetry/sdk/common/circular_buffer.h" +#include "opentelemetry/sdk/common/circular_buffer_range.h" -#include using opentelemetry::sdk::common::AtomicUniquePtr; using opentelemetry::sdk::common::CircularBuffer; using opentelemetry::sdk::common::CircularBufferRange; diff --git a/sdk/test/common/empty_attributes_test.cc b/sdk/test/common/empty_attributes_test.cc index f37ea0a5c4..894cafc8a7 100644 --- a/sdk/test/common/empty_attributes_test.cc +++ b/sdk/test/common/empty_attributes_test.cc @@ -15,5 +15,5 @@ TEST(EmptyAttributesTest, TestMemory) { auto attributes1 = opentelemetry::sdk::GetEmptyAttributes(); auto attributes2 = opentelemetry::sdk::GetEmptyAttributes(); - EXPECT_EQ(memcmp(&attributes1, &attributes2, sizeof(attributes1)), 0); + EXPECT_EQ(memcmp(&attributes1, &attributes2, sizeof(attributes1)), 0); // NOLINT } diff --git a/sdk/test/common/env_var_test.cc b/sdk/test/common/env_var_test.cc index 23d3802361..8f64dc1f10 100644 --- a/sdk/test/common/env_var_test.cc +++ b/sdk/test/common/env_var_test.cc @@ -1,9 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/common/env_variables.h" - #include +#include +#include +#include + +#include "opentelemetry/sdk/common/env_variables.h" #if defined(_MSC_VER) using opentelemetry::sdk::common::setenv; diff --git a/sdk/test/common/fast_random_number_generator_test.cc b/sdk/test/common/fast_random_number_generator_test.cc index e9209fdb6b..1f87ea13d7 100644 --- a/sdk/test/common/fast_random_number_generator_test.cc +++ b/sdk/test/common/fast_random_number_generator_test.cc @@ -1,11 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "src/common/random.h" - +#include +#include #include +#include +#include -#include +#include "src/common/fast_random_number_generator.h" using opentelemetry::sdk::common::FastRandomNumberGenerator; diff --git a/sdk/test/common/global_log_handle_test.cc b/sdk/test/common/global_log_handle_test.cc index 28b111cc71..3c3fc3d7f3 100644 --- a/sdk/test/common/global_log_handle_test.cc +++ b/sdk/test/common/global_log_handle_test.cc @@ -1,12 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/common/global_log_handler.h" - #include - #include +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" + class CustomLogHandler : public opentelemetry::sdk::common::internal_log::LogHandler { public: diff --git a/sdk/test/common/random_benchmark.cc b/sdk/test/common/random_benchmark.cc index df2ebf95ec..46dadbe260 100644 --- a/sdk/test/common/random_benchmark.cc +++ b/sdk/test/common/random_benchmark.cc @@ -1,12 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "src/common/random.h" - -#include +#include #include -#include +#include "src/common/random.h" namespace { diff --git a/sdk/test/common/random_fork_test.cc b/sdk/test/common/random_fork_test.cc index 2db8b9fcdf..15f7a43cf2 100644 --- a/sdk/test/common/random_fork_test.cc +++ b/sdk/test/common/random_fork_test.cc @@ -7,13 +7,13 @@ // See https://github.com/opentracing-contrib/nginx-opentracing/issues/52 # include "src/common/random.h" +# include # include -# include # include # include -# include # include # include + using opentelemetry::sdk::common::Random; static uint64_t *child_id; diff --git a/sdk/test/common/random_test.cc b/sdk/test/common/random_test.cc index 8132b2d5a4..85292babe4 100644 --- a/sdk/test/common/random_test.cc +++ b/sdk/test/common/random_test.cc @@ -1,12 +1,17 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "src/common/random.h" - +#include #include +#include +#include +#include #include +#include +#include + +#include "src/common/random.h" -#include using opentelemetry::sdk::common::Random; TEST(RandomTest, GenerateRandom64) @@ -34,3 +39,28 @@ TEST(RandomTest, GenerateRandomBuffer) std::equal(std::begin(buf1_vector), std::end(buf1_vector), std::begin(buf2_vector))); } } + +void doSomethingOnce(std::atomic_uint *count) +{ + static std::atomic_flag flag; + if (!flag.test_and_set()) + { + (*count)++; + } +} + +TEST(RandomTest, AtomicFlagMultiThreadTest) +{ + std::vector threads; + std::atomic_uint count(0); + threads.reserve(10); + for (int i = 0; i < 10; ++i) + { + threads.push_back(std::thread(doSomethingOnce, &count)); + } + for (auto &t : threads) + { + t.join(); + } + EXPECT_EQ(1, count.load()); +} diff --git a/sdk/test/instrumentationscope/instrumentationscope_test.cc b/sdk/test/instrumentationscope/instrumentationscope_test.cc index 2f376d5d6b..da00ec8e93 100644 --- a/sdk/test/instrumentationscope/instrumentationscope_test.cc +++ b/sdk/test/instrumentationscope/instrumentationscope_test.cc @@ -1,15 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/nostd/string_view.h" -#include "opentelemetry/sdk/instrumentationlibrary/instrumentation_library.h" -#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" - #include +#include +#include #include #include +#include #include +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/instrumentationlibrary/instrumentation_library.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" + using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/logs/batch_log_record_processor_test.cc b/sdk/test/logs/batch_log_record_processor_test.cc index 33db0da479..036146f4e6 100644 --- a/sdk/test/logs/batch_log_record_processor_test.cc +++ b/sdk/test/logs/batch_log_record_processor_test.cc @@ -1,14 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/logs/batch_log_record_processor.h" -#include "opentelemetry/sdk/logs/exporter.h" -#include "opentelemetry/sdk/logs/recordable.h" - #include +#include +#include #include +#include #include +#include #include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/atomic_unique_ptr.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/recordable.h" using namespace opentelemetry::sdk::logs; using namespace opentelemetry::sdk::common; @@ -74,10 +91,10 @@ class MockLogExporter final : public LogRecordExporter std::shared_ptr> is_shutdown, std::shared_ptr> is_export_completed, const std::chrono::milliseconds export_delay = std::chrono::milliseconds(0)) - : logs_received_(logs_received), - force_flush_counter_(force_flush_counter), - is_shutdown_(is_shutdown), - is_export_completed_(is_export_completed), + : logs_received_(std::move(logs_received)), + force_flush_counter_(std::move(force_flush_counter)), + is_shutdown_(std::move(is_shutdown)), + is_export_completed_(std::move(is_export_completed)), export_delay_(export_delay) {} @@ -154,7 +171,8 @@ class BatchLogRecordProcessorTest : public testing::Test // ::testing::Test { return std::shared_ptr(new BatchLogRecordProcessor( std::unique_ptr(new MockLogExporter( - logs_received, force_flush_counter, is_shutdown, is_export_completed, export_delay)), + std::move(logs_received), std::move(force_flush_counter), std::move(is_shutdown), + std::move(is_export_completed), export_delay)), max_queue_size, scheduled_delay_millis, max_export_batch_size)); } }; diff --git a/sdk/test/logs/log_record_test.cc b/sdk/test/logs/log_record_test.cc index bd9e462012..74af102e10 100644 --- a/sdk/test/logs/log_record_test.cc +++ b/sdk/test/logs/log_record_test.cc @@ -1,21 +1,33 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include #include -#include +#include +#include #include -#include +#include +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/event_id.h" +#include "opentelemetry/logs/log_record.h" #include "opentelemetry/logs/logger.h" -#include "opentelemetry/logs/provider.h" +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/nostd/utility.h" #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/logs/read_write_log_record.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" #include "opentelemetry/trace/trace_id.h" -#include - using opentelemetry::sdk::logs::ReadWriteLogRecord; namespace trace_api = opentelemetry::trace; namespace logs_api = opentelemetry::logs; diff --git a/sdk/test/logs/logger_provider_sdk_test.cc b/sdk/test/logs/logger_provider_sdk_test.cc index ecb9ea6f9c..a5a3d3a68a 100644 --- a/sdk/test/logs/logger_provider_sdk_test.cc +++ b/sdk/test/logs/logger_provider_sdk_test.cc @@ -1,20 +1,38 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include +#include +#include +#include +#include #include +#include +#include +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/logger_provider.h" #include "opentelemetry/logs/provider.h" +#include "opentelemetry/logs/severity.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/event_logger_provider.h" #include "opentelemetry/sdk/logs/event_logger_provider_factory.h" #include "opentelemetry/sdk/logs/exporter.h" #include "opentelemetry/sdk/logs/logger.h" +#include "opentelemetry/sdk/logs/logger_context.h" #include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/processor.h" #include "opentelemetry/sdk/logs/recordable.h" #include "opentelemetry/sdk/logs/simple_log_record_processor.h" - -#include +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" using namespace opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; diff --git a/sdk/test/logs/logger_sdk_test.cc b/sdk/test/logs/logger_sdk_test.cc index 62d523b92a..4af0fb3745 100644 --- a/sdk/test/logs/logger_sdk_test.cc +++ b/sdk/test/logs/logger_sdk_test.cc @@ -1,25 +1,44 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include #include #include - +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/event_logger.h" +#include "opentelemetry/logs/event_logger_provider.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/logger.h" #include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/logs/event_logger.h" #include "opentelemetry/sdk/logs/event_logger_provider.h" #include "opentelemetry/sdk/logs/logger.h" #include "opentelemetry/sdk/logs/logger_provider.h" #include "opentelemetry/sdk/logs/processor.h" #include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/trace/processor.h" #include "opentelemetry/sdk/trace/tracer_provider.h" #include "opentelemetry/sdk/trace/tracer_provider_factory.h" #include "opentelemetry/trace/scope.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" #include "opentelemetry/trace/tracer.h" -#include - using namespace opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; namespace nostd = opentelemetry::nostd; @@ -172,7 +191,7 @@ class MockProcessor final : public LogRecordProcessor public: // A processor used for testing that keeps a track of the recordable it received explicit MockProcessor(std::shared_ptr record_received) noexcept - : record_received_(record_received) + : record_received_(std::move(record_received)) {} std::unique_ptr MakeRecordable() noexcept override diff --git a/sdk/test/logs/simple_log_record_processor_test.cc b/sdk/test/logs/simple_log_record_processor_test.cc index 484cc63e71..b8a9f03e0c 100644 --- a/sdk/test/logs/simple_log_record_processor_test.cc +++ b/sdk/test/logs/simple_log_record_processor_test.cc @@ -1,15 +1,26 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/log_record.h" #include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" #include "opentelemetry/sdk/logs/exporter.h" #include "opentelemetry/sdk/logs/recordable.h" - -#include - -#include -#include +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" using namespace opentelemetry::sdk::logs; using namespace opentelemetry::sdk::common; @@ -75,7 +86,7 @@ class TestExporter final : public LogRecordExporter size_t *batch_size_received) : force_flush_counter_(force_flush_counter), shutdown_counter_(shutdown_counter), - logs_received_(logs_received), + logs_received_(std::move(logs_received)), batch_size_received(batch_size_received) {} diff --git a/sdk/test/metrics/BUILD b/sdk/test/metrics/BUILD index 3cf379494d..70d0cc063a 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/metrics/BUILD @@ -19,307 +19,8 @@ cc_library( ) cc_test( - name = "meter_test", - srcs = [ - "meter_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "meter_provider_sdk_test", - srcs = [ - "meter_provider_sdk_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "metric_reader_test", - srcs = [ - "metric_reader_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "histogram_test", - srcs = [ - "histogram_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "view_registry_test", - srcs = [ - "view_registry_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "aggregation_test", - srcs = [ - "aggregation_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "sync_metric_storage_counter_test", - srcs = [ - "sync_metric_storage_counter_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "sync_metric_storage_up_down_counter_test", - srcs = [ - "sync_metric_storage_up_down_counter_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "sync_metric_storage_histogram_test", - srcs = [ - "sync_metric_storage_histogram_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "sync_instruments_test", - srcs = [ - "sync_instruments_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "async_instruments_test", - srcs = [ - "async_instruments_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "async_metric_storage_test", - srcs = [ - "async_metric_storage_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "observer_result_test", - srcs = [ - "observer_result_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "multi_metric_storage_test", - srcs = [ - "multi_metric_storage_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "//sdk/src/resource", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "attributes_processor_test", - srcs = [ - "attributes_processor_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "attributes_hashmap_test", - srcs = [ - "attributes_hashmap_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "circular_buffer_counter_test", - srcs = [ - "circular_buffer_counter_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "//sdk/src/metrics", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "base2_exponential_histogram_indexer_test", - srcs = [ - "base2_exponential_histogram_indexer_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "histogram_aggregation_test", - srcs = [ - "histogram_aggregation_test.cc", - ], - tags = [ - "metrics", - "test", - ], - deps = [ - "metrics_common_test_utils", - "@com_google_googletest//:gtest_main", - ], -) - -cc_test( - name = "sum_aggregation_test", - srcs = [ - "sum_aggregation_test.cc", - ], + name = "all_tests", + srcs = glob(["*_test.cc"]), tags = [ "metrics", "test", diff --git a/sdk/test/metrics/CMakeLists.txt b/sdk/test/metrics/CMakeLists.txt index ccc31de689..9effa73a4c 100644 --- a/sdk/test/metrics/CMakeLists.txt +++ b/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/sdk/test/metrics/aggregation_test.cc b/sdk/test/metrics/aggregation_test.cc index d52cc9e732..d56f33545a 100644 --- a/sdk/test/metrics/aggregation_test.cc +++ b/sdk/test/metrics/aggregation_test.cc @@ -2,13 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include +#include + +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" #include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" #include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" #include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" #include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" - -#include "opentelemetry/nostd/shared_ptr.h" -#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" using namespace opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; diff --git a/sdk/test/metrics/async_instruments_test.cc b/sdk/test/metrics/async_instruments_test.cc index 10c0335559..cda08a1549 100644 --- a/sdk/test/metrics/async_instruments_test.cc +++ b/sdk/test/metrics/async_instruments_test.cc @@ -1,20 +1,33 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include + +#include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/nostd/utility.h" #include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" #include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" #include "opentelemetry/sdk/metrics/state/observable_registry.h" -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::metrics; using M = std::map; +namespace +{ +// NOLINTNEXTLINE void asyc_generate_measurements(opentelemetry::metrics::ObserverResult /* observer */, void * /* state */) {} +} // namespace TEST(AsyncInstruments, ObservableInstrument) { diff --git a/sdk/test/metrics/async_metric_storage_test.cc b/sdk/test/metrics/async_metric_storage_test.cc index 3b72e99d96..912310415a 100644 --- a/sdk/test/metrics/async_metric_storage_test.cc +++ b/sdk/test/metrics/async_metric_storage_test.cc @@ -1,30 +1,37 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" -#include "opentelemetry/common/key_value_iterable_view.h" -#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW # include "opentelemetry/sdk/metrics/exemplar/filter_type.h" # include "opentelemetry/sdk/metrics/exemplar/reservoir.h" #endif -#include "opentelemetry/sdk/metrics/instruments.h" -#include "opentelemetry/sdk/metrics/meter_context.h" -#include "opentelemetry/sdk/metrics/metric_reader.h" -#include "opentelemetry/sdk/metrics/observer_result.h" -#include "opentelemetry/sdk/metrics/push_metric_exporter.h" -#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" -#include "opentelemetry/sdk/metrics/state/metric_collector.h" -#include "opentelemetry/sdk/metrics/state/observable_registry.h" - -#include -#include -#include -#include - using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::resource; @@ -262,7 +269,7 @@ TEST_P(WritableMetricStorageTestObservableGaugeFixture, TestAggregation) opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now())); storage.Collect( - collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData metric_data) { + collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData &metric_data) { for (auto data_attr : metric_data.point_data_attr_) { auto data = opentelemetry::nostd::get(data_attr.point_data); @@ -288,7 +295,7 @@ TEST_P(WritableMetricStorageTestObservableGaugeFixture, TestAggregation) storage.RecordLong(measurements2, opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now())); storage.Collect( - collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData metric_data) { + collector.get(), collectors, sdk_start_ts, collection_ts, [&](const MetricData &metric_data) { for (auto data_attr : metric_data.point_data_attr_) { auto data = opentelemetry::nostd::get(data_attr.point_data); diff --git a/sdk/test/metrics/attributes_hashmap_benchmark.cc b/sdk/test/metrics/attributes_hashmap_benchmark.cc index 5dc02ca5be..ed080d911d 100644 --- a/sdk/test/metrics/attributes_hashmap_benchmark.cc +++ b/sdk/test/metrics/attributes_hashmap_benchmark.cc @@ -2,17 +2,22 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include "opentelemetry/sdk/common/attributemap_hash.h" -#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" -#include "opentelemetry/sdk/metrics/instruments.h" -#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" - +#include +#include +#include #include +#include #include #include #include +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + using namespace opentelemetry::sdk::metrics; constexpr size_t MAX_THREADS = 500; namespace diff --git a/sdk/test/metrics/attributes_hashmap_test.cc b/sdk/test/metrics/attributes_hashmap_test.cc index 7e03deed47..c7f0f01ee5 100644 --- a/sdk/test/metrics/attributes_hashmap_test.cc +++ b/sdk/test/metrics/attributes_hashmap_test.cc @@ -1,19 +1,30 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" #include -#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" -#include "opentelemetry/sdk/metrics/instruments.h" - +#include +#include #include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" using namespace opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; TEST(AttributesHashMap, BasicTests) { - // Empty map AttributesHashMap hash_map; EXPECT_EQ(hash_map.Size(), 0); @@ -27,14 +38,14 @@ TEST(AttributesHashMap, BasicTests) std::unique_ptr aggregation1( new DropAggregation()); // = std::unique_ptr(new DropAggregation); hash_map.Set(m1, std::move(aggregation1), hash); - EXPECT_NO_THROW(hash_map.Get(hash)->Aggregate(static_cast(1))); + hash_map.Get(hash)->Aggregate(static_cast(1)); EXPECT_EQ(hash_map.Size(), 1); EXPECT_EQ(hash_map.Has(hash), true); // Set same key again auto aggregation2 = std::unique_ptr(new DropAggregation()); hash_map.Set(m1, std::move(aggregation2), hash); - EXPECT_NO_THROW(hash_map.Get(hash)->Aggregate(static_cast(1))); + hash_map.Get(hash)->Aggregate(static_cast(1)); EXPECT_EQ(hash_map.Size(), 1); EXPECT_EQ(hash_map.Has(hash), true); @@ -45,7 +56,7 @@ TEST(AttributesHashMap, BasicTests) hash_map.Set(m3, std::move(aggregation3), hash3); EXPECT_EQ(hash_map.Has(hash), true); EXPECT_EQ(hash_map.Has(hash3), true); - EXPECT_NO_THROW(hash_map.Get(hash3)->Aggregate(static_cast(1))); + hash_map.Get(hash3)->Aggregate(static_cast(1)); EXPECT_EQ(hash_map.Size(), 2); // GetOrSetDefault @@ -55,8 +66,8 @@ TEST(AttributesHashMap, BasicTests) }; MetricAttributes m4 = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}}; auto hash4 = opentelemetry::sdk::common::GetHashForAttributeMap(m4); - EXPECT_NO_THROW(hash_map.GetOrSetDefault(m4, create_default_aggregation, hash4) - ->Aggregate(static_cast(1))); + hash_map.GetOrSetDefault(m4, create_default_aggregation, hash4) + ->Aggregate(static_cast(1)); EXPECT_EQ(hash_map.Size(), 3); // Set attributes with different order - shouldn't create a new entry. @@ -73,3 +84,78 @@ TEST(AttributesHashMap, BasicTests) }); EXPECT_EQ(count, hash_map.Size()); } + +std::string make_unique_string(const char *str) +{ + return std::string(str); +} + +TEST(AttributesHashMap, HashWithKeyValueIterable) +{ + std::string key1 = make_unique_string("k1"); + std::string value1 = make_unique_string("v1"); + std::string key2 = make_unique_string("k2"); + std::string value2 = make_unique_string("v2"); + std::string key3 = make_unique_string("k3"); + std::string value3 = make_unique_string("v3"); + + // Create mock KeyValueIterable instances with the same content but different variables + std::map attributes1({{key1, value1}, {key2, value2}}); + std::map attributes2({{key1, value1}, {key2, value2}}); + std::map attributes3({{key1, value1}, {key2, value2}, {key3, value3}}); + + // Create a callback that filters "k3" key + auto is_key_filter_k3_callback = [](nostd::string_view key) { + if (key == "k3") + { + return false; + } + return true; + }; + // Calculate hash + size_t hash1 = opentelemetry::sdk::common::GetHashForAttributeMap( + opentelemetry::common::KeyValueIterableView>(attributes1), + is_key_filter_k3_callback); + size_t hash2 = opentelemetry::sdk::common::GetHashForAttributeMap( + opentelemetry::common::KeyValueIterableView>(attributes2), + is_key_filter_k3_callback); + + size_t hash3 = opentelemetry::sdk::common::GetHashForAttributeMap( + opentelemetry::common::KeyValueIterableView>(attributes3), + is_key_filter_k3_callback); + + // Expect the hashes to be the same because the content is the same + EXPECT_EQ(hash1, hash2); + // Expect the hashes to be the same because the content is the same + EXPECT_EQ(hash1, hash3); +} + +TEST(AttributesHashMap, HashConsistencyAcrossStringTypes) +{ + const char *c_str = "teststring"; + std::string std_str = "teststring"; + nostd::string_view nostd_str_view = "teststring"; +#if __cplusplus >= 201703L + std::string_view std_str_view = "teststring"; +#endif + + size_t hash_c_str = 0; + size_t hash_std_str = 0; + size_t hash_nostd_str_view = 0; +#if __cplusplus >= 201703L + size_t hash_std_str_view = 0; +#endif + + opentelemetry::sdk::common::GetHash(hash_c_str, c_str); + opentelemetry::sdk::common::GetHash(hash_std_str, std_str); + opentelemetry::sdk::common::GetHash(hash_nostd_str_view, nostd_str_view); +#if __cplusplus >= 201703L + opentelemetry::sdk::common::GetHash(hash_std_str_view, std_str_view); +#endif + + EXPECT_EQ(hash_c_str, hash_std_str); + EXPECT_EQ(hash_c_str, hash_nostd_str_view); +#if __cplusplus >= 201703L + EXPECT_EQ(hash_c_str, hash_std_str_view); +#endif +} diff --git a/sdk/test/metrics/attributes_processor_benchmark.cc b/sdk/test/metrics/attributes_processor_benchmark.cc index 28f1984b40..708549406b 100644 --- a/sdk/test/metrics/attributes_processor_benchmark.cc +++ b/sdk/test/metrics/attributes_processor_benchmark.cc @@ -3,7 +3,12 @@ #include #include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" #include "opentelemetry/sdk/metrics/view/attributes_processor.h" + using namespace opentelemetry::sdk::metrics; namespace { diff --git a/sdk/test/metrics/attributes_processor_test.cc b/sdk/test/metrics/attributes_processor_test.cc index 62c0879ca9..5299af1358 100644 --- a/sdk/test/metrics/attributes_processor_test.cc +++ b/sdk/test/metrics/attributes_processor_test.cc @@ -1,8 +1,17 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/view/attributes_processor.h" #include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; diff --git a/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc b/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc index 9f1d0d864d..40ea14d575 100644 --- a/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc +++ b/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc @@ -1,12 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h" - #include +#include #include #include +#include "opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h" + using namespace opentelemetry::sdk::metrics; namespace { diff --git a/sdk/test/metrics/base2_exponential_histogram_indexer_test.cc b/sdk/test/metrics/base2_exponential_histogram_indexer_test.cc index 85f6fe72e9..716985e7cf 100644 --- a/sdk/test/metrics/base2_exponential_histogram_indexer_test.cc +++ b/sdk/test/metrics/base2_exponential_histogram_indexer_test.cc @@ -1,9 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h" - #include +#include +#include + +#include "opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/metrics/cardinality_limit_test.cc b/sdk/test/metrics/cardinality_limit_test.cc index 8c2edb4b0c..926062709b 100644 --- a/sdk/test/metrics/cardinality_limit_test.cc +++ b/sdk/test/metrics/cardinality_limit_test.cc @@ -1,18 +1,39 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" + +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" #include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" -#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" -#endif +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" #include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" -#include -#include +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" +#endif using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -26,7 +47,7 @@ TEST(CardinalityLimit, AttributesHashMapBasicTests) return std::unique_ptr(new LongSumAggregation(true)); }; // add 10 unique metric points. 9 should be added to hashmap, 10th should be overflow. - long record_value = 100; + int64_t record_value = 100; for (auto i = 0; i < 10; i++) { FilteredOrderedAttributeMap attributes = {{"key", std::to_string(i)}}; @@ -47,14 +68,47 @@ TEST(CardinalityLimit, AttributesHashMapBasicTests) ->Aggregate(record_value); } EXPECT_EQ(hash_map.Size(), 10); // only one more metric point should be added as overflow. + // record 5 more measurements to already existing (and not-overflow) metric points. They + // should get aggregated to these existing metric points. + for (auto i = 0; i < 5; i++) + { + FilteredOrderedAttributeMap attributes = {{"key", std::to_string(i)}}; + auto hash = opentelemetry::sdk::common::GetHashForAttributeMap(attributes); + static_cast( + hash_map.GetOrSetDefault(attributes, aggregation_callback, hash)) + ->Aggregate(record_value); + } + EXPECT_EQ(hash_map.Size(), 10); // no new metric point added + // get the overflow metric point - auto agg = hash_map.GetOrSetDefault( + auto agg1 = hash_map.GetOrSetDefault( FilteredOrderedAttributeMap({{kAttributesLimitOverflowKey, kAttributesLimitOverflowValue}}), aggregation_callback, kOverflowAttributesHash); - EXPECT_NE(agg, nullptr); - auto sum_agg = static_cast(agg); - EXPECT_EQ(nostd::get(nostd::get(sum_agg->ToPoint()).value_), + EXPECT_NE(agg1, nullptr); + auto sum_agg1 = static_cast(agg1); + EXPECT_EQ(nostd::get(nostd::get(sum_agg1->ToPoint()).value_), record_value * 6); // 1 from previous 10, 5 from current 5. + // get remaining metric points + for (auto i = 0; i < 9; i++) + { + FilteredOrderedAttributeMap attributes = {{"key", std::to_string(i)}}; + auto hash = opentelemetry::sdk::common::GetHashForAttributeMap(attributes); + auto agg2 = hash_map.GetOrSetDefault( + FilteredOrderedAttributeMap({{kAttributesLimitOverflowKey, kAttributesLimitOverflowValue}}), + aggregation_callback, hash); + EXPECT_NE(agg2, nullptr); + auto sum_agg2 = static_cast(agg2); + if (i < 5) + { + EXPECT_EQ(nostd::get(nostd::get(sum_agg2->ToPoint()).value_), + record_value * 2); // 1 from first recording, 1 from third recording + } + else + { + EXPECT_EQ(nostd::get(nostd::get(sum_agg2->ToPoint()).value_), + record_value); // 1 from first recording + } + } } class WritableMetricStorageCardinalityLimitTestFixture @@ -76,7 +130,7 @@ TEST_P(WritableMetricStorageCardinalityLimitTestFixture, LongCounterSumAggregati #endif nullptr, attributes_limit); - long record_value = 100; + int64_t record_value = 100; // add 9 unique metric points, and 6 more above limit. for (auto i = 0; i < 15; i++) { diff --git a/sdk/test/metrics/circular_buffer_counter_test.cc b/sdk/test/metrics/circular_buffer_counter_test.cc index a8218d9e6b..38b6000d3e 100644 --- a/sdk/test/metrics/circular_buffer_counter_test.cc +++ b/sdk/test/metrics/circular_buffer_counter_test.cc @@ -1,11 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/data/circular_buffer.h" - #include +#include #include +#include "opentelemetry/sdk/metrics/data/circular_buffer.h" + using namespace opentelemetry::sdk::metrics; class AdaptingIntegerArrayTest : public testing::TestWithParam diff --git a/sdk/test/metrics/common.cc b/sdk/test/metrics/common.cc index 87343f6186..8aff2f91fa 100644 --- a/sdk/test/metrics/common.cc +++ b/sdk/test/metrics/common.cc @@ -2,8 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #include "common.h" +#include + +#include "opentelemetry/sdk/metrics/data/point_data.h" -using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::common; diff --git a/sdk/test/metrics/common.h b/sdk/test/metrics/common.h index b3b73e15d6..ff2060e285 100644 --- a/sdk/test/metrics/common.h +++ b/sdk/test/metrics/common.h @@ -3,13 +3,16 @@ #pragma once -#include "opentelemetry/sdk/metrics/data/point_data.h" +#include +#include + +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" #include "opentelemetry/sdk/metrics/state/metric_collector.h" -#include - class MockMetricExporter : public opentelemetry::sdk::metrics::PushMetricExporter { public: diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index f85a4f4706..80ebb59069 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -1,18 +1,29 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" -#include -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/metrics/histogram_aggregation_test.cc b/sdk/test/metrics/histogram_aggregation_test.cc index 6fd13c902c..264e223ccc 100644 --- a/sdk/test/metrics/histogram_aggregation_test.cc +++ b/sdk/test/metrics/histogram_aggregation_test.cc @@ -1,17 +1,30 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/macros.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" - -#include +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" #if OPENTELEMETRY_HAVE_WORKING_REGEX diff --git a/sdk/test/metrics/histogram_test.cc b/sdk/test/metrics/histogram_test.cc index 4daceb685b..0b13664a32 100644 --- a/sdk/test/metrics/histogram_test.cc +++ b/sdk/test/metrics/histogram_test.cc @@ -1,21 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include #include "common.h" #include "opentelemetry/common/macros.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" - -#include - -#if OPENTELEMETRY_HAVE_WORKING_REGEX -# include -#endif +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -134,6 +144,66 @@ TEST(Histogram, DoubleCustomBuckets) ASSERT_EQ(std::vector({10, 20, 30, 40}), actual.boundaries_); ASSERT_EQ(std::vector({2, 2, 2, 2, 2}), actual.counts_); } + +TEST(Histogram, DoubleEmptyBuckets) +{ + MeterProvider mp; + auto m = mp.GetMeter("meter1", "version1", "schema1"); + std::string instrument_unit = "ms"; + std::string instrument_name = "historgram1"; + std::string instrument_desc = "histogram metrics"; + + std::unique_ptr exporter(new MockMetricExporter()); + std::shared_ptr reader{new MockMetricReader(std::move(exporter))}; + mp.AddMetricReader(reader); + + std::shared_ptr config(new HistogramAggregationConfig()); + config->boundaries_ = {}; + std::unique_ptr view{ + new View("view1", "view1_description", instrument_unit, AggregationType::kHistogram, config)}; + std::unique_ptr instrument_selector{ + new InstrumentSelector(InstrumentType::kHistogram, instrument_name, instrument_unit)}; + std::unique_ptr meter_selector{new MeterSelector("meter1", "version1", "schema1")}; + mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view)); + + auto h = m->CreateDoubleHistogram(instrument_name, instrument_desc, instrument_unit); + + h->Record(-5, {}); + h->Record(10, {}); + h->Record(15, {}); + h->Record(20, {}); + h->Record(25, {}); + h->Record(30, {}); + h->Record(35, {}); + h->Record(40, {}); + h->Record(45, {}); + h->Record(50, {}); + + std::vector actuals; + reader->Collect([&](ResourceMetrics &rm) { + for (const ScopeMetrics &smd : rm.scope_metric_data_) + { + for (const MetricData &md : smd.metric_data_) + { + for (const PointDataAttributes &dp : md.point_data_attr_) + { + actuals.push_back(opentelemetry::nostd::get(dp.point_data)); + } + } + } + return true; + }); + + ASSERT_EQ(1, actuals.size()); + + const auto &actual = actuals.at(0); + ASSERT_EQ(270.0, opentelemetry::nostd::get(actual.sum_)); + ASSERT_EQ(9, actual.count_); + ASSERT_EQ(10.0, opentelemetry::nostd::get(actual.min_)); + ASSERT_EQ(50.0, opentelemetry::nostd::get(actual.max_)); + ASSERT_EQ(std::vector({}), actual.boundaries_); + ASSERT_EQ(std::vector({9}), actual.counts_); +} #endif TEST(Histogram, UInt64) @@ -249,4 +319,64 @@ TEST(Histogram, UInt64CustomBuckets) ASSERT_EQ(std::vector({10, 20, 30, 40}), actual.boundaries_); ASSERT_EQ(std::vector({2, 2, 2, 2, 2}), actual.counts_); } + +TEST(Histogram, UInt64EmptyBuckets) +{ + MeterProvider mp; + auto m = mp.GetMeter("meter1", "version1", "schema1"); + std::string instrument_name = "historgram1"; + std::string instrument_desc = "histogram metrics"; + std::string instrument_unit = "ms"; + + std::unique_ptr exporter(new MockMetricExporter()); + std::shared_ptr reader{new MockMetricReader(std::move(exporter))}; + mp.AddMetricReader(reader); + + std::shared_ptr config(new HistogramAggregationConfig()); + config->boundaries_ = {}; + std::unique_ptr view{ + new View("view1", "view1_description", "ms", AggregationType::kHistogram, config)}; + std::unique_ptr instrument_selector{ + new InstrumentSelector(InstrumentType::kHistogram, instrument_name, instrument_unit)}; + std::unique_ptr meter_selector{new MeterSelector("meter1", "version1", "schema1")}; + mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view)); + + auto h = m->CreateUInt64Histogram(instrument_name, instrument_desc, instrument_unit); + + h->Record(5, {}); + h->Record(10, {}); + h->Record(15, {}); + h->Record(20, {}); + h->Record(25, {}); + h->Record(30, {}); + h->Record(35, {}); + h->Record(40, {}); + h->Record(45, {}); + h->Record(50, {}); + + std::vector actuals; + reader->Collect([&](ResourceMetrics &rm) { + for (const ScopeMetrics &smd : rm.scope_metric_data_) + { + for (const MetricData &md : smd.metric_data_) + { + for (const PointDataAttributes &dp : md.point_data_attr_) + { + actuals.push_back(opentelemetry::nostd::get(dp.point_data)); + } + } + } + return true; + }); + + ASSERT_EQ(1, actuals.size()); + + const auto &actual = actuals.at(0); + ASSERT_EQ(275, opentelemetry::nostd::get(actual.sum_)); + ASSERT_EQ(10, actual.count_); + ASSERT_EQ(5, opentelemetry::nostd::get(actual.min_)); + ASSERT_EQ(50, opentelemetry::nostd::get(actual.max_)); + ASSERT_EQ(std::vector({}), actual.boundaries_); + ASSERT_EQ(std::vector({10}), actual.counts_); +} #endif diff --git a/sdk/test/metrics/instrument_metadata_validator_test.cc b/sdk/test/metrics/instrument_metadata_validator_test.cc index 172df1af3c..1ecdc17025 100644 --- a/sdk/test/metrics/instrument_metadata_validator_test.cc +++ b/sdk/test/metrics/instrument_metadata_validator_test.cc @@ -1,8 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" #include +#include +#include +#include + +#include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" static std::string CreateVeryLargeString(size_t multiple) { @@ -19,9 +23,9 @@ TEST(InstrumentMetadataValidator, TestName) { opentelemetry::sdk::metrics::InstrumentMetaDataValidator validator; std::vector invalid_names = { - "", // empty string - "1sdf", // string starting with number - "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42" // unicode characters + "", // empty string + "1sdf", // string starting with number + "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42", // unicode characters "/\\sdsd", // string starting with special character "***sSSs", // string starting with special character "a\\broken\\path", // contains backward slash diff --git a/sdk/test/metrics/measurements_benchmark.cc b/sdk/test/metrics/measurements_benchmark.cc index 06ac75a65a..15d96130b5 100644 --- a/sdk/test/metrics/measurements_benchmark.cc +++ b/sdk/test/metrics/measurements_benchmark.cc @@ -1,15 +1,30 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" -#include "opentelemetry/sdk/metrics/push_metric_exporter.h" - -#include -#include -#include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index 60ac7ab46f..36cb28c228 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,16 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include #include "common.h" -#include -#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" #include "opentelemetry/sdk/metrics/view/instrument_selector.h" #include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index 084f50fc09..e8dc605e65 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,16 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/metrics/async_instruments.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/meter_provider.h" +#include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/metrics/sync_instruments.h" // IWYU pragma: keep +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; @@ -18,7 +33,7 @@ using namespace opentelemetry::sdk::metrics; namespace { nostd::shared_ptr InitMeter(MetricReader **metricReaderPtr, - std::string meter_name = "meter_name") + const std::string &meter_name = "meter_name") { static std::shared_ptr provider(new MeterProvider()); std::unique_ptr metric_reader(new MockMetricReader()); @@ -28,7 +43,6 @@ nostd::shared_ptr InitMeter(MetricReader **metricReaderPtr, auto meter = provider->GetMeter(meter_name); return meter; } -} // namespace void asyc_generate_measurements(opentelemetry::metrics::ObserverResult observer, void * /* state */) { @@ -36,6 +50,7 @@ void asyc_generate_measurements(opentelemetry::metrics::ObserverResult observer, nostd::get>>(observer); observer_long->Observe(10); } +} // namespace TEST(MeterTest, BasicAsyncTests) { diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 061d505a1d..330bca7818 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,12 +1,18 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include #include "common.h" -#include +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter_context.h" #include "opentelemetry/sdk/metrics/metric_reader.h" -#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -25,5 +31,5 @@ TEST(MetricReaderTest, BasicTests) std::shared_ptr meter_context2(new MeterContext()); std::shared_ptr metric_producer{ new MetricCollector(meter_context2.get(), std::move(metric_reader2))}; - metric_producer->Collect([](ResourceMetrics & /* metric_data */) { return true; }); + metric_producer->Produce(); } diff --git a/sdk/test/metrics/multi_metric_storage_test.cc b/sdk/test/metrics/multi_metric_storage_test.cc index 97c5a438ee..3eaf91ee33 100644 --- a/sdk/test/metrics/multi_metric_storage_test.cc +++ b/sdk/test/metrics/multi_metric_storage_test.cc @@ -1,18 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" -#include "opentelemetry/common/key_value_iterable_view.h" +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable.h" #include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" +#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW # include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" #endif // ENABLE_METRICS_EXEMPLAR_PREVIEW -#include "opentelemetry/sdk/metrics/instruments.h" - -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/metrics/observable_registry_test.cc b/sdk/test/metrics/observable_registry_test.cc index 6b6efb755a..23957b8275 100644 --- a/sdk/test/metrics/observable_registry_test.cc +++ b/sdk/test/metrics/observable_registry_test.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/state/observable_registry.h" -#include "opentelemetry/metrics/observer_result.h" - #include +#include "opentelemetry/sdk/metrics/state/observable_registry.h" + using namespace opentelemetry::sdk::metrics; #if 0 diff --git a/sdk/test/metrics/observer_result_test.cc b/sdk/test/metrics/observer_result_test.cc index eea56738b9..73b7b86ec5 100644 --- a/sdk/test/metrics/observer_result_test.cc +++ b/sdk/test/metrics/observer_result_test.cc @@ -1,11 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/observer_result.h" #include "opentelemetry/sdk/metrics/view/attributes_processor.h" -#include - using namespace opentelemetry::sdk::metrics; TEST(ObserverResult, BasicTests) { diff --git a/sdk/test/metrics/periodic_exporting_metric_reader_test.cc b/sdk/test/metrics/periodic_exporting_metric_reader_test.cc index e115f79f75..4e92ecd683 100644 --- a/sdk/test/metrics/periodic_exporting_metric_reader_test.cc +++ b/sdk/test/metrics/periodic_exporting_metric_reader_test.cc @@ -1,12 +1,25 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader_options.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; @@ -14,8 +27,14 @@ using namespace opentelemetry::sdk::metrics; class MockPushMetricExporter : public PushMetricExporter { public: + MockPushMetricExporter(std::chrono::milliseconds wait) : wait_(wait) {} + opentelemetry::sdk::common::ExportResult Export(const ResourceMetrics &record) noexcept override { + if (wait_ > std::chrono::milliseconds::zero()) + { + std::this_thread::sleep_for(wait_); + } records_.push_back(record); return opentelemetry::sdk::common::ExportResult::kSuccess; } @@ -34,44 +53,61 @@ class MockPushMetricExporter : public PushMetricExporter private: std::vector records_; + std::chrono::milliseconds wait_; }; class MockMetricProducer : public MetricProducer { public: MockMetricProducer(std::chrono::microseconds sleep_ms = std::chrono::microseconds::zero()) - : sleep_ms_{sleep_ms}, data_sent_size_(0) + : sleep_ms_{sleep_ms} {} - bool Collect(nostd::function_ref callback) noexcept override + MetricProducer::Result Produce() noexcept override { std::this_thread::sleep_for(sleep_ms_); data_sent_size_++; ResourceMetrics data; - callback(data); - return true; + return {data, MetricProducer::Status::kSuccess}; } size_t GetDataCount() { return data_sent_size_; } private: std::chrono::microseconds sleep_ms_; - size_t data_sent_size_; + size_t data_sent_size_{0}; }; TEST(PeriodicExporingMetricReader, BasicTests) { - std::unique_ptr exporter(new MockPushMetricExporter()); + std::unique_ptr exporter( + new MockPushMetricExporter(std::chrono::milliseconds{0})); PeriodicExportingMetricReaderOptions options; options.export_timeout_millis = std::chrono::milliseconds(200); options.export_interval_millis = std::chrono::milliseconds(500); auto exporter_ptr = exporter.get(); - PeriodicExportingMetricReader reader(std::move(exporter), options); + std::shared_ptr reader = + std::make_shared(std::move(exporter), options); MockMetricProducer producer; - reader.SetMetricProducer(&producer); + reader->SetMetricProducer(&producer); std::this_thread::sleep_for(std::chrono::milliseconds(2000)); - EXPECT_NO_THROW(reader.ForceFlush()); - reader.Shutdown(); + reader->ForceFlush(); + reader->Shutdown(); EXPECT_EQ(static_cast(exporter_ptr)->GetDataCount(), static_cast(&producer)->GetDataCount()); } + +TEST(PeriodicExporingMetricReader, Timeout) +{ + std::unique_ptr exporter( + new MockPushMetricExporter(std::chrono::milliseconds{2000})); + PeriodicExportingMetricReaderOptions options; + options.export_timeout_millis = std::chrono::milliseconds(200); + options.export_interval_millis = std::chrono::milliseconds(500); + std::shared_ptr reader = + std::make_shared(std::move(exporter), options); + MockMetricProducer producer; + reader->SetMetricProducer(&producer); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + reader->Shutdown(); +} diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index 728b3542a1..b2e44b15e5 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -1,19 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" -#include -#include -#include - using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/metrics/sum_aggregation_test.cc b/sdk/test/metrics/sum_aggregation_test.cc index 33a111974e..73caebbe7e 100644 --- a/sdk/test/metrics/sum_aggregation_test.cc +++ b/sdk/test/metrics/sum_aggregation_test.cc @@ -1,17 +1,35 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/macros.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" #include "opentelemetry/sdk/metrics/data/point_data.h" -#include "opentelemetry/sdk/metrics/meter.h" -#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" - -#include +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" #if OPENTELEMETRY_HAVE_WORKING_REGEX diff --git a/sdk/test/metrics/sync_instruments_test.cc b/sdk/test/metrics/sync_instruments_test.cc index 723d29f20e..22a05988dc 100644 --- a/sdk/test/metrics/sync_instruments_test.cc +++ b/sdk/test/metrics/sync_instruments_test.cc @@ -1,15 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/sync_instruments.h" +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/utility.h" #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" #include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" - -#include -#include -#include +#include "opentelemetry/sdk/metrics/sync_instruments.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -105,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/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 2593b69719..ee6c2ed57b 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -1,24 +1,34 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" -#include +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/context/context.h" -#include "opentelemetry/nostd/shared_ptr.h" - -#if ENABLE_METRICS_EXEMPLAR_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" -#endif - +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" #include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" #include "opentelemetry/sdk/metrics/view/attributes_processor.h" -#include -#include +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" +# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +#endif using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; diff --git a/sdk/test/metrics/sync_metric_storage_gauge_test.cc b/sdk/test/metrics/sync_metric_storage_gauge_test.cc new file mode 100644 index 0000000000..db20637e82 --- /dev/null +++ b/sdk/test/metrics/sync_metric_storage_gauge_test.cc @@ -0,0 +1,195 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +# include +# include +# include "common.h" + +# include "opentelemetry/common/key_value_iterable_view.h" +# include "opentelemetry/nostd/shared_ptr.h" +# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#endif + +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/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index 71a16b85c6..34145743d9 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -1,24 +1,35 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable_view.h" -#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW # include "opentelemetry/sdk/metrics/exemplar/filter_type.h" # include "opentelemetry/sdk/metrics/exemplar/reservoir.h" #endif -#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; using M = std::map; diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index 216574a587..4732e5b9f2 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,22 +1,33 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "common.h" +#include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable_view.h" -#include "opentelemetry/nostd/shared_ptr.h" - -#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" -#endif - +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" #include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" #include "opentelemetry/sdk/metrics/view/attributes_processor.h" -#include -#include -#include +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +# include "opentelemetry/sdk/metrics/exemplar/filter_type.h" +#endif using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -71,7 +82,7 @@ TEST_P(WritableMetricStorageTestFixture, LongUpDownCounterSumAggregation) 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 data) { + [&](const MetricData &data) { for (auto data_attr : data.point_data_attr_) { auto sum_data = opentelemetry::nostd::get(data_attr.point_data); @@ -105,7 +116,7 @@ TEST_P(WritableMetricStorageTestFixture, LongUpDownCounterSumAggregation) collection_ts = std::chrono::system_clock::now(); count_attributes = 0; storage.Collect(collector.get(), collectors, sdk_start_ts, collection_ts, - [&](const MetricData data) { + [&](const MetricData &data) { if (temporality == AggregationTemporality::kCumulative) { EXPECT_EQ(data.start_ts, sdk_start_ts); @@ -147,7 +158,7 @@ TEST_P(WritableMetricStorageTestFixture, LongUpDownCounterSumAggregation) collection_ts = std::chrono::system_clock::now(); count_attributes = 0; storage.Collect(collector.get(), collectors, sdk_start_ts, collection_ts, - [&](const MetricData data) { + [&](const MetricData &data) { for (auto data_attr : data.point_data_attr_) { auto sum_data = opentelemetry::nostd::get(data_attr.point_data); @@ -224,7 +235,7 @@ TEST_P(WritableMetricStorageTestFixture, DoubleUpDownCounterSumAggregation) 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 data) { + [&](const MetricData &data) { for (auto data_attr : data.point_data_attr_) { auto sum_data = opentelemetry::nostd::get(data_attr.point_data); @@ -259,7 +270,7 @@ TEST_P(WritableMetricStorageTestFixture, DoubleUpDownCounterSumAggregation) collection_ts = std::chrono::system_clock::now(); count_attributes = 0; storage.Collect(collector.get(), collectors, sdk_start_ts, collection_ts, - [&](const MetricData data) { + [&](const MetricData &data) { if (temporality == AggregationTemporality::kCumulative) { EXPECT_EQ(data.start_ts, sdk_start_ts); @@ -301,7 +312,7 @@ TEST_P(WritableMetricStorageTestFixture, DoubleUpDownCounterSumAggregation) collection_ts = std::chrono::system_clock::now(); count_attributes = 0; storage.Collect(collector.get(), collectors, sdk_start_ts, collection_ts, - [&](const MetricData data) { + [&](const MetricData &data) { for (auto data_attr : data.point_data_attr_) { auto sum_data = opentelemetry::nostd::get(data_attr.point_data); diff --git a/sdk/test/metrics/view_registry_test.cc b/sdk/test/metrics/view_registry_test.cc index fb188e7124..fd86168d77 100644 --- a/sdk/test/metrics/view_registry_test.cc +++ b/sdk/test/metrics/view_registry_test.cc @@ -1,16 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/view/view_registry.h" -#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -#include "opentelemetry/sdk/metrics/instruments.h" -#include "opentelemetry/sdk/metrics/view/predicate.h" - #include +#include +#include +#include -#if OPENTELEMETRY_HAVE_WORKING_REGEX -# include -#endif +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" +#include "opentelemetry/sdk/metrics/view/view_registry.h" using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/resource/resource_test.cc b/sdk/test/resource/resource_test.cc index e6b56cae43..a359cb33d4 100644 --- a/sdk/test/resource/resource_test.cc +++ b/sdk/test/resource/resource_test.cc @@ -1,17 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/resource/resource.h" -#include "opentelemetry/sdk/common/attribute_utils.h" -#include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" -#include "opentelemetry/sdk/version/version.h" - +#include +#include #include #include #include +#include +#include -#include +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/resource/resource_detector.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" @@ -20,12 +25,14 @@ 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 { public: - TestResource(ResourceAttributes attributes = ResourceAttributes(), std::string schema_url = {}) + TestResource(const ResourceAttributes &attributes = ResourceAttributes(), + const std::string &schema_url = {}) : Resource(attributes, schema_url) {} }; @@ -36,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}}; @@ -69,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}}; @@ -100,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); @@ -122,10 +129,10 @@ TEST(ResourceTest, create_with_emptyatrributes) TEST(ResourceTest, create_with_schemaurl) { - const std::string schema_url = "https://opentelemetry.io/schemas/1.2.0"; - ResourceAttributes attributes = {}; - auto resource = Resource::Create(attributes, schema_url); - auto received_schema_url = resource.GetSchemaURL(); + const std::string schema_url = "https://opentelemetry.io/schemas/1.2.0"; + ResourceAttributes attributes = {}; + auto resource = Resource::Create(attributes, schema_url); + const auto &received_schema_url = resource.GetSchemaURL(); EXPECT_EQ(received_schema_url, schema_url); } diff --git a/sdk/test/trace/always_off_sampler_test.cc b/sdk/test/trace/always_off_sampler_test.cc index 1c32bd5a8f..5680e22c75 100644 --- a/sdk/test/trace/always_off_sampler_test.cc +++ b/sdk/test/trace/always_off_sampler_test.cc @@ -2,8 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_off.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/trace_state.h" using opentelemetry::sdk::trace::AlwaysOffSampler; using opentelemetry::sdk::trace::Decision; diff --git a/sdk/test/trace/always_on_sampler_test.cc b/sdk/test/trace/always_on_sampler_test.cc index c483f9b8be..04b7e60a2b 100644 --- a/sdk/test/trace/always_on_sampler_test.cc +++ b/sdk/test/trace/always_on_sampler_test.cc @@ -1,12 +1,24 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_on.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" - -#include -#include +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/trace_state.h" using namespace opentelemetry::sdk::trace; using namespace opentelemetry::nostd; diff --git a/sdk/test/trace/batch_span_processor_test.cc b/sdk/test/trace/batch_span_processor_test.cc index 411b4dacfe..293747350a 100644 --- a/sdk/test/trace/batch_span_processor_test.cc +++ b/sdk/test/trace/batch_span_processor_test.cc @@ -1,21 +1,28 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/batch_span_processor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/common/exporter_utils.h" #include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/trace/batch_span_processor.h" #include "opentelemetry/sdk/trace/batch_span_processor_options.h" #include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/recordable.h" #include "opentelemetry/sdk/trace/span_data.h" -#include "opentelemetry/sdk/trace/tracer.h" - -#include - -#include -#include -#include -#include -#include +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -32,10 +39,10 @@ class MockSpanExporter final : public sdk::trace::SpanExporter std::shared_ptr> is_export_completed = std::shared_ptr>(new std::atomic(false)), const std::chrono::milliseconds export_delay = std::chrono::milliseconds(0)) noexcept - : spans_received_(spans_received), - shut_down_counter_(shut_down_counter), - is_shutdown_(is_shutdown), - is_export_completed_(is_export_completed), + : spans_received_(std::move(spans_received)), + shut_down_counter_(std::move(shut_down_counter)), + is_shutdown_(std::move(is_shutdown)), + is_export_completed_(std::move(is_export_completed)), export_delay_(export_delay) {} @@ -96,7 +103,7 @@ class BatchSpanProcessorTestPeer : public testing::Test { public: std::unique_ptr>> GetTestSpans( - std::shared_ptr processor, + const std::shared_ptr &processor, const int num_spans) { std::unique_ptr>> test_spans( diff --git a/sdk/test/trace/parent_sampler_test.cc b/sdk/test/trace/parent_sampler_test.cc index 7d2ef7f107..a6ed8ff7f8 100644 --- a/sdk/test/trace/parent_sampler_test.cc +++ b/sdk/test/trace/parent_sampler_test.cc @@ -2,11 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/context/context_value.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_off.h" #include "opentelemetry/sdk/trace/samplers/always_on.h" #include "opentelemetry/sdk/trace/samplers/parent.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/trace_state.h" using opentelemetry::sdk::trace::AlwaysOffSampler; using opentelemetry::sdk::trace::AlwaysOnSampler; diff --git a/sdk/test/trace/sampler_benchmark.cc b/sdk/test/trace/sampler_benchmark.cc index ec188b84a1..ef9f37af95 100644 --- a/sdk/test/trace/sampler_benchmark.cc +++ b/sdk/test/trace/sampler_benchmark.cc @@ -1,20 +1,35 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/context/context_value.h" // IWYU pragma: keep #include "opentelemetry/exporters/memory/in_memory_span_exporter.h" #include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/recordable.h" #include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_off.h" #include "opentelemetry/sdk/trace/samplers/always_on.h" #include "opentelemetry/sdk/trace/samplers/parent.h" #include "opentelemetry/sdk/trace/samplers/trace_id_ratio.h" #include "opentelemetry/sdk/trace/simple_processor.h" -#include "opentelemetry/sdk/trace/span_data.h" #include "opentelemetry/sdk/trace/tracer.h" - -#include - -#include +#include "opentelemetry/sdk/trace/tracer_context.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_context_kv_iterable_view.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/tracer.h" using namespace opentelemetry::sdk::trace; using opentelemetry::exporter::memory::InMemorySpanExporter; diff --git a/sdk/test/trace/simple_processor_test.cc b/sdk/test/trace/simple_processor_test.cc index 7653bb2cfc..92fdf71d58 100644 --- a/sdk/test/trace/simple_processor_test.cc +++ b/sdk/test/trace/simple_processor_test.cc @@ -1,13 +1,23 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/simple_processor.h" +#include +#include +#include +#include +#include + +#include "opentelemetry/exporters/memory/in_memory_span_data.h" #include "opentelemetry/exporters/memory/in_memory_span_exporter.h" #include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/atomic_unique_ptr.h" +#include "opentelemetry/sdk/common/exporter_utils.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/span_data.h" - -#include +#include "opentelemetry/trace/span_context.h" using namespace opentelemetry::sdk::trace; using namespace opentelemetry::sdk::common; diff --git a/sdk/test/trace/span_data_test.cc b/sdk/test/trace/span_data_test.cc index 98d00843dd..054af65330 100644 --- a/sdk/test/trace/span_data_test.cc +++ b/sdk/test/trace/span_data_test.cc @@ -1,18 +1,32 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/span_data.h" +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" #include "opentelemetry/nostd/variant.h" -#include "opentelemetry/trace/span.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/span_data.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_flags.h" #include "opentelemetry/trace/trace_id.h" - -#include +#include "opentelemetry/trace/trace_state.h" using opentelemetry::sdk::trace::SpanData; namespace trace_api = opentelemetry::trace; namespace common = opentelemetry::common; -namespace nostd = opentelemetry::nostd; TEST(SpanData, DefaultValues) { @@ -70,7 +84,7 @@ TEST(SpanData, Set) ASSERT_EQ(data.GetDescription(), "description"); ASSERT_EQ(data.GetStartTime().time_since_epoch(), now.time_since_epoch()); ASSERT_EQ(data.GetDuration(), std::chrono::nanoseconds(1000000)); - ASSERT_EQ(nostd::get(data.GetAttributes().at("attr1")), 314159); + ASSERT_EQ(opentelemetry::nostd::get(data.GetAttributes().at("attr1")), 314159); ASSERT_EQ(data.GetEvents().at(0).GetName(), "event1"); ASSERT_EQ(data.GetEvents().at(0).GetTimestamp(), now); } @@ -89,15 +103,17 @@ TEST(SpanData, EventAttributes) for (int i = 0; i < kNumAttributes; i++) { - EXPECT_EQ(nostd::get(data.GetEvents().at(0).GetAttributes().at(keys[i])), values[i]); + EXPECT_EQ( + opentelemetry::nostd::get(data.GetEvents().at(0).GetAttributes().at(keys[i])), + values[i]); } } TEST(SpanData, Resources) { SpanData data; - auto resource = opentelemetry::sdk::resource::Resource::Create({}); - auto input_attr = resource.GetAttributes(); + auto resource = opentelemetry::sdk::resource::Resource::Create({}); + const auto &input_attr = resource.GetAttributes(); data.SetResource(resource); auto output_attr = data.GetResource().GetAttributes(); EXPECT_EQ(input_attr, output_attr); @@ -130,6 +146,7 @@ TEST(SpanData, Links) EXPECT_EQ(data.GetLinks().at(0).GetSpanContext(), span_context); for (int i = 0; i < kNumAttributes; i++) { - EXPECT_EQ(nostd::get(data.GetLinks().at(0).GetAttributes().at(keys[i])), values[i]); + EXPECT_EQ(opentelemetry::nostd::get(data.GetLinks().at(0).GetAttributes().at(keys[i])), + values[i]); } } diff --git a/sdk/test/trace/trace_id_ratio_sampler_test.cc b/sdk/test/trace/trace_id_ratio_sampler_test.cc index 1b0088f134..ac83a8dc6d 100644 --- a/sdk/test/trace/trace_id_ratio_sampler_test.cc +++ b/sdk/test/trace/trace_id_ratio_sampler_test.cc @@ -1,14 +1,26 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/trace_id_ratio.h" +#include "opentelemetry/trace/span_context.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" #include "src/common/random.h" -#include -#include -#include - using opentelemetry::sdk::common::Random; using opentelemetry::sdk::trace::Decision; using opentelemetry::sdk::trace::TraceIdRatioBasedSampler; diff --git a/sdk/test/trace/tracer_provider_test.cc b/sdk/test/trace/tracer_provider_test.cc index 9715a7e0b8..fa3afa2690 100644 --- a/sdk/test/trace/tracer_provider_test.cc +++ b/sdk/test/trace/tracer_provider_test.cc @@ -1,20 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/tracer_provider.h" +#include +#include +#include +#include + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/id_generator.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/random_id_generator.h" +#include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_off.h" -#include "opentelemetry/sdk/trace/samplers/always_on.h" #include "opentelemetry/sdk/trace/simple_processor.h" #include "opentelemetry/sdk/trace/tracer.h" - -#include +#include "opentelemetry/sdk/trace/tracer_context.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" using namespace opentelemetry::sdk::trace; using namespace opentelemetry::sdk::resource; -#include - TEST(TracerProvider, GetTracer) { std::unique_ptr processor(new SimpleSpanProcessor(nullptr)); diff --git a/sdk/test/trace/tracer_test.cc b/sdk/test/trace/tracer_test.cc index 99bab95b0f..2c4de8e83c 100644 --- a/sdk/test/trace/tracer_test.cc +++ b/sdk/test/trace/tracer_test.cc @@ -1,17 +1,58 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/trace/tracer.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/context/context_value.h" +#include "opentelemetry/exporters/memory/in_memory_span_data.h" #include "opentelemetry/exporters/memory/in_memory_span_exporter.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/nostd/utility.h" +#include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/id_generator.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/random_id_generator.h" +#include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/sdk/trace/sampler.h" #include "opentelemetry/sdk/trace/samplers/always_off.h" #include "opentelemetry/sdk/trace/samplers/always_on.h" #include "opentelemetry/sdk/trace/samplers/parent.h" #include "opentelemetry/sdk/trace/simple_processor.h" #include "opentelemetry/sdk/trace/span_data.h" +#include "opentelemetry/sdk/trace/tracer.h" +#include "opentelemetry/sdk/trace/tracer_context.h" #include "opentelemetry/trace/context.h" - -#include +#include "opentelemetry/trace/scope.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_context_kv_iterable.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/span_metadata.h" +#include "opentelemetry/trace/span_startoptions.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/trace_state.h" +#include "opentelemetry/trace/tracer.h" using namespace opentelemetry::sdk::trace; using namespace opentelemetry::sdk::resource; @@ -20,7 +61,6 @@ using opentelemetry::common::SystemTimestamp; namespace nostd = opentelemetry::nostd; namespace common = opentelemetry::common; namespace trace_api = opentelemetry::trace; -using opentelemetry::common::KeyValueIterableView; using opentelemetry::exporter::memory::InMemorySpanData; using opentelemetry::exporter::memory::InMemorySpanExporter; using opentelemetry::trace::SpanContext; diff --git a/test_common/include/opentelemetry/test_common/ext/http/client/http_client_test_factory.h b/test_common/include/opentelemetry/test_common/ext/http/client/http_client_test_factory.h index 51f9502bb8..eb56b59806 100644 --- a/test_common/include/opentelemetry/test_common/ext/http/client/http_client_test_factory.h +++ b/test_common/include/opentelemetry/test_common/ext/http/client/http_client_test_factory.h @@ -2,7 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once + +#include + #include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace ext diff --git a/test_common/include/opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h b/test_common/include/opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h index 3207857743..211b5b3720 100644 --- a/test_common/include/opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h +++ b/test_common/include/opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h @@ -3,16 +3,18 @@ #pragma once -#include "opentelemetry/ext/http/client/http_client.h" -#include "opentelemetry/ext/http/common/url_parser.h" -#include "opentelemetry/version.h" - -#include +#include +#include +#include +#include +#include #include -#include +#include -#include -#include "gmock/gmock.h" +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace ext @@ -67,6 +69,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_; @@ -76,6 +80,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 @@ -116,7 +121,7 @@ class Response : public opentelemetry::ext::http::client::Response opentelemetry::ext::http::client::StatusCode status_code_; }; -class HttpClient; +class HttpClient; // IWYU pragma: keep class Session : public opentelemetry::ext::http::client::Session { diff --git a/test_common/src/http/client/nosend/CMakeLists.txt b/test_common/src/http/client/nosend/CMakeLists.txt index 92a2c1f98c..7394053a22 100644 --- a/test_common/src/http/client/nosend/CMakeLists.txt +++ b/test_common/src/http/client/nosend/CMakeLists.txt @@ -28,7 +28,7 @@ if(${BUILD_TESTING}) endif() target_link_libraries( - opentelemetry_http_client_nosend ${GTEST_BOTH_LIBRARIES} opentelemetry_ext - opentelemetry_test_common) + opentelemetry_http_client_nosend opentelemetry_ext + opentelemetry_test_common ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES}) endif() diff --git a/test_common/src/http/client/nosend/http_client_nosend.cc b/test_common/src/http/client/nosend/http_client_nosend.cc index 98cae0476a..46784869c4 100644 --- a/test_common/src/http/client/nosend/http_client_nosend.cc +++ b/test_common/src/http/client/nosend/http_client_nosend.cc @@ -1,7 +1,18 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace ext diff --git a/third_party/opentelemetry-proto b/third_party/opentelemetry-proto index b3060d2104..0adf6aac00 160000 --- a/third_party/opentelemetry-proto +++ b/third_party/opentelemetry-proto @@ -1 +1 @@ -Subproject commit b3060d2104df364136d75a35779e6bd48bac449a +Subproject commit 0adf6aac004578b28267394514b2e55ee9cc012f diff --git a/third_party/prometheus-cpp b/third_party/prometheus-cpp index ad99e21f47..e5fada4313 160000 --- a/third_party/prometheus-cpp +++ b/third_party/prometheus-cpp @@ -1 +1 @@ -Subproject commit ad99e21f4706193670c42b36c9824dc997f4c475 +Subproject commit e5fada43131d251e9c4786b04263ce98b6767ba5 diff --git a/third_party_release b/third_party_release index 0bbf67f3af..75646fa6c9 100644 --- a/third_party_release +++ b/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.1 +opentelemetry-proto=v1.4.0 opentracing-cpp=v1.6.0 -prometheus-cpp=v1.2.4 +prometheus-cpp=v1.3.0 vcpkg=2024.02.14 diff --git a/tools/format.sh b/tools/format.sh index 65728b385f..3a3863a8ea 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -23,8 +23,8 @@ fi # No CRLF line endings, except Windows files. "${SED[@]}" 's/\r$//' $($FIND -name '*.ps1' -prune -o \ -name '*.cmd' -prune -o -type f -print) -# No trailing spaces. -"${SED[@]}" 's/ \+$//' $($FIND -type f -print) +# No trailing spaces, except in patch. +"${SED[@]}" 's/ \+$//' $($FIND -name "*.patch" -prune -o -type f -print) # If not overridden, try to use clang-format-18 or clang-format. if [[ -z "$CLANG_FORMAT" ]]; then