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

Decouple reporting/tagging and publishing #932

Open
2opremio opened this issue Feb 5, 2016 · 1 comment
Open

Decouple reporting/tagging and publishing #932

2opremio opened this issue Feb 5, 2016 · 1 comment
Labels
tech-debt Unpleasantness that does (or may in future) affect development

Comments

@2opremio
Copy link
Contributor

2opremio commented Feb 5, 2016

Following up on #881 (comment):

we should have each one [tagger/publisher] on its own goroutine, trigger a report on the groutine, and then set a timeout for receiving results from them.

This will allow us to be more deadlock-resilient and do some analysis/detection of reporters/taggers taking longer than expected.

@2opremio 2opremio added this to the 0.13.0 milestone Feb 5, 2016
@2opremio
Copy link
Contributor Author

2opremio commented Feb 5, 2016

Relevant code:

scope/probe/probe.go

Lines 131 to 164 in c16f0d7

func (p *Probe) report() report.Report {
reports := make(chan report.Report, len(p.reporters))
for _, rep := range p.reporters {
go func(rep Reporter) {
t := time.Now()
newReport, err := rep.Report()
metrics.MeasureSince([]string{rep.Name(), "reporter"}, t)
if err != nil {
log.Printf("error generating report: %v", err)
newReport = report.MakeReport() // empty is OK to merge
}
reports <- newReport
}(rep)
}
result := report.MakeReport()
for i := 0; i < cap(reports); i++ {
result = result.Merge(<-reports)
}
return result
}
func (p *Probe) tag(r report.Report) report.Report {
var err error
for _, tagger := range p.taggers {
t := time.Now()
r, err = tagger.Tag(r)
metrics.MeasureSince([]string{tagger.Name(), "tagger"}, t)
if err != nil {
log.Printf("error applying tagger: %v", err)
}
}
return r
}

@paulbellamy paulbellamy removed their assignment Feb 8, 2016
@paulbellamy paulbellamy removed this from the 0.13.0 milestone Feb 12, 2016
@rade rade added the tech-debt Unpleasantness that does (or may in future) affect development label Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Unpleasantness that does (or may in future) affect development
Projects
None yet
Development

No branches or pull requests

3 participants