-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tracing): allow opting out from tracing (#503)
* feat(tracing): allow opting out from tracing (disable exporters + block instrumentations) * fix(tests): fix flaky tests
- Loading branch information
1 parent
48ab869
commit 18f2170
Showing
27 changed files
with
215 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
export const LUMIGO_LOGGING_NAMESPACE = '@lumigo/opentelemetry'; | ||
|
||
export const DEFAULT_LUMIGO_TRACES_ENDPOINT = | ||
'https://ga-otlp.lumigo-tracer-edge.golumigo.com/v1/traces'; | ||
|
||
export const DEFAULT_LUMIGO_LOGS_ENDPOINT = | ||
'https://ga-otlp.lumigo-tracer-edge.golumigo.com/v1/logs'; | ||
|
||
export const DEFAULT_DEPENDENCIES_ENDPOINT = | ||
'https://ga-otlp.lumigo-tracer-edge.golumigo.com/v1/dependencies'; | ||
|
||
// Since tracing is on by default, we allow omitting it and consider it enabled | ||
export const TRACING_ENABLED = | ||
process.env.LUMIGO_ENABLE_TRACES === undefined || | ||
process.env.LUMIGO_ENABLE_TRACES?.toLowerCase() === 'true'; | ||
|
||
export const LOGGING_ENABLED = process.env.LUMIGO_ENABLE_LOGS?.toLowerCase() === 'true'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/instrumentations/aws-sdk/LumigoAwsSdkLibInstrumentation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { BunyanInstrumentation } from '@opentelemetry/instrumentation-bunyan'; | ||
import { Instrumentor } from '../instrumentor'; | ||
import { LoggingInstrumentor } from '../instrumentor'; | ||
|
||
export default class LumigoBunyanInstrumentation extends Instrumentor<BunyanInstrumentation> { | ||
export default class LumigoBunyanInstrumentation extends LoggingInstrumentor<BunyanInstrumentation> { | ||
getInstrumentedModule(): string { | ||
return 'bunyan'; | ||
} | ||
|
||
getInstrumentation(): BunyanInstrumentation { | ||
return new BunyanInstrumentation(); | ||
} | ||
|
||
override isApplicable(): boolean { | ||
return super.isApplicable() && process.env.LUMIGO_ENABLE_LOGS?.toLowerCase() === 'true'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { WinstonInstrumentation } from '@opentelemetry/instrumentation-winston'; | ||
import { Instrumentor } from '../instrumentor'; | ||
import { LoggingInstrumentor } from '../instrumentor'; | ||
|
||
export default class LumigoWinstonInstrumentation extends Instrumentor<WinstonInstrumentation> { | ||
export default class LumigoWinstonInstrumentation extends LoggingInstrumentor<WinstonInstrumentation> { | ||
getInstrumentedModule(): string { | ||
return 'winston'; | ||
} | ||
|
||
getInstrumentation(): WinstonInstrumentation { | ||
return new WinstonInstrumentation(); | ||
} | ||
|
||
override isApplicable(): boolean { | ||
return super.isApplicable() && process.env.LUMIGO_ENABLE_LOGS?.toLowerCase() === 'true'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const lumigo = require('@lumigo/opentelemetry'); | ||
const fastify = require('fastify')({ logger: true }); | ||
const bunyan = require('bunyan'); | ||
const bunyanLogger = bunyan.createLogger({ name: __filename }) | ||
|
||
let tracerProvider; | ||
let loggerProvider; | ||
|
||
fastify.get('/', async (request, reply) => reply.send('server is ready')); | ||
|
||
fastify.get('/quit', async (request, reply) => { | ||
bunyanLogger.info('this should not be exported to Lumigo'); | ||
|
||
console.log('Received quit command, flushing and exiting'); | ||
await tracerProvider.forceFlush(); | ||
await loggerProvider.forceFlush(); | ||
|
||
// we could have used fastify.close(), but it just takes too long | ||
reply.send({}).then(() => process.exit(0)) | ||
}); | ||
|
||
fastify.listen({ port: 0 }, async (err, address) => { | ||
if (err) { | ||
throw err; | ||
} | ||
const lumigoSdk = await lumigo.init | ||
tracerProvider = lumigoSdk.tracerProvider; | ||
loggerProvider = lumigoSdk.loggerProvider; | ||
const port = fastify.server.address().port; | ||
console.error(`HTTP server listening on port ${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "lumigo-features-test", | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": { | ||
"start": "node -r @lumigo/opentelemetry app.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@lumigo/opentelemetry": "file:../../../../distro.tgz", | ||
"fastify": "4.0.1", | ||
"bunyan": "1.8.15" | ||
} | ||
} |
Oops, something went wrong.