GithubHelp home page GithubHelp logo

Logger override about signalfx-nodejs HOT 6 OPEN

signalfx avatar signalfx commented on August 23, 2024
Logger override

from signalfx-nodejs.

Comments (6)

jtmal-signalfx avatar jtmal-signalfx commented on August 23, 2024 1

@bhack-onshape Added to the backlog, I'll let you know when we have an ETA.

from signalfx-nodejs.

jtmal-signalfx avatar jtmal-signalfx commented on August 23, 2024

So the obvious duck tape is below, but you should understand that if something breaks because of it, then you can't blame me.

Of course, beyond proof-of-concept, you don't want that. There's 2 ways:

  • open a support ticket (I can do it, but I need to know the contract details - is the organisation in your profile the one on behalf of which you're asking?) and we'll implement an option to expose the logger
  • send a PR that implements it, and we'll review and merge (but we'll need a CLA first)
const logger = require('signalfx/lib/logger');

const originalLoggerInfo = logger.info;
logger.info = (...args) => originalLoggerInfo.call(logger, `some context info: ${args[0]}`, ...args.slice(1));
// same pattern for other log levels: log, info, warn, warning, error, debug

const signalfx = require('signalfx');
// your code that uses signalfx

from signalfx-nodejs.

bhack-onshape avatar bhack-onshape commented on August 23, 2024

I came to raise this exact issue and found it had already been done! We also need to be able to provide a custom logger to the signalfx module. I've taken the initiative and opened support ticket 00018228 for this since it is going to be very painful for us to have messages of mixed formats in our logs.

from signalfx-nodejs.

bhack-onshape avatar bhack-onshape commented on August 23, 2024

@bhack-onshape Added to the backlog, I'll let you know when we have an ETA.

Thanks @jtmal-signalfx ! I've implemented something similar to your duck tape to forward to our logger rather than console which works for now. Will be good to have core support though.

from signalfx-nodejs.

jtmal-signalfx avatar jtmal-signalfx commented on August 23, 2024

Sorry, there was a misunderstanding and this issue was reclassified as an idea for improvement, so I opened it for you https://ideas.splunk.com/ideas/SFXMAPMID-I-152. It will need a certain number of votes to proceed.

That said the PR route is still open (but it requires https://github.com/signalfx/signalfx-nodejs/blob/main/CONTRIBUTING.md#contributor-license-agreement) and I can review PRs right after they're sent.

from signalfx-nodejs.

andrew-prior avatar andrew-prior commented on August 23, 2024

The issue that I have with this is that you are throwing an unhandle-able promise rejection.

I am using the splunk-otel library, which uses this library internally. For metrics reporting, the splunk-otel library exports the metrics in a setInterval callback. When the .send method throws, the error does not get handled, and there is nothing I can do, as the consumer, to provide handling for the error.

This is all that is needed to handle the error internally: SignalFxClient.prototype.send = function (data) { var _this = this; this.rawData.push(data); return this.loadAWSUniqueId .then(function () { _this.processingData(); return _this.startAsyncSend(); }).catch(logger.error); };

With the catch block, the error gets logged, but does not register in the consumer app as an unhandled promise rejection.

I have raised an issue on the splunk-otel library as well.

from signalfx-nodejs.

Related Issues (18)

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.