mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-31 01:37:24 +00:00
f7efd7d426
* feat(otel): allow disabling cloud detectors * docs(otel): add missing env * feat: implement `OTEL_NODE_RESOURCE_DETECTORS` * test: drop snapshot * Update lib/instrumentation/reporting.spec.ts Co-authored-by: Jamie Tanna <jamie.tanna@mend.io> * docs: update otel docs --------- Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import {
|
|
awsBeanstalkDetector,
|
|
awsEc2Detector,
|
|
awsEcsDetector,
|
|
awsEksDetector,
|
|
awsLambdaDetector,
|
|
} from '@opentelemetry/resource-detector-aws';
|
|
import {
|
|
azureAppServiceDetector,
|
|
azureFunctionsDetector,
|
|
azureVmDetector,
|
|
} from '@opentelemetry/resource-detector-azure';
|
|
import { gcpDetector } from '@opentelemetry/resource-detector-gcp';
|
|
import { gitHubDetector } from '@opentelemetry/resource-detector-github';
|
|
import { envDetector } from '@opentelemetry/resources';
|
|
import { getResourceDetectors } from './detectors.ts';
|
|
|
|
describe('instrumentation/detectors', () => {
|
|
it.each`
|
|
env
|
|
${{}}
|
|
${{ OTEL_NODE_RESOURCE_DETECTORS: 'all' }}
|
|
${{ RENOVATE_USE_CLOUD_METADATA_SERVICES: 'true' }}
|
|
`('should return all detectors: %o', () => {
|
|
expect(getResourceDetectors({})).toEqual([
|
|
awsBeanstalkDetector,
|
|
awsEc2Detector,
|
|
awsEcsDetector,
|
|
awsEksDetector,
|
|
awsLambdaDetector,
|
|
azureAppServiceDetector,
|
|
azureFunctionsDetector,
|
|
azureVmDetector,
|
|
gcpDetector,
|
|
gitHubDetector,
|
|
envDetector,
|
|
]);
|
|
});
|
|
|
|
it('should disable all detectors', () => {
|
|
expect(
|
|
getResourceDetectors({ OTEL_NODE_RESOURCE_DETECTORS: 'none' }),
|
|
).toEqual([]);
|
|
});
|
|
|
|
it('should disable cloud detectors', () => {
|
|
expect(
|
|
getResourceDetectors({ RENOVATE_USE_CLOUD_METADATA_SERVICES: 'false' }),
|
|
).toEqual([envDetector]);
|
|
});
|
|
|
|
it('should enable selected detectors', () => {
|
|
expect(
|
|
getResourceDetectors({ OTEL_NODE_RESOURCE_DETECTORS: 'env,github' }),
|
|
).toEqual([gitHubDetector, envDetector]);
|
|
});
|
|
});
|