Giter Club home page Giter Club logo

asyncgelf's Introduction

Metrics

asyncgelf's People

Contributors

makeg0 avatar malinkinsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

e2sure makeg0

asyncgelf's Issues

Make 'httpx' optional requirement

Is your feature request related to a problem? Please describe.
For lightweight setups we'd want to minimize dependencies. Technically 'httpx' is only required for HTTP handler but not for TCP and UDP.

Describe the solution you'd like
Wrap 'httpx' import into try..except and remove from required dependencies.

Describe alternatives you've considered
No.

Additional context
No.

Timestamp in the handler

Hello,

I've successfully used your library.
I just had to make a modification that could be interesting to add to the default one.

The timestamp parameter

In the GELF documentation there is this parameter that is crucial to have them nicely saved on graylog.

As I've used this library to ingest old logs I wanted to forcefeed the timestamp into the GELF.

I had to add in the library the timestamp in

  • def init with Optional[int] =None
  • self.timestamp=timestamp
  • gelf_message = {... 'timestamp':self.timestamp}

In my code I've used int(datetime.strptime(<variable_from_log>, <timeformat>).timestamp()) to get the right format of my original time from the log. It worked.

I was just wondering if there is a more "elegant" way to integrate it in the library.

Thanks

Possible blocking operation in GelfUdp

Describe the bug
(

client_socket.sendto(bytes_msg, (
)

in the line above sync call from async happens.

To Reproduce

Minimal code example:

import asyncio
import asyncgelf
handler = asyncgelf.GelfUdp(host='127.0.0.1')
asyncio.run(handler.udp_handler({'text': 'yo!'}))

Expected behavior
Actually I think that it's also extremely useful to have both sync and async interfaces. So the expected behaviour is sync calls to happen synchronously and async to happen asynchronously.

Additional context
So the current implementation for GelfUdp from what I can see is pretty much sync, and the GelfUdp.make_gelf_chunks() is sync as well.

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.