File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed
jest-environment-otel/src Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11module . exports = {
22 timeout : 2000 ,
3- useRemoteOtelReceiver : false ,
3+ useLocalOtelReceiver : true , // default (false) is to use traceloop backend
44} ;
Original file line number Diff line number Diff line change 99 "start:test-servers" : " lerna run --scope @traceloop/test-servers start" ,
1010 "docker:instrument-opentelemetry" : " docker build -f packages/instrument-opentelemetry/Dockerfile . -t instrument-opentelemetry" ,
1111 "docker:test-servers" : " docker build -f packages/test-servers/Dockerfile . -t test-servers" ,
12- "test" : " jest" ,
13- "test-ci" : " concurrently -k --success \" command-1\" --hide 0 \" npm:start:test-servers\" \" npm:test\" " ,
12+ "test" : " TRACELOOP_URL='http://localhost:4123/v1/traces' jest" ,
13+ "test-ci" : " TRACELOOP_URL='http://localhost:4123/v1/traces' concurrently -k --success \" command-1\" --hide 0 \" npm:start:test-servers\" \" npm:test\" " ,
1414 "release" : " npm run build && lerna publish --conventional-commits --no-private"
1515 },
1616 "workspaces" : [
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ export interface FetchTracesConfig {
1010 pollInterval : number ;
1111 awaitAllSpansInTraceTimeout : number ;
1212 url : string ;
13- customerId : string ;
13+ apiKey : string ;
1414}
1515
1616export const fetchTracesConfigBase : FetchTracesConfig = {
1717 maxPollTime : 9000 ,
1818 pollInterval : 1000 ,
1919 awaitAllSpansInTraceTimeout : 2000 ,
20- url : 'http ://localhost:4123 /v1/traces',
21- customerId : 'local ',
20+ url : process . env . TRACELOOP_URL || 'https ://api.traceloop.dev /v1/traces',
21+ apiKey : process . env . TRACELOOP_API_KEY || 'none ',
2222} ;
2323
2424/**
Original file line number Diff line number Diff line change 11import http from 'http' ;
2+ import https from 'https' ;
23import { opentelemetry } from '@traceloop/otel-proto' ;
34import { FetchTracesConfig } from './trace-loop/fetch-traces' ;
45
@@ -88,7 +89,8 @@ export function httpGetBinary(
8889) : Promise < Buffer > {
8990 const url = `${ config . url } /${ traceloopId } ` ;
9091 return new Promise ( ( resolve , reject ) => {
91- http . get ( url , { headers : { Authorization : config . customerId } } , ( res ) => {
92+ const method = config . url . includes ( 'https' ) ? https : http ;
93+ method . get ( url , { headers : { Authorization : config . apiKey } } , ( res ) => {
9294 const { statusCode } = res ;
9395
9496 if ( ! statusCode || statusCode < 200 || statusCode >= 300 ) {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export async function setup(jestConfig: JestConfig = {}) {
1818 didAlreadyRunInWatchMode = true ;
1919 }
2020
21- if ( config . useRemoteOtelReceiver ) {
21+ if ( ! config ?. useLocalOtelReceiver ) {
2222 return ;
2323 }
2424
You can’t perform that action at this time.
0 commit comments