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

Support sending a service tag for all integrations #4877

Merged
merged 5 commits into from
Feb 12, 2020
Merged

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Feb 11, 2020

Motivation

We want to feature the notion of service more prominently for integrations so that we can correlate metrics with logs and traces

@ofek ofek added component/collector component/aggregator [deprecated] team/agent-core Deprecated. Use metrics-logs / shared-components labels instead.. team/integrations labels Feb 11, 2020
@ofek ofek added this to the 7.18.0 milestone Feb 11, 2020
@ofek ofek requested review from a team as code owners February 11, 2020 19:57
@ofek ofek force-pushed the ofek/service-tag branch 6 times, most recently from bcb5ae3 to 4f84cb0 Compare February 11, 2020 21:58
@ofek ofek requested a review from a team as a code owner February 11, 2020 21:58
remeh and others added 2 commits February 12, 2020 17:42
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.
Copy link
Member

@truthbk truthbk left a 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())
Copy link
Member

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())
Copy link
Member

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
Copy link
Member

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()
Copy link
Member

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?

Copy link
Member

@truthbk truthbk left a 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 📦

truthbk
truthbk previously approved these changes Feb 12, 2020
@truthbk truthbk merged commit edca3da into master Feb 12, 2020
@ofek ofek deleted the ofek/service-tag branch February 12, 2020 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/aggregator component/collector [deprecated] team/agent-core Deprecated. Use metrics-logs / shared-components labels instead.. team/integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants