1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
//! # Resource Semantic Conventions
//!
//! The [resource semantic conventions] define a set of standardized attributes
//! to be used in `Resource`s.
//!
//! [resource semantic conventions]: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions
//!
//! ## Usage
//!
//! ```rust,no_run
//! use opentelemetry::sdk;
//! use opentelemetry_semantic_conventions as semcov;
//!
//! let _tracer = opentelemetry::sdk::export::trace::stdout::new_pipeline()
//!     .with_trace_config(sdk::trace::config().with_resource(sdk::Resource::new(vec![
//!         semcov::resource::SERVICE_NAME.string("my-service"),
//!         semcov::resource::SERVICE_NAMESPACE.string("my-namespace"),
//!     ])))
//!     .install_simple();
//! ```

use opentelemetry::Key;

/// Logical name of the service.
///
/// MUST be the same for all instances of horizontally scaled services.
pub const SERVICE_NAME: Key = Key::from_static_str("service.name");

/// A namespace for `service.name`.
///
/// 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.
/// `service.name` is expected to be unique within the same namespace.
///
/// If `service.namespace` is not specified in the Resource then `service.name`
/// 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.
pub const SERVICE_NAMESPACE: Key = Key::from_static_str("service.namespace");

/// The string ID of the service instance.
///
/// MUST be unique for each instance of the same
/// `service.namespace,service.name` pair (in other words
/// `service.namespace,service.name,service.id` 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). It is
/// preferable for the ID to be persistent and stay the same for the lifetime of
/// the service instance, however it is acceptable that the ID is ephemeral and
/// changes during important lifetime events for the service (e.g. service
/// restarts).
///
/// If the service has no inherent unique ID that can be used as the value of
/// this attribute it is recommended to generate a random Version 1 or Version 4
/// RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version
/// 5, see RFC 4122 for more recommendations).
pub const SERVICE_INSTANCE_ID: Key = Key::from_static_str("service.instance.id");

/// The version string of the service API or implementation.
pub const SERVICE_VERSION: Key = Key::from_static_str("service.version");

/// The name of the telemetry SDK as defined above.
pub const TELEMETRY_SDK_NAME: Key = Key::from_static_str("telemetry.sdk.name");

/// The language of the telemetry SDK.
pub const TELEMETRY_SDK_LANGUAGE: Key = Key::from_static_str("telemetry.sdk.language");

/// The version string of the telemetry SDK.
pub const TELEMETRY_SDK_VERSION: Key = Key::from_static_str("telemetry.sdk.version");

/// The version string of the auto instrumentation agent, if used.
pub const TELEMETRY_AUTO_VERSION: Key = Key::from_static_str("telemetry.auto.version");

/// Name of the cloud provider.
///
/// Example values are aws, azure, gcp.
pub const CLOUD_PROVIDER: Key = Key::from_static_str("cloud.provider");

/// The cloud account ID used to identify different entities.
pub const CLOUD_ACCOUNT_ID: Key = Key::from_static_str("cloud.account.id");

/// A specific geographical location where different entities can run.
pub const CLOUD_REGION: Key = Key::from_static_str("cloud.region");

/// Zones are a sub set of the region connected through low-latency links.
///
/// In AWS, this is called availability-zone.
pub const CLOUD_ZONE: Key = Key::from_static_str("cloud.zone");

/// Container name.
pub const CONTAINER_NAME: Key = Key::from_static_str("container.name");

/// Container id. Usually a UUID, as for example used to [identify Docker
/// containers]. The UUID might be abbreviated.
///
/// [identify Docker containers]: https://docs.docker.com/engine/reference/run/#container-identification
pub const CONTAINER_ID: Key = Key::from_static_str("container.id");

/// Name of the image the container was built on.
pub const CONTAINER_IMAGE_NAME: Key = Key::from_static_str("container.image.name");

/// Container image tag.
pub const CONTAINER_IMAGE_TAG: Key = Key::from_static_str("container.image.tag");

/// Name of the [deployment environment] (aka deployment tier).
///
/// [deployment environment]: https://en.wikipedia.org/wiki/Deployment_environment
pub const DEPLOYMENT_ENVIRONMENT: Key = Key::from_static_str("deployment.environment");

/// The name of the function being executed.
pub const FAAS_NAME: Key = Key::from_static_str("faas.name");

/// The unique ID of the function being executed.
///
/// For example, in AWS Lambda this field corresponds to the [ARN] value, in GCP
/// to the URI of the resource, and in Azure to the [FunctionDirectory] field.
///
/// [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
/// [FunctionDirectory]: https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function
pub const FAAS_ID: Key = Key::from_static_str("faas.id");

/// The version string of the function being executed as defined in [Version
/// Attributes].
///
/// [Version Attributes]: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions#version-attributes
pub const FAAS_VERSION: Key = Key::from_static_str("faas.version");

/// The execution environment ID as a string.
pub const FAAS_INSTANCE: Key = Key::from_static_str("faas.instance");

/// Unique host ID.
///
/// For Cloud, this must be the instance_id assigned by the cloud provider.
pub const HOST_ID: Key = Key::from_static_str("host.id");

/// 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.
pub const HOST_NAME: Key = Key::from_static_str("host.name");

/// Type of host.
///
/// For Cloud, this must be the machine type.
pub const HOST_TYPE: Key = Key::from_static_str("host.type");

/// Name of the VM image or OS install the host was instantiated from.
pub const HOST_IMAGE_NAME: Key = Key::from_static_str("host.image.name");

/// VM image ID.
///
/// For Cloud, this value is from the provider.
pub const HOST_IMAGE_ID: Key = Key::from_static_str("host.image.id");

/// The version string of the VM image as defined in [Version Attributes].
///
/// [Version Attributes]: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions#version-attributes
pub const HOST_IMAGE_VERSION: Key = Key::from_static_str("host.image.version");

/// The name of the cluster.
pub const K8S_CLUSTER_NAME: Key = Key::from_static_str("k8s.cluster.name");

/// The name of the namespace that the pod is running in.
pub const K8S_NAMESPACE_NAME: Key = Key::from_static_str("k8s.namespace.name");

/// The UID of the Pod.
pub const K8S_POD_UID: Key = Key::from_static_str("k8s.pod.uid");

/// The name of the Pod.
pub const K8S_POD_NAME: Key = Key::from_static_str("k8s.pod.name");

/// The name of the Container in a Pod template.
pub const K8S_CONTAINER_NAME: Key = Key::from_static_str("k8s.container.name");

/// The UID of the ReplicaSet.
pub const K8S_REPLICASET_UID: Key = Key::from_static_str("k8s.replicaset.uid");

/// The name of the ReplicaSet.
pub const K8S_REPLICASET_NAME: Key = Key::from_static_str("k8s.replicaset.name");

/// The UID of the Deployment.
pub const K8S_DEPLOYMENT_UID: Key = Key::from_static_str("k8s.deployment.uid");

/// The name of the Deployment.
pub const K8S_DEPLOYMENT_NAME: Key = Key::from_static_str("k8s.deployment.name");

/// The UID of the StatefulSet.
pub const K8S_STATEFULSET_UID: Key = Key::from_static_str("k8s.statefulset.uid");

/// The name of the StatefulSet.
pub const K8S_STATEFULSET_NAME: Key = Key::from_static_str("k8s.statefulset.name");

/// The UID of the DaemonSet.
pub const K8S_DAEMONSET_UID: Key = Key::from_static_str("k8s.daemonset.uid");

/// The name of the DaemonSet.
pub const K8S_DAEMONSET_NAME: Key = Key::from_static_str("k8s.daemonset.name");

/// The UID of the Job.
pub const K8S_JOB_UID: Key = Key::from_static_str("k8s.job.uid");

/// The name of the Job.
pub const K8S_JOB_NAME: Key = Key::from_static_str("k8s.job.name");

/// The UID of the CronJob.
pub const K8S_CRONJOB_UID: Key = Key::from_static_str("k8s.cronjob.uid");

/// The name of the CronJob.
pub const K8S_CRONJOB_NAME: Key = Key::from_static_str("k8s.cronjob.name");

/// The operating system type.
pub const OS_TYPE: Key = Key::from_static_str("os.type");

/// Human readable (not intended to be parsed) OS version information, like e.g.
/// reported by `ver` or `lsb_release -a` commands.
pub const OS_DESCRIPTION: Key = Key::from_static_str("os.description");

/// Process identifier (PID).
pub const PROCESS_PID: Key = Key::from_static_str("process.pid");

/// The name of the process executable.
///
/// On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On
/// Windows, can be set to the base name of `GetProcessImageFileNameW`.
pub const PROCESS_EXECUTABLE_NAME: Key = Key::from_static_str("process.executable.name");

/// The full path to the process executable.
///
/// On Linux based systems, can be set to the target of `proc/[pid]/exe`. On
/// Windows, can be set to the result of `GetProcessImageFileNameW`.
pub const PROCESS_EXECUTABLE_PATH: Key = Key::from_static_str("process.executable.path");

/// The command used to launch the process (i.e. the command name).
///
/// On Linux based systems, can be set to the zeroth string in
/// `proc/[pid]/cmdline`. On Windows, can be set to the first parameter
/// extracted from `GetCommandLineW`.
pub const PROCESS_COMMAND: Key = Key::from_static_str("process.command");

/// The full command used to launch the process.
///
/// The value can be either a list of strings representing the ordered list of
/// arguments, or a single string representing the full command.
///
/// On Linux based systems, can be set to the list of null-delimited strings
/// extracted from `proc/[pid]/cmdline`. On Windows, can be set to the result of
/// `GetCommandLineW`.
pub const PROCESS_COMMAND_LINE: Key = Key::from_static_str("process.command_line");

/// The username of the user that owns the process.
pub const PROCESS_OWNER: Key = Key::from_static_str("process.owner");

/// The name of the runtime of this process.
///
/// For compiled native binaries, this SHOULD be the name of the compiler.
pub const PROCESS_RUNTIME_NAME: Key = Key::from_static_str("process.runtime.name");

/// The version of the runtime of this process, as returned by the runtime
/// without modification.
pub const PROCESS_RUNTIME_VERSION: Key = Key::from_static_str("process.runtime.version");

/// An additional description about the runtime of the process, for example a
/// specific vendor customization of the runtime environment.
pub const PROCESS_RUNTIME_DESCRIPTION: Key = Key::from_static_str("process.runtime.description");