@sebspark/tracing
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@sebspark/tracing

Use Opentelemetry for collecting traces and exporting to Cloud Trace

How to use

/* eslint-disable @typescript-eslint/no-var-requires */
import { setupTracing } from '@sebspark/tracing'

const serviceName = 'core'

if (process.env.TRACING_PROJECT_ID) {
  setupTracing({
    serviceName,
    projectId: process.env.TRACING_PROJECT_ID,
  })
} else if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
  setupTracing({
    serviceName,
    url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
  })
}

// Sadly we need to wait a bit for the tracing to be initialized
setTimeout(() => {
  require('./run')
}, 100)

Readme

Keywords

none

Package Sidebar

Install

npm i @sebspark/tracing

Weekly Downloads

434

Version

0.0.2

License

Apache-2.0

Unpacked Size

22.3 kB

Total Files

7

Last publish

Collaborators

  • believer
  • raduachim
  • alexanderczigler
  • johanobrink