-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support sending a service
tag for all integrations
#4877
Conversation
bcb5ae3
to
4f84cb0
Compare
4f84cb0
to
acac344
Compare
While running unit tests, we have to be careful that the Aggregator does not already contain a MockedSender, which may not behave the way we expect to and which is very confusing while looking at the test failed result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I think I'd do the test thing slightly different, it feels a bit hacky right now. I suggested a couple of minor changes.
uptime = uptimeSampler | ||
uptimeCheck := new(UptimeCheck) | ||
uptimeCheck.Configure(nil, nil, "test") | ||
|
||
mock := mocksender.NewMockSender(uptimeCheck.ID()) | ||
// it's not needed but we've better to recreate it with the check ID, for the sake of correctness | ||
mock = mocksender.NewMockSender(uptimeCheck.ID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would rather have us do something like:
aggregator.SetSender(mock, uptimeCheck.ID())
or add a helper to mocksender
to do it.
fileHandleCheck := new(fhCheck) | ||
fileHandleCheck.Configure(nil, nil, "test") | ||
|
||
mock := mocksender.NewMockSender(fileHandleCheck.ID()) | ||
// it's not needed but we've better to recreate it with the check ID, for the sake of correctness | ||
mock = mocksender.NewMockSender(fileHandleCheck.ID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
// SetCheckService appends the service as a tag for metrics, events, and service checks | ||
// This may be called any number of times, though the only the last call will have an effect | ||
func (s *checkSender) SetCheckService(service string) { | ||
s.service = service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed every check will have its own sender, so this should be 👍
// because the FinalizeCheckServiceTag is called in Configure. | ||
// Hopefully, the check ID is an empty string while running unit tests; | ||
mock := mocksender.NewMockSender("") | ||
mock.On("FinalizeCheckServiceTag").Return() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should maybe call mock.SetupAcceptAll()
instead?
cc3926b
to
f107b6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If 💚 on the CI, ship it 📦
6232d00
to
49f14ba
Compare
Motivation
We want to feature the notion of service more prominently for integrations so that we can correlate metrics with logs and traces