This repository has been archived by the owner on Aug 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
weight spans using their sample rate #226
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,9 @@ import ( | |
|
||
type groupedStats struct { | ||
tags TagSet | ||
hits int64 | ||
errors int64 | ||
duration int64 | ||
hits float64 | ||
errors float64 | ||
duration float64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we can use |
||
durationDistribution *quantile.SliceSummary | ||
} | ||
|
||
|
@@ -163,7 +163,7 @@ func assembleGrain(b *bytes.Buffer, env, resource, service string, m map[string] | |
} | ||
|
||
// HandleSpan adds the span to this bucket stats, aggregated with the finest grain matching given aggregators | ||
func (sb *StatsRawBucket) HandleSpan(s Span, env string, aggregators []string, sublayers *[]SublayerValue) { | ||
func (sb *StatsRawBucket) HandleSpan(s Span, env string, aggregators []string, weight float64, sublayers *[]SublayerValue) { | ||
if env == "" { | ||
panic("env should never be empty") | ||
} | ||
|
@@ -179,7 +179,7 @@ func (sb *StatsRawBucket) HandleSpan(s Span, env string, aggregators []string, s | |
} | ||
|
||
grain, tags := assembleGrain(&sb.keyBuf, env, s.Resource, s.Service, m) | ||
sb.add(s, grain, tags) | ||
sb.add(s, weight, grain, tags) | ||
|
||
// sublayers - special case | ||
if sublayers != nil { | ||
|
@@ -189,7 +189,7 @@ func (sb *StatsRawBucket) HandleSpan(s Span, env string, aggregators []string, s | |
} | ||
} | ||
|
||
func (sb *StatsRawBucket) add(s Span, aggr string, tags TagSet) { | ||
func (sb *StatsRawBucket) add(s Span, weight float64, aggr string, tags TagSet) { | ||
var gs groupedStats | ||
var ok bool | ||
|
||
|
@@ -198,11 +198,11 @@ func (sb *StatsRawBucket) add(s Span, aggr string, tags TagSet) { | |
gs = newGroupedStats(tags) | ||
} | ||
|
||
gs.hits++ | ||
gs.hits += weight | ||
if s.Error != 0 { | ||
gs.errors++ | ||
gs.errors += weight | ||
} | ||
gs.duration += s.Duration | ||
gs.duration += float64(s.Duration) * weight | ||
|
||
// TODO add for s.Metrics ability to define arbitrary counts and distros, check some config? | ||
// alter resolution of duration distro | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is the move from
int64
tofloat64
going to impact anything in the serialization/payload to the API? Is the API compatible?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 this in an internal format only that we then export to the API payload format.
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.
These counters are for internal computations in
StatsRawBucket
.(*StatsRawBucket).Export()
returns aStatsBucket
which already stores data usingCount
structures which usefloat64
values.