|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +# Copyright 2019 OpenTelemetry Authors |
| 4 | +# |
| 5 | +# SPDX-License-Identifier: Apache-2.0 |
| 6 | + |
| 7 | +module OpenTelemetry |
| 8 | + module SDK |
| 9 | + module Resources |
| 10 | + # Attributes describing a service instance. |
| 11 | + SERVICE_RESOURCE = { |
| 12 | + # Logical name of the service. |
| 13 | + name: 'service.name', |
| 14 | + |
| 15 | + # A namespace for `service.name`. |
| 16 | + namespace: 'service.namespace', |
| 17 | + |
| 18 | + # The string ID of the service instance. |
| 19 | + instance_id: 'service.instance.id', |
| 20 | + |
| 21 | + # The version string of the service API or implementation. |
| 22 | + version: 'service.version' |
| 23 | + }.freeze |
| 24 | + |
| 25 | + # Attributes describing the telemetry library. |
| 26 | + TELEMETRY_SDK_RESOURCE = { |
| 27 | + # The name of the telemetry library. |
| 28 | + name: 'telemetry.sdk.name', |
| 29 | + |
| 30 | + # The language of telemetry library and of the code instrumented with it. |
| 31 | + language: 'telemetry.sdk.language', |
| 32 | + |
| 33 | + # The version string of the telemetry library |
| 34 | + version: 'telemetry.sdk.version' |
| 35 | + }.freeze |
| 36 | + |
| 37 | + # Attributes defining a compute unit (e.g. Container, Process, Lambda |
| 38 | + # Function). |
| 39 | + CONTAINER_RESOURCE = { |
| 40 | + # The container name. |
| 41 | + name: 'container.name', |
| 42 | + |
| 43 | + # The name of the image the container was built on. |
| 44 | + image_name: 'container.image.name', |
| 45 | + |
| 46 | + # The container image tag. |
| 47 | + image_tag: 'container.image.tag' |
| 48 | + }.freeze |
| 49 | + |
| 50 | + FAAS_RESOURCE = { |
| 51 | + # The name of the function being executed. |
| 52 | + name: 'faas.name', |
| 53 | + |
| 54 | + # The unique name of the function being executed. |
| 55 | + id: 'faas.id', |
| 56 | + |
| 57 | + # The version string of the function being executed. |
| 58 | + version: 'faas.version', |
| 59 | + |
| 60 | + # The execution environment ID as a string. |
| 61 | + instance: 'faas.instance' |
| 62 | + }.freeze |
| 63 | + |
| 64 | + # Attributes defining a deployment service (e.g. Kubernetes). |
| 65 | + K8S_RESOURCE = { |
| 66 | + # The name of the cluster that the pod is running in. |
| 67 | + cluster_name: 'k8s.cluster.name', |
| 68 | + |
| 69 | + # The name of the namespace that the pod is running in. |
| 70 | + namespace_name: 'k8s.namespace.name', |
| 71 | + |
| 72 | + # The name of the pod. |
| 73 | + pod_name: 'k8s.pod.name', |
| 74 | + |
| 75 | + # The name of the deployment. |
| 76 | + deployment_name: 'k8s.deployment.name' |
| 77 | + }.freeze |
| 78 | + |
| 79 | + # Attributes defining a computing instance (e.g. host). |
| 80 | + HOST_RESOURCE = { |
| 81 | + # Hostname of the host. It contains what the hostname command returns on the |
| 82 | + # host machine. |
| 83 | + hostname: 'host.hostname', |
| 84 | + |
| 85 | + # Unique host id. For Cloud this must be the instance_id assigned by the |
| 86 | + # cloud provider |
| 87 | + id: 'host.id', |
| 88 | + |
| 89 | + # Name of the host. It may contain what hostname returns on Unix systems, |
| 90 | + # the fully qualified, or a name specified by the user. |
| 91 | + name: 'host.name', |
| 92 | + |
| 93 | + # Type of host. For Cloud this must be the machine type. |
| 94 | + type: 'host.type', |
| 95 | + |
| 96 | + # Name of the VM image or OS install the host was instantiated from. |
| 97 | + image_name: 'host.image.name', |
| 98 | + |
| 99 | + # VM image id. For Cloud, this value is from the provider. |
| 100 | + image_id: 'host.image.id', |
| 101 | + |
| 102 | + # The version string of the VM image. |
| 103 | + image_version: 'host.image.version' |
| 104 | + }.freeze |
| 105 | + |
| 106 | + # Attributes defining a running environment (e.g. Cloud, Data Center). |
| 107 | + CLOUD_RESOURCE = { |
| 108 | + # Name of the cloud provider. Example values are aws, azure, gcp. |
| 109 | + provider: 'cloud.provider', |
| 110 | + |
| 111 | + # The cloud account id used to identify different entities. |
| 112 | + account_id: 'cloud.account.id', |
| 113 | + |
| 114 | + # A specific geographical location where different entities can run. |
| 115 | + region: 'cloud.region', |
| 116 | + |
| 117 | + # Zones are a sub set of the region connected through low-latency links. |
| 118 | + zone: 'cloud.zone' |
| 119 | + }.freeze |
| 120 | + end |
| 121 | + end |
| 122 | +end |
0 commit comments