service_attributes.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright The OpenTelemetry Authors
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. /*
  6. * DO NOT EDIT, this is an Auto-generated file from:
  7. * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
  8. */
  9. #pragma once
  10. #include "opentelemetry/common/macros.h"
  11. #include "opentelemetry/version.h"
  12. OPENTELEMETRY_BEGIN_NAMESPACE
  13. namespace semconv
  14. {
  15. namespace service
  16. {
  17. /**
  18. The string ID of the service instance.
  19. <p>
  20. MUST be unique for each instance of the same @code service.namespace,service.name @endcode pair
  21. (in other words
  22. @code service.namespace,service.name,service.instance.id @endcode triplet MUST be globally
  23. unique). The ID helps to distinguish instances of the same service that exist at the same time
  24. (e.g. instances of a horizontally scaled service). <p> Implementations, such as SDKs, are
  25. recommended to generate a random Version 1 or Version 4 <a
  26. href="https://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a> UUID, but are free to use an inherent
  27. unique ID as the source of this value if stability is desirable. In that case, the ID SHOULD be
  28. used as source of a UUID Version 5 and SHOULD use the following UUID as the namespace: @code
  29. 4d63009a-8d0f-11ee-aad7-4c796ed8e320 @endcode. <p> UUIDs are typically recommended, as only an
  30. opaque value for the purposes of identifying a service instance is needed. Similar to what can be
  31. seen in the man page for the <a
  32. href="https://www.freedesktop.org/software/systemd/man/latest/machine-id.html">@code
  33. /etc/machine-id @endcode</a> file, the underlying data, such as pod name and namespace should be
  34. treated as confidential, being the user's choice to expose it or not via another resource
  35. attribute. <p> For applications running behind an application server (like unicorn), we do not
  36. recommend using one identifier for all processes participating in the application. Instead, it's
  37. recommended each division (e.g. a worker thread in unicorn) to have its own instance.id. <p> It's
  38. not recommended for a Collector to set @code service.instance.id @endcode if it can't
  39. unambiguously determine the service instance that is generating that telemetry. For instance,
  40. creating an UUID based on @code pod.name @endcode will likely be wrong, as the Collector might not
  41. know from which container within that pod the telemetry originated. However, Collectors can set
  42. the @code service.instance.id @endcode if they can unambiguously determine the service instance
  43. for that telemetry. This is typically the case for scraping receivers, as they know the target
  44. address and port.
  45. */
  46. static constexpr const char *kServiceInstanceId = "service.instance.id";
  47. /**
  48. Logical name of the service.
  49. <p>
  50. MUST be the same for all instances of horizontally scaled services. If the value was not
  51. specified, SDKs MUST fallback to @code unknown_service: @endcode concatenated with <a
  52. href="process.md">@code process.executable.name @endcode</a>, e.g. @code unknown_service:bash
  53. @endcode. If @code process.executable.name @endcode is not available, the value MUST be set to
  54. @code unknown_service @endcode.
  55. */
  56. static constexpr const char *kServiceName = "service.name";
  57. /**
  58. A namespace for @code service.name @endcode.
  59. <p>
  60. A string value having a meaning that helps to distinguish a group of services, for example the
  61. team name that owns a group of services. @code service.name @endcode is expected to be unique
  62. within the same namespace. If @code service.namespace @endcode is not specified in the Resource
  63. then @code service.name @endcode is expected to be unique for all services that have no explicit
  64. namespace defined (so the empty/unspecified namespace is simply one more valid namespace).
  65. Zero-length namespace string is assumed equal to unspecified namespace.
  66. */
  67. static constexpr const char *kServiceNamespace = "service.namespace";
  68. /**
  69. The version string of the service API or implementation. The format is not defined by these
  70. conventions.
  71. */
  72. static constexpr const char *kServiceVersion = "service.version";
  73. } // namespace service
  74. } // namespace semconv
  75. OPENTELEMETRY_END_NAMESPACE