Git Product home page Git Product logo

otlp-logger's Introduction

Hi there ๐Ÿ‘‹

I am Vladimir Adamiฤ‡, a freelance software developer from Zagreb, Croatia.

  • ๐Ÿ“ซ You can reach me at my website,
  • ๐Ÿ’ฌ Ask me about Node.js, JavaScript, TypeScript
  • ๐Ÿ˜„ Pronouns: he/his

otlp-logger's People

Contributors

10xlacroixdrinker avatar dependabot[bot] avatar github-actions[bot] avatar h4ad avatar vunovati avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

otlp-logger's Issues

API design question: exporter options key

Why is it that different keys are required to pass options to the different exporters? e.g. When exporterOptions.protocol is grpc, you must use exporterOptions.grpcExporterOptions and when exporterOptions.protocol is http, you must use exporterOptions.httpExporterOptions.

Why not just use exporterOptions.options for all of them? Is it simply because of the types? If so, are you open to a non-breaking PR to support exporterOptions.options properly typed with overrides?

OTel deps as peerDeps

What are your thoughts on making the OTel dependencies peerDependencies so that they can be updated without waiting on an otlp-logger release?

Feature discussion: support for custom exporters

TL;DR What do you think of adding support for custom exporters?

Background

Using the ConsoleLogRecordExporter with pino-opentelemetry-transport, I noticed that the colorization doesn't work locally. This happens because the logger is in a worker thread and process.stdout is not a TTY.

I opened open-telemetry/opentelemetry-js#4524 to add an option to ConsoleLogRecordExporter that would force colorization. However, the OpenTelemetry team suggested implementing a custom exporter as they do not want to expand the API for ConsoleLogRecordExporter (which currently takes no options).

Ultimately, I will likely stick with my workaround of using process.env.FORCE_COLOR=1. But this is what got me thinking about otlp-logger supporting custom exporters.

Design

A custom exporter just needs to implement the LogRecordExporter interface. The API could look something like this:

const logger = getOtlpLogger({
  loggerName: 'my-app',
  resourceAttributes: {/* ... */},
  serviceVersion: '1.0.0',
  logRecordProcessorOptions: {
    recordProcessorType: 'batch',
    exporterOptions: {
      path: path.join(__dirname, 'my-exporter'), // or just 'name-of-custom-exporter-package'
      export: 'LogExporter', // optional, assumes default export when omitted
      options: {/* ... */} // optional
    }
  }
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.