@opentelemetry/resource-detector-aws
Advanced tools
Comparing version 0.16.1-alpha.18 to 0.16.1-alpha.20
@@ -1,2 +0,2 @@ | ||
import { Detector, Resource, ResourceDetectionConfigWithLogger } from '@opentelemetry/resources'; | ||
import { Detector, Resource, ResourceDetectionConfig } from '@opentelemetry/resources'; | ||
export declare class AwsBeanstalkDetector implements Detector { | ||
@@ -7,5 +7,5 @@ BEANSTALK_CONF_PATH: string; | ||
constructor(); | ||
detect(config: ResourceDetectionConfigWithLogger): Promise<Resource>; | ||
detect(_config?: ResourceDetectionConfig): Promise<Resource>; | ||
} | ||
export declare const awsBeanstalkDetector: AwsBeanstalkDetector; | ||
//# sourceMappingURL=AwsBeanstalkDetector.d.ts.map |
@@ -19,2 +19,3 @@ "use strict"; | ||
exports.awsBeanstalkDetector = exports.AwsBeanstalkDetector = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
@@ -42,3 +43,3 @@ const fs = require("fs"); | ||
} | ||
async detect(config) { | ||
async detect(_config) { | ||
try { | ||
@@ -56,3 +57,3 @@ await AwsBeanstalkDetector.fileAccessAsync(this.BEANSTALK_CONF_PATH, fs.constants.R_OK); | ||
catch (e) { | ||
config.logger.debug(`AwsBeanstalkDetector failed: ${e.message}`); | ||
api_1.diag.debug(`AwsBeanstalkDetector failed: ${e.message}`); | ||
return resources_1.Resource.empty(); | ||
@@ -59,0 +60,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Detector, Resource, ResourceDetectionConfigWithLogger } from '@opentelemetry/resources'; | ||
import { Detector, Resource, ResourceDetectionConfig } from '@opentelemetry/resources'; | ||
/** | ||
@@ -27,5 +27,5 @@ * The AwsEc2Detector can be used to detect if a process is running in AWS EC2 | ||
* | ||
* @param config (unused) The resource detection config with a required logger | ||
* @param config (unused) The resource detection config | ||
*/ | ||
detect(_config: ResourceDetectionConfigWithLogger): Promise<Resource>; | ||
detect(_config?: ResourceDetectionConfig): Promise<Resource>; | ||
private _fetchToken; | ||
@@ -32,0 +32,0 @@ private _fetchIdentity; |
@@ -48,3 +48,3 @@ "use strict"; | ||
* | ||
* @param config (unused) The resource detection config with a required logger | ||
* @param config (unused) The resource detection config | ||
*/ | ||
@@ -51,0 +51,0 @@ async detect(_config) { |
@@ -1,2 +0,2 @@ | ||
import { Detector, Resource, ResourceDetectionConfigWithLogger } from '@opentelemetry/resources'; | ||
import { Detector, Resource, ResourceDetectionConfig } from '@opentelemetry/resources'; | ||
/** | ||
@@ -11,3 +11,3 @@ * The AwsEcsDetector can be used to detect if a process is running in AWS | ||
private static readFileAsync; | ||
detect(config: ResourceDetectionConfigWithLogger): Promise<Resource>; | ||
detect(_config?: ResourceDetectionConfig): Promise<Resource>; | ||
/** | ||
@@ -14,0 +14,0 @@ * Read container ID from cgroup file |
@@ -19,2 +19,3 @@ "use strict"; | ||
exports.awsEcsDetector = exports.AwsEcsDetector = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
@@ -35,10 +36,10 @@ const util = require("util"); | ||
} | ||
async detect(config) { | ||
async detect(_config) { | ||
const env = core_1.getEnv(); | ||
if (!env.ECS_CONTAINER_METADATA_URI_V4 && !env.ECS_CONTAINER_METADATA_URI) { | ||
config.logger.debug('AwsEcsDetector failed: Process is not on ECS'); | ||
api_1.diag.debug('AwsEcsDetector failed: Process is not on ECS'); | ||
return resources_1.Resource.empty(); | ||
} | ||
const hostName = os.hostname(); | ||
const containerId = await this._getContainerId(config); | ||
const containerId = await this._getContainerId(); | ||
return !hostName && !containerId | ||
@@ -58,3 +59,3 @@ ? resources_1.Resource.empty() | ||
*/ | ||
async _getContainerId(config) { | ||
async _getContainerId() { | ||
try { | ||
@@ -70,3 +71,3 @@ const rawData = await AwsEcsDetector.readFileAsync(this.DEFAULT_CGROUP_PATH, 'utf8'); | ||
catch (e) { | ||
config.logger.warn(`AwsEcsDetector failed to read container ID: ${e.message}`); | ||
api_1.diag.warn(`AwsEcsDetector failed to read container ID: ${e.message}`); | ||
} | ||
@@ -73,0 +74,0 @@ return undefined; |
@@ -1,2 +0,2 @@ | ||
import { Detector, Resource, ResourceDetectionConfigWithLogger } from '@opentelemetry/resources'; | ||
import { Detector, Resource, ResourceDetectionConfig } from '@opentelemetry/resources'; | ||
/** | ||
@@ -28,5 +28,5 @@ * The AwsEksDetector can be used to detect if a process is running in AWS Elastic | ||
* or aws config maps fails | ||
* @param config The resource detection config with a required logger | ||
* @param config The resource detection config | ||
*/ | ||
detect(config: ResourceDetectionConfigWithLogger): Promise<Resource>; | ||
detect(_config?: ResourceDetectionConfig): Promise<Resource>; | ||
/** | ||
@@ -36,3 +36,2 @@ * Attempts to make a connection to AWS Config map which will | ||
* process if the config map is empty or not | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
@@ -43,3 +42,2 @@ private _isEks; | ||
* Config Maps to grab cluster name | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
@@ -50,3 +48,2 @@ private _getClusterName; | ||
* credential header | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
@@ -53,0 +50,0 @@ private _getK8sCredHeader; |
@@ -23,2 +23,3 @@ "use strict"; | ||
const util = require("util"); | ||
const api_1 = require("@opentelemetry/api"); | ||
/** | ||
@@ -50,13 +51,13 @@ * The AwsEksDetector can be used to detect if a process is running in AWS Elastic | ||
* or aws config maps fails | ||
* @param config The resource detection config with a required logger | ||
* @param config The resource detection config | ||
*/ | ||
async detect(config) { | ||
async detect(_config) { | ||
try { | ||
await AwsEksDetector.fileAccessAsync(this.K8S_TOKEN_PATH); | ||
const k8scert = await AwsEksDetector.readFileAsync(this.K8S_CERT_PATH); | ||
if (!this._isEks(config, k8scert)) { | ||
if (!this._isEks(k8scert)) { | ||
return resources_1.Resource.empty(); | ||
} | ||
const containerId = await this._getContainerId(config); | ||
const clusterName = await this._getClusterName(config, k8scert); | ||
const containerId = await this._getContainerId(); | ||
const clusterName = await this._getClusterName(k8scert); | ||
return !containerId && !clusterName | ||
@@ -70,3 +71,3 @@ ? resources_1.Resource.empty() | ||
catch (e) { | ||
config.logger.warn('Process is not running on K8S', e); | ||
api_1.diag.warn('Process is not running on K8S', e); | ||
return resources_1.Resource.empty(); | ||
@@ -79,9 +80,8 @@ } | ||
* process if the config map is empty or not | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
async _isEks(config, cert) { | ||
async _isEks(cert) { | ||
const options = { | ||
ca: cert, | ||
headers: { | ||
Authorization: await this._getK8sCredHeader(config), | ||
Authorization: await this._getK8sCredHeader(), | ||
}, | ||
@@ -98,9 +98,8 @@ hostname: this.K8S_SVC_URL, | ||
* Config Maps to grab cluster name | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
async _getClusterName(config, cert) { | ||
async _getClusterName(cert) { | ||
const options = { | ||
ca: cert, | ||
headers: { | ||
Authorization: await this._getK8sCredHeader(config), | ||
Authorization: await this._getK8sCredHeader(), | ||
}, | ||
@@ -117,3 +116,3 @@ host: this.K8S_SVC_URL, | ||
catch (e) { | ||
config.logger.warn('Cannot get cluster name on EKS', e); | ||
api_1.diag.warn('Cannot get cluster name on EKS', e); | ||
} | ||
@@ -125,5 +124,4 @@ return ''; | ||
* credential header | ||
* @param config The resource detection config with a required logger | ||
*/ | ||
async _getK8sCredHeader(config) { | ||
async _getK8sCredHeader() { | ||
try { | ||
@@ -134,3 +132,3 @@ const content = await AwsEksDetector.readFileAsync(this.K8S_TOKEN_PATH, this.UTF8_UNICODE); | ||
catch (e) { | ||
config.logger.warn('Unable to read Kubernetes client token.', e); | ||
api_1.diag.warn('Unable to read Kubernetes client token.', e); | ||
} | ||
@@ -156,3 +154,3 @@ return ''; | ||
*/ | ||
async _getContainerId(config) { | ||
async _getContainerId() { | ||
try { | ||
@@ -168,3 +166,3 @@ const rawData = await AwsEksDetector.readFileAsync(this.DEFAULT_CGROUP_PATH, this.UTF8_UNICODE); | ||
catch (e) { | ||
config.logger.warn(`AwsEksDetector failed to read container ID: ${e.message}`); | ||
api_1.diag.warn(`AwsEksDetector failed to read container ID: ${e.message}`); | ||
} | ||
@@ -171,0 +169,0 @@ return undefined; |
{ | ||
"name": "@opentelemetry/resource-detector-aws", | ||
"version": "0.16.1-alpha.18+9f965b0c", | ||
"version": "0.16.1-alpha.20+62f8695d", | ||
"description": "OpenTelemetry SDK resource detector for AWS", | ||
@@ -57,7 +57,7 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.16.0", | ||
"@opentelemetry/core": "^0.16.1-alpha.18+9f965b0c", | ||
"@opentelemetry/resources": "^0.16.1-alpha.18+9f965b0c" | ||
"@opentelemetry/api": "^0.16.1-alpha.20+62f8695d", | ||
"@opentelemetry/core": "^0.16.1-alpha.20+62f8695d", | ||
"@opentelemetry/resources": "^0.16.1-alpha.20+62f8695d" | ||
}, | ||
"gitHead": "9f965b0c749108df00bbe44eeab84d79b04bb0a4" | ||
"gitHead": "62f8695d3fe5309c62418a1043bc6e8a176bc11f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
56358
713
- Removed@opentelemetry/api@0.16.0(transitive)