Skip to content

Commit 9b5fe60

Browse files
committed
no metrics for functions without examples
1 parent ea1eefc commit 9b5fe60

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
- Add default non-root user in the Docker image. ([#593](https://github.com/getsentry/vroom/pull/593))
3636
- Classify macOS frames from an application as application frames. ([#604](https://github.com/getsentry/vroom/pull/604))
3737
- Return number of occurrences in flamegraph. ([#622](https://github.com/getsentry/vroom/pull/622), [#625](https://github.com/getsentry/vroom/pull/625))
38-
- Use function duration when computing metrics ([#627](https://github.com/getsentry/vroom/pull/627), [#628](https://github.com/getsentry/vroom/pull/628), [#629](https://github.com/getsentry/vroom/pull/629), [#630](https://github.com/getsentry/vroom/pull/630), [#635](https://github.com/getsentry/vroom/pull/635))
38+
- Use function duration when computing metrics ([#627](https://github.com/getsentry/vroom/pull/627), [#628](https://github.com/getsentry/vroom/pull/628), [#629](https://github.com/getsentry/vroom/pull/629), [#630](https://github.com/getsentry/vroom/pull/630), [#635](https://github.com/getsentry/vroom/pull/635), [#638](https://github.com/getsentry/vroom/pull/638))
3939
- Remove Unused metrics endpoint ([#633](https://github.com/getsentry/vroom/pull/633))
4040

4141
**Bug Fixes**:

internal/metrics/metrics.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (a *Aggregator) AddFunction(n *nodetree.Node, depth int) {
143143
}
144144

145145
for example := range n.Profiles {
146-
if len(function.Examples) < a.maxUniqueFunctions {
146+
if len(function.Examples) < a.maxNumberOfExamples {
147147
function.Examples = append(function.Examples, example)
148148
}
149149
}
@@ -165,6 +165,11 @@ func (a Aggregator) ToMetrics() []examples.FunctionMetrics {
165165
if f.SumSelfTimeNS <= 0 {
166166
continue
167167
}
168+
169+
if len(f.Examples) <= 0 {
170+
continue
171+
}
172+
168173
sort.Slice(f.Examples, func(i, j int) bool {
169174
example1 := f.Examples[i]
170175
example2 := f.Examples[j]

0 commit comments

Comments
 (0)