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

Expose a way to monitor the queue state #61

Open
thomas-girotto opened this issue Sep 22, 2022 · 3 comments
Open

Expose a way to monitor the queue state #61

thomas-girotto opened this issue Sep 22, 2022 · 3 comments

Comments

@thomas-girotto
Copy link

thomas-girotto commented Sep 22, 2022

Hello there,

I'm using the periodicbatching through elasticsearch-sink, and i'd like to be able to monitor the state of the bounded queue.

Unless i'm missing something, there's no way to know if my system is producing more logs than it can digest, and i'd find it useful to receive an alert before starting to drop LogEvents.

Something like adding in the PeriodicBatchingSinkOptions

  • a callback that would be triggered after a given threshold is reached
  • a callback that would be triggered when we're back to below this threshold
  • the threshold itself

Of course that would be useful for me only if elasticsearch-sink is ok to use those new settings, i'll ping them after your answer :)

Please let me know, i can do a PR if you're OK with the idea.

@nblumhardt
Copy link
Member

Hi! Sounds good to explore, thanks!

@thomas-girotto
Copy link
Author

@nblumhardt gentle reminder: do you think you'll have time to review my PR soon ?

@vzalamea
Copy link

vzalamea commented Jan 6, 2023

same problem here. Using Serilog.Sinks.Splunk and spamming my logger

there's a call to _queue.TryEnqueue(logEvent) that doesn't use the boolean return value which can return false.

public bool TryEnqueue(T item)
{
    if (_queueLimit == -1)
    {
        _queue.Enqueue(item);
        return true;
    }

    bool result = true;
    try
    {
    }
    finally
    {
        if (Interlocked.Increment(ref _counter) <= _queueLimit)
        {
            _queue.Enqueue(item);
        }
        else
        {
            Interlocked.Decrement(ref _counter);
            result = false;
        }
    }

    return result;
}

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

3 participants