opentelemetry-resource-detector-aws 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 429116d05599cffc09f1eec4a3388814253324212b2e6b96eca00d3df44e64e3
4
- data.tar.gz: 747b2f8a7f85f136b0fe444131715b4c4c9ca71bd8f984f84112d61aaf24f208
3
+ metadata.gz: ded8b68da8a6aece93506643aa4342037e5ee1b872f4fe1e3212f271593971f5
4
+ data.tar.gz: 46debb724b7e7eb023c1a77265f9c3619f2c79a5918c72cbbae78dfd8d19e3cd
5
5
  SHA512:
6
- metadata.gz: ef158a34cdf6ca5e64a7f7099ed945f275edd5abb593fa6bb1703c4689f540a362b1ce14e15f044b996bd484ac4a3a7be2afb0c9dbf779c87459d19835a210c5
7
- data.tar.gz: 3dca5b641f81304876fe9fdb666c2d1bdc36941319abfbe48cc0adb02a49a0d35c54acca51fa2faba9d8c3785581acd7ecbc691d084e168908f8fefa51902014
6
+ metadata.gz: 1427c18743f8daf15ddfcb1eef735efad31d885b3c045d35ab0da501c0c002d9e465911201f0a631e4a6edd9ddd80d09caa17aaf3014ca0e5df3376f229e5c95
7
+ data.tar.gz: 635f7845f15fc076565063e57c44abf631267e2618a14de71ba7feca1a731e3f12ba8b02e1eafbe06bbc84b9917a51457bc4ca20bee3a2d9b6949a03a6cbe687
data/README.md CHANGED
@@ -46,10 +46,11 @@ end
46
46
  ### AWS EC2 Detector
47
47
 
48
48
  <!-- cspell:ignore Fargate -->
49
+
49
50
  Populates `cloud` and `host` for processes running on Amazon EC2, including abstractions such as ECS on EC2. Notably, it does not populate anything on AWS Fargate.
50
51
 
51
52
  | Resource Attribute | Description |
52
- |--------------------|-------------|
53
+ | ------------------ | ----------- |
53
54
  | `cloud.account.id` | Value of `accountId` from `/latest/dynamic/instance-identity/document` request |
54
55
  | `cloud.availability_zone` | Value of `availabilityZone` from `/latest/dynamic/instance-identity/document` request |
55
56
  | `cloud.platform` | The cloud platform. In this context, it's always "aws_ec2" |
@@ -63,8 +64,9 @@ Populates `cloud` and `host` for processes running on Amazon EC2, including abst
63
64
 
64
65
  <!-- cspell:ignore launchtype awslogs -->
65
66
  Populates `cloud`, `container`, and AWS ECS-specific attributes for processes running on Amazon ECS.
67
+
66
68
  | Resource Attribute | Description |
67
- |--------------------|-------------|
69
+ | ------------------ | ----------- |
68
70
  | `cloud.platform` | The cloud platform. In this context, it's always "aws_ecs" |
69
71
  | `cloud.provider` | The cloud provider. In this context, it's always "aws" |
70
72
  | `container.id` | The container ID from the `/proc/self/cgroup` file |
@@ -80,22 +82,26 @@ Populates `cloud`, `container`, and AWS ECS-specific attributes for processes ru
80
82
  ### AWS EKS Detector
81
83
 
82
84
  Populates `cloud`, `container`, and Kubernetes (k8s) attributes for processes running on Amazon EKS.
85
+
83
86
  | Resource Attribute | Description |
84
- |--------------------|-------------|
87
+ | ------------------ | ----------- |
85
88
  | `cloud.platform` | The cloud platform. In this context, it's always "aws_eks" |
86
89
  | `cloud.provider` | The cloud provider. In this context, it's always "aws" |
87
90
  | `container.id` | The container ID from the `/proc/self/cgroup` file |
88
91
  | `k8s.cluster.name` | The name of the EKS cluster from the `cluster-info` config map in the `amazon-cloudwatch` namespace |
89
92
 
90
93
  The EKS detector verifies that the process is running on EKS by checking:
94
+
91
95
  1. Presence of Kubernetes service account token and certificate
92
96
  2. Ability to access the `aws-auth` config map in the `kube-system` namespace
