Skip to content

Commit

Permalink
add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankcorn committed Nov 14, 2023
1 parent b419a7d commit ae800fa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/baselime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BatchSpanProcessor, NodeTracerProvider, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node'
import api, { DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
import { detectResourcesSync, ResourceAttributes } from '@opentelemetry/resources';
import { awsEc2Detector, awsEcsDetector, awsLambdaDetector } from '@opentelemetry/resource-detector-aws'
import { VercelDetector } from './resources/vercel.ts';
Expand Down Expand Up @@ -46,6 +47,10 @@ export class BaselimeSDK {
return;
}

if (process.env.OTEL_LOG_LEVEL === "debug") {
api.diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);
}

let collectorUrl = this.options.collectorUrl;


Expand All @@ -68,6 +73,7 @@ export class BaselimeSDK {
headers: {
"x-api-key": this.options.baselimeKey || process.env.BASELIME_KEY || process.env.BASELIME_OTEL_KEY,
},
timeoutMillis: 1000,
});

const spanProcessor = this.options.serverless ? new SimpleSpanProcessor(exporter) : new BatchSpanProcessor(exporter, {
Expand Down

0 comments on commit ae800fa

Please sign in to comment.