]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / include / opentelemetry / sdk / resource / experimental_semantic_conventions.h
CommitLineData
1e59de90
TL
1// Copyright The OpenTelemetry Authors
2// SPDX-License-Identifier: Apache-2.0
3
4// NOTE:
5// This implementation is based on the experimental specs for resource semantic convention as
6// defined here:
7// https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/resource/semantic_conventions
8// and MAY will change in future.
9
10#pragma once
11
12#include <type_traits>
13#include <unordered_map>
14
15#include "opentelemetry/common/string_util.h"
16#include "opentelemetry/version.h"
17
18#define OTEL_GET_RESOURCE_ATTR(name) \
19 opentelemetry::sdk::resource::attr(OTEL_CPP_CONST_HASHCODE(name))
20
21OPENTELEMETRY_BEGIN_NAMESPACE
22namespace sdk
23{
24namespace resource
25{
26
27static const std::unordered_map<uint32_t, const char *> attribute_ids = {
28 {OTEL_CPP_CONST_HASHCODE(AttrServiceName), "service.name"},
29 {OTEL_CPP_CONST_HASHCODE(AttrServiceNamespace), "service.namespace"},
30 {OTEL_CPP_CONST_HASHCODE(AttrServiceInstance), "service.instance.id"},
31 {OTEL_CPP_CONST_HASHCODE(AttrServiceVersion), "service.version"},
32
33 // telemetry attributes
34 {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkName), "telemetry.sdk.name"},
35 {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkLanguage), "telemetry.sdk.language"},
36 {OTEL_CPP_CONST_HASHCODE(AttrTelemetrySdkVersion), "telemetry.sdk.version"},
37 {OTEL_CPP_CONST_HASHCODE(AttrTelemetryAutoVersion), "telemetry.auto.version"},
38
39 // compute unit: container attributes
40 {OTEL_CPP_CONST_HASHCODE(AttrContainerName), "container.name"},
41 {OTEL_CPP_CONST_HASHCODE(AttrContainerId), "container.id"},
42 {OTEL_CPP_CONST_HASHCODE(AttrContainerRuntime), "container.runtime"},
43 {OTEL_CPP_CONST_HASHCODE(AttrContainerImageName), "container.image.name"},
44 {OTEL_CPP_CONST_HASHCODE(AttrContainerImageTag), "container.image.tag"},
45
46 // compute unit: faas attributes
47 {OTEL_CPP_CONST_HASHCODE(AttrFaasName), "faas.name"},
48 {OTEL_CPP_CONST_HASHCODE(AttrFaasId), "faas.id"},
49 {OTEL_CPP_CONST_HASHCODE(AttrFaasVersion), "faas.version"},
50 {OTEL_CPP_CONST_HASHCODE(AttrFaasInstance), "faas.instance"},
51 {OTEL_CPP_CONST_HASHCODE(AttrFaasMaxMemory), "faas.max_memory"},
52
53 // compute unit : process attributes
54 {OTEL_CPP_CONST_HASHCODE(AttrProcessId), "process.pid"},
55 {OTEL_CPP_CONST_HASHCODE(AttrProcessExecutableName), "process.executable.name"},
56 {OTEL_CPP_CONST_HASHCODE(AttrProcessExecutablePath), "process.executable.path"},
57 {OTEL_CPP_CONST_HASHCODE(AttrProcessCommand), "process.command"},
58 {OTEL_CPP_CONST_HASHCODE(AttrProcessCommandLine), "process.command_line"},
59 {OTEL_CPP_CONST_HASHCODE(AttrProcessCommandArgs), "process.command_args"},
60 {OTEL_CPP_CONST_HASHCODE(AttrProcessOwner), "process.owner"},
61
62 // compute : process runtimes
63 {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeName), "process.runtime.name"},
64 {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeVersion), "process.runtime.version"},
65 {OTEL_CPP_CONST_HASHCODE(AttrProcessRuntimeDescription), "process.runtime.description"},
66
67 // compute unit : WebEngine
68 {OTEL_CPP_CONST_HASHCODE(AttrWebEngineName), "webengine.name"},
69 {OTEL_CPP_CONST_HASHCODE(AttrWebEngineVersion), "webengine.version"},
70 {OTEL_CPP_CONST_HASHCODE(AttrWebEngineDescription), "webengine.description"},
71
72 // compute instance : host
73 {OTEL_CPP_CONST_HASHCODE(AttrHostId), "host.id"},
74 {OTEL_CPP_CONST_HASHCODE(AttrHostName), "host.name"},
75 {OTEL_CPP_CONST_HASHCODE(AttrHostType), "host.type"},
76 {OTEL_CPP_CONST_HASHCODE(AttrHostArch), "host.arch"},
77 {OTEL_CPP_CONST_HASHCODE(AttrHostImageName), "host.image.name"},
78 {OTEL_CPP_CONST_HASHCODE(AttrHostImageId), "host.image.id"},
79 {OTEL_CPP_CONST_HASHCODE(AttrHostImageVersion), "host.image.version"},
80
81 // env os attributes
82 {OTEL_CPP_CONST_HASHCODE(AttrOsType), "os.type"},
83 {OTEL_CPP_CONST_HASHCODE(AttrOsDescription), "os.description"},
84 {OTEL_CPP_CONST_HASHCODE(AttrOsName), "os.name"},
85 {OTEL_CPP_CONST_HASHCODE(AttrOsVersion), "os.version"},
86
87 // env device attributes
88 {OTEL_CPP_CONST_HASHCODE(AttrDeviceId), "device.id"},
89 {OTEL_CPP_CONST_HASHCODE(AttrDeviceModelIdentifier), "device.model.identifier"},
90 {OTEL_CPP_CONST_HASHCODE(AttrDeviceModelName), "device.model.name"},
91
92 // env cloud
93 {OTEL_CPP_CONST_HASHCODE(AttrCloudProvider), "cloud.provider"},
94 {OTEL_CPP_CONST_HASHCODE(AttrCloudAccountId), "cloud.account.id"},
95 {OTEL_CPP_CONST_HASHCODE(AttrCloudRegion), "cloud.region"},
96 {OTEL_CPP_CONST_HASHCODE(AttrCloudAvailabilityZone), "cloud.availability_zone"},
97 {OTEL_CPP_CONST_HASHCODE(AttrCloudPlatform), "cloud.platform"},
98
99 // env deployment
100 {OTEL_CPP_CONST_HASHCODE(AttrDeploymentEnvironment), "deployment.environment"},
101
102 // env kubernetes
103 // - cluster
104 {OTEL_CPP_CONST_HASHCODE(AttrK8sClusterName), "k8s.cluster.name"},
105 // - node
106 {OTEL_CPP_CONST_HASHCODE(AttrK8sNodeName), "k8s.node.name"},
107 {OTEL_CPP_CONST_HASHCODE(AttrK8sNodeUid), "k8s.node.uid"},
108 // - namespace
109 {OTEL_CPP_CONST_HASHCODE(AttrK8sNamespaceName), "k8s.namespace.name"},
110 // - pod
111 {OTEL_CPP_CONST_HASHCODE(AttrK8sPodUid), "k8s.pod.uid"},
112 {OTEL_CPP_CONST_HASHCODE(AttrK8sPodName), "k8s.pod.name"},
113 // - container
114 {OTEL_CPP_CONST_HASHCODE(AttrK8sContainerName), "k8s.container.name"},
115 // - replicaset
116 {OTEL_CPP_CONST_HASHCODE(AttrK8sReplicaSetUid), "k8s.replicaset.uid"},
117 {OTEL_CPP_CONST_HASHCODE(AttrK8sReplicaSetName), "k8s.replicaset.name"},
118 // - deployment
119 {OTEL_CPP_CONST_HASHCODE(AttrK8sDeploymentUid), "k8s.deployment.uid"},
120 {OTEL_CPP_CONST_HASHCODE(AttrK8sDeploymentName), "k8s.deployment.name"},
121 // - stateful-set
122 {OTEL_CPP_CONST_HASHCODE(AttrK8sStatefulSetUid), "k8s.statefulset.uid"},
123 {OTEL_CPP_CONST_HASHCODE(AttrK8sStatefulSetName), "k8s.statefulset.name"},
124 // - daemon set
125 {OTEL_CPP_CONST_HASHCODE(AttrK8sDaemonSetUid), "k8s.daemonset.uid"},
126 {OTEL_CPP_CONST_HASHCODE(AttrK8sDaemonSetName), "k8s.daemonset.name"},
127 // - job
128 {OTEL_CPP_CONST_HASHCODE(AttrK8sJobUid), "k8s.job.uid"},
129 {OTEL_CPP_CONST_HASHCODE(AttrK8sJobName), "k8s.job.name"},
130 // - cronjob
131 {OTEL_CPP_CONST_HASHCODE(AttrCronjobUid), "k8s.cronjob.id"},
132 {OTEL_CPP_CONST_HASHCODE(AttrCronjobName), "k8s.cronjob.name"}};
133
134// function to generate hash code for semantic conventions attributes.
135inline const char *attr(uint32_t attr)
136{
137 return (attribute_ids.find(attr) != attribute_ids.end()) ? attribute_ids.at(attr) : "";
138}
139} // namespace resource
140} // namespace sdk
141OPENTELEMETRY_END_NAMESPACE