93
97
  3. Availability of either cluster name or container ID
94
98
 
95
99
  ### AWS Lambda Detector
100
+
96
101
  Populates `cloud` and `faas` (Function as a Service) attributes for processes running on AWS Lambda.
102
+
97
103
  | Resource Attribute | Description |
98
- |--------------------|-------------|
104
+ | ------------------ | ----------- |
99
105
  | `cloud.platform` | The cloud platform. In this context, it's always "aws_lambda" |
100
106
  | `cloud.provider` | The cloud provider. In this context, it's always "aws" |
101
107
  | `cloud.region` | The AWS region from the `AWS_REGION` environment variable |
@@ -102,7 +102,7 @@ module OpenTelemetry
102
102
  # Extracting logging-related resource attributes
103
103
  #
104
104
  # @param container_metadata [Hash] Container metadata from ECS metadata endpoint
105
- # @returhn [Hash] Resource attributes for logging configuration
105
+ # @return [Hash] Resource attributes for logging configuration
106
106
  def get_logs_resource(container_metadata)
107
107
  log_attributes = {}
108
108
 
@@ -17,6 +17,9 @@ module OpenTelemetry
17
17
  # Create a constant for resource semantic conventions
18
18
  RESOURCE = OpenTelemetry::SemanticConventions::Resource
19
19
 
20
+ # Path to the symlink created by the OTel Lambda extension containing the AWS account ID
21
+ ACCOUNT_ID_SYMLINK_PATH = '/tmp/.otel-aws-account-id'
22
+
20
23
  def detect
21
24
  # Return empty resource if not running on Lambda
22
25
  return OpenTelemetry::SDK::Resources::Resource.create({}) unless lambda_environment?
@@ -34,6 +37,14 @@ module OpenTelemetry
34
37
 
35
38
  # Convert memory size to integer
36
39
  resource_attributes[RESOURCE::FAAS_MAX_MEMORY] = ENV['AWS_LAMBDA_FUNCTION_MEMORY_SIZE'].to_i if ENV['AWS_LAMBDA_FUNCTION_MEMORY_SIZE']
40
+
41
+ # Read cloud.account.id from symlink created by the OTel Lambda extension
42
+ begin
43
+ account_id = File.readlink(ACCOUNT_ID_SYMLINK_PATH)
44
+ resource_attributes[RESOURCE::CLOUD_ACCOUNT_ID] = account_id
45
+ rescue Errno::ENOENT, Errno::EINVAL
46
+ OpenTelemetry.logger.debug('Lambda: cloud.account.id not available via symlink')
47
+ end
37
48
  rescue StandardError => e
38
49
  OpenTelemetry.handle_error(exception: e, message: 'Lambda resource detection failed')
39
50
  return OpenTelemetry::SDK::Resources::Resource.create({})
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Resource
9
9
  module Detector
10
10
  module AWS
11
- VERSION = '0.5.0'
11
+ VERSION = '0.7.0'
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-resource-detector-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: opentelemetry-sdk
@@ -44,8 +43,11 @@ files:
44
43
  homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
45
44
  licenses:
46
45
  - Apache-2.0
47
- metadata: {}
48
- post_install_message:
46
+ metadata:
47
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-resource-detector-aws/0.7.0/file/CHANGELOG.md
48
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-resource-detector-aws/v0.7.0/resources/aws
49
+ bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
50
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-resource-detector-aws/0.7.0
49
51
  rdoc_options: []
50
52
  require_paths:
51
53
  - lib
@@ -53,15 +55,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
55
  requirements:
54
56
  - - ">="
55
57
  - !ruby/object:Gem::Version
56
- version: '3.2'
58
+ version: '3.3'
57
59
  required_rubygems_version: !ruby/object:Gem::Requirement
58
60
  requirements:
59
61
  - - ">="
60
62
  - !ruby/object:Gem::Version
61
63
  version: '0'
62
64
  requirements: []
63
- rubygems_version: 3.4.19
64
- signing_key:
65
+ rubygems_version: 4.0.6
65
66
  specification_version: 4
66
67
  summary: AWS resource detector for OpenTelemetry
67
68
  test_files: []