GithubHelp home page GithubHelp logo

Comments (5)

tredman avatar tredman commented on May 6, 2024

Do you want to avoid calling beeline.init at all, or are you just trying to avoid sending events to honeycomb in a dev environment?

For the latter: You could initialize the beeline with dummy values for writekey and dataset, then override the transmission to send to stderr. There's an example here: https://docs.honeycomb.io/beeline/python/#customizing-event-transmission

If you want to avoid writing anything you could also override the transmitter to write to /dev/null.

import beeline
import libhoney
import os
from libhoney.transmission import FileTransmission

beeline.init(writekey='yourwritekey', transmission_impl=FileTransmission(output=open(os.devnull, 'w'))

(we really should add a NullTransmission to libhoney, for when absolutely no output is desired.)

If you are trying to avoid calling beeline.init at all - I think we would need to update beeline.tracer to work in the case that it's not initialized. Funnily enough, in version 2.4.1, we added a traced function wrapper that does work if the beeline is not initialized - you might try that if you just want to use the wrapper. Docs are here: https://docs.honeycomb.io/beeline/python/#using-traces - see the section "using a decorator".

Let me know if this helps.

from beeline-python.

mariokostelac avatar mariokostelac commented on May 6, 2024

Do you want to avoid calling beeline.init at all, or are you just trying to avoid sending events to honeycomb in a dev environment?

Sorry for not explaining the problem clearly enough. I am trying to do something different actually. I am trying to avoid the need to call beeline.init() in some environments and still have decorated functions work properly.

Funnily enough, in version 2.4.1, we added a traced function wrapper that does work if the beeline is not initialized - you might try that if you just want to use the wrapper. Docs are here: https://docs.honeycomb.io/beeline/python/#using-traces - see the section "using a decorator".
Let me know if this helps.

It seems to be exactly what I need! Will upgrade now (running 2.3.0) and remove my homebrew decorators.

from beeline-python.

tredman avatar tredman commented on May 6, 2024

Btw #53 will fix the issue with the context manager. When #54 lands I'll cut version 2.4.4 with the changes.

from beeline-python.

mariokostelac avatar mariokostelac commented on May 6, 2024

Btw #53 will fix the issue with the context manager.

👏

from beeline-python.

mariokostelac avatar mariokostelac commented on May 6, 2024

Fixed.

from beeline-python.

Related Issues (20)

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.