-
Notifications
You must be signed in to change notification settings - Fork 664
/
Copy pathcloud_attributes.py
142 lines (129 loc) · 6.42 KB
/
cloud_attributes.py
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
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from enum import Enum
from typing import Final
CLOUD_ACCOUNT_ID: Final = "cloud.account.id"
"""
The cloud account ID the resource is assigned to.
"""
CLOUD_AVAILABILITY_ZONE: Final = "cloud.availability_zone"
"""
Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
"""
CLOUD_PLATFORM: Final = "cloud.platform"
"""
The cloud platform in use.
Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.
"""
CLOUD_PROVIDER: Final = "cloud.provider"
"""
Name of the cloud provider.
"""
CLOUD_REGION: Final = "cloud.region"
"""
The geographical region the resource is running.
Note: Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
"""
CLOUD_RESOURCE_ID: Final = "cloud.resource_id"
"""
Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP).
Note: On some cloud providers, it may not be possible to determine the full ID at startup,
so it may be necessary to set `cloud.resource_id` as a span attribute instead.
The exact value to use for `cloud.resource_id` depends on the cloud provider.
The following well-known definitions MUST be used if you set this attribute and they apply:
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
Take care not to use the "invoked ARN" directly but replace any
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
with the resolved function version, as the same runtime instance may be invokable with
multiple different aliases.
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function,
*not* the function app, having the form
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
a TracerProvider.
"""
class CloudPlatformValues(Enum):
ALIBABA_CLOUD_ECS: Final = "alibaba_cloud_ecs"
"""Alibaba Cloud Elastic Compute Service."""
ALIBABA_CLOUD_FC: Final = "alibaba_cloud_fc"
"""Alibaba Cloud Function Compute."""
ALIBABA_CLOUD_OPENSHIFT: Final = "alibaba_cloud_openshift"
"""Red Hat OpenShift on Alibaba Cloud."""
AWS_EC2: Final = "aws_ec2"
"""AWS Elastic Compute Cloud."""
AWS_ECS: Final = "aws_ecs"
"""AWS Elastic Container Service."""
AWS_EKS: Final = "aws_eks"
"""AWS Elastic Kubernetes Service."""
AWS_LAMBDA: Final = "aws_lambda"
"""AWS Lambda."""
AWS_ELASTIC_BEANSTALK: Final = "aws_elastic_beanstalk"
"""AWS Elastic Beanstalk."""
AWS_APP_RUNNER: Final = "aws_app_runner"
"""AWS App Runner."""
AWS_OPENSHIFT: Final = "aws_openshift"
"""Red Hat OpenShift on AWS (ROSA)."""
AZURE_VM: Final = "azure_vm"
"""Azure Virtual Machines."""
AZURE_CONTAINER_APPS: Final = "azure_container_apps"
"""Azure Container Apps."""
AZURE_CONTAINER_INSTANCES: Final = "azure_container_instances"
"""Azure Container Instances."""
AZURE_AKS: Final = "azure_aks"
"""Azure Kubernetes Service."""
AZURE_FUNCTIONS: Final = "azure_functions"
"""Azure Functions."""
AZURE_APP_SERVICE: Final = "azure_app_service"
"""Azure App Service."""
AZURE_OPENSHIFT: Final = "azure_openshift"
"""Azure Red Hat OpenShift."""
GCP_BARE_METAL_SOLUTION: Final = "gcp_bare_metal_solution"
"""Google Bare Metal Solution (BMS)."""
GCP_COMPUTE_ENGINE: Final = "gcp_compute_engine"
"""Google Cloud Compute Engine (GCE)."""
GCP_CLOUD_RUN: Final = "gcp_cloud_run"
"""Google Cloud Run."""
GCP_KUBERNETES_ENGINE: Final = "gcp_kubernetes_engine"
"""Google Cloud Kubernetes Engine (GKE)."""
GCP_CLOUD_FUNCTIONS: Final = "gcp_cloud_functions"
"""Google Cloud Functions (GCF)."""
GCP_APP_ENGINE: Final = "gcp_app_engine"
"""Google Cloud App Engine (GAE)."""
GCP_OPENSHIFT: Final = "gcp_openshift"
"""Red Hat OpenShift on Google Cloud."""
IBM_CLOUD_OPENSHIFT: Final = "ibm_cloud_openshift"
"""Red Hat OpenShift on IBM Cloud."""
TENCENT_CLOUD_CVM: Final = "tencent_cloud_cvm"
"""Tencent Cloud Cloud Virtual Machine (CVM)."""
TENCENT_CLOUD_EKS: Final = "tencent_cloud_eks"
"""Tencent Cloud Elastic Kubernetes Service (EKS)."""
TENCENT_CLOUD_SCF: Final = "tencent_cloud_scf"
"""Tencent Cloud Serverless Cloud Function (SCF)."""
class CloudProviderValues(Enum):
ALIBABA_CLOUD: Final = "alibaba_cloud"
"""Alibaba Cloud."""
AWS: Final = "aws"
"""Amazon Web Services."""
AZURE: Final = "azure"
"""Microsoft Azure."""
GCP: Final = "gcp"
"""Google Cloud Platform."""
HEROKU: Final = "heroku"
"""Heroku Platform as a Service."""
IBM_CLOUD: Final = "ibm_cloud"
"""IBM Cloud."""
TENCENT_CLOUD: Final = "tencent_cloud"
"""Tencent Cloud."""