1// Copyright The OpenTelemetry Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package semconv // import "go.opentelemetry.io/otel/semconv"
16
17import "go.opentelemetry.io/otel/attribute"
18
19// Semantic conventions for service resource attribute keys.
20const (
21	// Name of the service.
22	ServiceNameKey = attribute.Key("service.name")
23
24	// A namespace for `service.name`. This needs to have meaning that helps
25	// to distinguish a group of services. For example, the team name that
26	// owns a group of services. `service.name` is expected to be unique
27	// within the same namespace.
28	ServiceNamespaceKey = attribute.Key("service.namespace")
29
30	// A unique identifier of the service instance. In conjunction with the
31	// `service.name` and `service.namespace` this must be unique.
32	ServiceInstanceIDKey = attribute.Key("service.instance.id")
33
34	// The version of the service API.
35	ServiceVersionKey = attribute.Key("service.version")
36)
37
38// Semantic conventions for telemetry SDK resource attribute keys.
39const (
40	// The name of the telemetry SDK.
41	//
42	// The default OpenTelemetry SDK provided by the OpenTelemetry project
43	// MUST set telemetry.sdk.name to the value `opentelemetry`.
44	//
45	// If another SDK is used, this attribute MUST be set to the import path
46	// of that SDK's package.
47	//
48	// The value `opentelemetry` is reserved and MUST NOT be used by
49	// non-OpenTelemetry SDKs.
50	TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name")
51
52	// The language of the telemetry SDK.
53	TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language")
54
55	// The version string of the telemetry SDK.
56	TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version")
57)
58
59// Semantic conventions for telemetry SDK resource attributes.
60var (
61	TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go")
62)
63
64// Semantic conventions for container resource attribute keys.
65const (
66	// A uniquely identifying name for the Container.
67	ContainerNameKey = attribute.Key("container.name")
68
69	// Container ID, usually a UUID, as for example used to
70	// identify Docker containers. The UUID might be abbreviated.
71	ContainerIDKey = attribute.Key("container.id")
72
73	// Name of the image the container was built on.
74	ContainerImageNameKey = attribute.Key("container.image.name")
75
76	// Container image tag.
77	ContainerImageTagKey = attribute.Key("container.image.tag")
78)
79
80// Semantic conventions for Function-as-a-Service resource attribute keys.
81const (
82	// A uniquely identifying name for the FaaS.
83	FaaSNameKey = attribute.Key("faas.name")
84
85	// The unique name of the function being executed.
86	FaaSIDKey = attribute.Key("faas.id")
87
88	// The version of the function being executed.
89	FaaSVersionKey = attribute.Key("faas.version")
90
91	// The execution environment identifier.
92	FaaSInstanceKey = attribute.Key("faas.instance")
93)
94
95// Semantic conventions for operating system process resource attribute keys.
96const (
97	// Process identifier (PID).
98	ProcessPIDKey = attribute.Key("process.pid")
99	// The name of the process executable. On Linux based systems, can be
100	// set to the `Name` in `proc/[pid]/status`. On Windows, can be set to
101	// the base name of `GetProcessImageFileNameW`.
102	ProcessExecutableNameKey = attribute.Key("process.executable.name")
103	// The full path to the process executable. On Linux based systems, can
104	// be set to the target of `proc/[pid]/exe`. On Windows, can be set to
105	// the result of `GetProcessImageFileNameW`.
106	ProcessExecutablePathKey = attribute.Key("process.executable.path")
107	// The command used to launch the process (i.e. the command name). On
108	// Linux based systems, can be set to the zeroth string in
109	// `proc/[pid]/cmdline`. On Windows, can be set to the first parameter
110	// extracted from `GetCommandLineW`.
111	ProcessCommandKey = attribute.Key("process.command")
112	// The full command used to launch the process. The value can be either
113	// a list of strings representing the ordered list of arguments, or a
114	// single string representing the full command. On Linux based systems,
115	// can be set to the list of null-delimited strings extracted from
116	// `proc/[pid]/cmdline`. On Windows, can be set to the result of
117	// `GetCommandLineW`.
118	ProcessCommandLineKey = attribute.Key("process.command_line")
119	// All the command arguments (including the command/executable itself)
120	// as received by the process. On Linux-based systems (and some other
121	// Unixoid systems supporting procfs), can be set according to the list
122	// of null-delimited strings extracted from `proc/[pid]/cmdline`. For
123	// libc-based executables, this would be the full argv vector passed to
124	// `main`.
125	ProcessCommandArgsKey = attribute.Key("process.command_args")
126	// The username of the user that owns the process.
127	ProcessOwnerKey = attribute.Key("process.owner")
128	// The name of the runtime of this process. For compiled native
129	// binaries, this SHOULD be the name of the compiler.
130	ProcessRuntimeNameKey = attribute.Key("process.runtime.name")
131	// The version of the runtime of this process, as returned by the
132	// runtime without modification.
133	ProcessRuntimeVersionKey = attribute.Key("process.runtime.version")
134	// An additional description about the runtime of the process, for
135	// example a specific vendor customization of the runtime environment.
136	ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description")
137)
138
139// Semantic conventions for Kubernetes resource attribute keys.
140const (
141	// A uniquely identifying name for the Kubernetes cluster. Kubernetes
142	// does not have cluster names as an internal concept so this may be
143	// set to any meaningful value within the environment. For example,
144	// GKE clusters have a name which can be used for this attribute.
145	K8SClusterNameKey = attribute.Key("k8s.cluster.name")
146
147	// The name of the Node.
148	K8SNodeNameKey = attribute.Key("k8s.node.name")
149
150	// The UID of the Node.
151	K8SNodeUIDKey = attribute.Key("k8s.node.uid")
152
153	// The name of the namespace that the pod is running in.
154	K8SNamespaceNameKey = attribute.Key("k8s.namespace.name")
155
156	// The uid of the Pod.
157	K8SPodUIDKey = attribute.Key("k8s.pod.uid")
158
159	// The name of the pod.
160	K8SPodNameKey = attribute.Key("k8s.pod.name")
161
162	// The name of the Container in a Pod template.
163	K8SContainerNameKey = attribute.Key("k8s.container.name")
164
165	// The uid of the ReplicaSet.
166	K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid")
167
168	// The name of the ReplicaSet.
169	K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name")
170
171	// The uid of the Deployment.
172	K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid")
173
174	// The name of the deployment.
175	K8SDeploymentNameKey = attribute.Key("k8s.deployment.name")
176
177	// The uid of the StatefulSet.
178	K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid")
179
180	// The name of the StatefulSet.
181	K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name")
182
183	// The uid of the DaemonSet.
184	K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid")
185
186	// The name of the DaemonSet.
187	K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name")
188
189	// The uid of the Job.
190	K8SJobUIDKey = attribute.Key("k8s.job.uid")
191
192	// The name of the Job.
193	K8SJobNameKey = attribute.Key("k8s.job.name")
194
195	// The uid of the CronJob.
196	K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid")
197
198	// The name of the CronJob.
199	K8SCronJobNameKey = attribute.Key("k8s.cronjob.name")
200)
201
202// Semantic conventions for OS resource attribute keys.
203const (
204	// The operating system type.
205	OSTypeKey = attribute.Key("os.type")
206	// Human readable (not intended to be parsed) OS version information.
207	OSDescriptionKey = attribute.Key("os.description")
208)
209
210// Semantic conventions for host resource attribute keys.
211const (
212	// A uniquely identifying name for the host: 'hostname', FQDN, or user specified name
213	HostNameKey = attribute.Key("host.name")
214
215	// Unique host ID. For cloud environments this will be the instance ID.
216	HostIDKey = attribute.Key("host.id")
217
218	// Type of host. For cloud environments this will be the machine type.
219	HostTypeKey = attribute.Key("host.type")
220
221	// Name of the OS or VM image the host is running.
222	HostImageNameKey = attribute.Key("host.image.name")
223
224	// Identifier of the image the host is running.
225	HostImageIDKey = attribute.Key("host.image.id")
226
227	// Version of the image the host is running.
228	HostImageVersionKey = attribute.Key("host.image.version")
229)
230
231// Semantic conventions for cloud environment resource attribute keys.
232const (
233	// Name of the cloud provider.
234	CloudProviderKey = attribute.Key("cloud.provider")
235
236	// The account ID from the cloud provider used for authorization.
237	CloudAccountIDKey = attribute.Key("cloud.account.id")
238
239	// Geographical region where this resource is.
240	CloudRegionKey = attribute.Key("cloud.region")
241
242	// Zone of the region where this resource is.
243	CloudZoneKey = attribute.Key("cloud.zone")
244)
245
246// Semantic conventions for common cloud provider resource attributes.
247var (
248	CloudProviderAWS   = CloudProviderKey.String("aws")
249	CloudProviderAzure = CloudProviderKey.String("azure")
250	CloudProviderGCP   = CloudProviderKey.String("gcp")
251)
252
253// Semantic conventions for deployment attributes.
254const (
255	// Name of the deployment environment (aka deployment tier); e.g. (staging, production).
256	DeploymentEnvironmentKey = attribute.Key("deployment.environment")
257)
258