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

Remove dispatch metrics #331

Merged
merged 15 commits into from
Aug 1, 2020
Merged

Remove dispatch metrics #331

merged 15 commits into from
Aug 1, 2020

Conversation

tiedotguy
Copy link
Collaborator

There's some juggling with the benchmarks, which is primarily because they're now creating a MetricMap in the loop, which is not really valid. But they're in there so they're staying.

As always, commits are generally isolated.

@@ -35,7 +36,7 @@ func (fn *flushNotifier) RegisterFlush() (ch <-chan time.Duration, unregister fu

// NotifyFlush will notify any registered channels that a flush has completed.
// Non-blocking, thread-safe.
func (fn *flushNotifier) NotifyFlush(d time.Duration) {
func (fn *flushNotifier) NotifyFlush(ctx context.Context, d time.Duration) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx isn't used within this function

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added to the Statser interface so that InternalStatser had a context, which it needs to drain the MetricConsolidator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you not add it to the select block done bellow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I see what you mean. Technically yes, but there's really no point. The loop is basically non-blocking because of the default: clause.

Remember the primary purpose of cancelling a context is to signal a long-running call to finish - this isn't long running.

func (is *InternalStatser) NotifyFlush(ctx context.Context, d time.Duration) {
mms := is.consolidator.Drain(ctx)
if mms == nil {
// context is canceled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would only know that for sure if you checked ctx.Error() right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm breaking the abstraction and saying "yeah, I know why this failed". It's part of my DRAEASWH system.

"testing"
"time"

"github.com/ash2k/stager"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rip

@@ -110,9 +110,13 @@ func (dp *DatagramParser) Run(ctx context.Context) {
accumE += eventCount
accumB += badLineCount
}
// TODO: Refactor this to use a MetricConsolidator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:stare: is there an issue for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, #210

The entirety of this PR was so that when I do #210 it's a small and easy change.

@tiedotguy tiedotguy merged commit bc47d4e into master Aug 1, 2020
@tiedotguy tiedotguy deleted the tdg/remove-dispatch-metrics branch October 5, 2020 02:45
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

Successfully merging this pull request may close these issues.

None yet

2 participants