Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement batch mode #19

Open
slepic opened this issue Feb 2, 2024 · 2 comments
Open

Implement batch mode #19

slepic opened this issue Feb 2, 2024 · 2 comments

Comments

@slepic
Copy link
Contributor

slepic commented Feb 2, 2024

Hi,

While I was implementing the other changes I noticed monolog supports batch mode

And the logdna formatter, although it accepts batch mode parameter, there is no way to make the logdna handler+formatter actually perform batch mode.

I think it is doable, but it would probably require to move part of the logic from formatter into the handler
specifically, now the formatter returns lines array of just 1 line - it would have to instead just return that one line
and the handler would be responsible to send 1 line in normal mode, and many lines in batch mode in a single request.

This could break code for anyone who instantiates manully or extends the LogdnaFormatter.

Do you think it's worth investigating further? It's not like I'm in need of that feature right now, maybe one day... But I just noticed this while digging in the code and it made me thinking maybe the current implementation of LogdnaFormatter is not exactly what monolog intends for the implementations to be...

@nvanheuverzwijn
Copy link
Owner

That's interesting. I guess batch mode is an optimization ? Do you have a link to documentation or example of the usage ?

@slepic
Copy link
Contributor Author

slepic commented Feb 5, 2024

I guess batch mode is an optimization ?

Probably. For example the ingestion api of logdna itself can handle multiple records in a single request and there must be others.

Do you have a link to documentation

Well after brief search I didn't find much except for the BufferHandler and OverflowHandler from monolog
https://github.com/Seldaek/monolog/blob/main/doc/02-handlers-formatters-processors.md
but there's not much doc except for looking at the code. Maybe the batch mode isn't a very spread feature or I haven't looked good enough (I havent :))...

Anyway, I'm not sure it needs be implemented, unless someone wants it.. I don't rn, as I said, it's just something that occured to me during the other changes and something to consider for future...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants