Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding k8 support for container id detection #1962

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
PR review changes
abhee11 committed Apr 23, 2024
commit acf2c557ce9b9b29c18dacf3fdf66b3a12af30f9
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ import * as util from 'util';
import { diag } from '@opentelemetry/api';

const { KubeConfig, CoreV1Api } = require('@kubernetes/client-node');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to use require instead of import?

require('dotenv').config();

export class ContainerDetector implements Detector {
readonly CONTAINER_ID_LENGTH = 64;
Original file line number Diff line number Diff line change
@@ -139,8 +139,8 @@ describe('ContainerDetector', () => {
});
});

describe('Detect containerId in k8 environment', () => {
it('should return an empty Resource when not in a K8 environment', async () => {
describe('Detect containerId in k8s environment', () => {
it('should return an empty Resource when not in a k8s environment', async () => {
const containerDetector = new ContainerDetector();
sinon
.stub(containerDetector, '_isInKubernetesEnvironment' as any)