Skip to content

Commit 66d08c3

Browse files
authored
metric for empty samples delivered to parca_reporter (#3118)
1 parent 7d68362 commit 66d08c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

reporter/parca_reporter.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ type ParcaReporter struct {
131131
sampleWriteRequestBytes prometheus.Counter
132132
stacktraceWriteRequestBytes prometheus.Counter
133133
debuginfoUploadRequestBytes prometheus.Counter
134+
emptySamples prometheus.Counter
134135

135136
offlineModeConfig *OfflineModeConfig
136137

@@ -212,6 +213,10 @@ func (r *ParcaReporter) ReportTraceEvent(trace *libpf.Trace,
212213
return nil
213214
}
214215

216+
if len(trace.Frames) == 0 {
217+
r.emptySamples.Inc()
218+
}
219+
215220
r.sampleWriterMu.Lock()
216221
defer r.sampleWriterMu.Unlock()
217222

@@ -619,11 +624,16 @@ func New(
619624
Name: "debuginfo_upload_request_bytes",
620625
Help: "the total number of bytes uploaded in debuginfo upload requests",
621626
})
627+
emptySamples := prometheus.NewCounter(prometheus.CounterOpts{
628+
Name: "parca_reporter_empty_samples",
629+
Help: "The number of empty samples reported to the Parca reporter",
630+
})
622631

623632
reg.MustRegister(sampleWriteRequestBytes)
624633
reg.MustRegister(sampleWrites)
625634
reg.MustRegister(stacktraceWriteRequestBytes)
626635
reg.MustRegister(debuginfoUploadRequestBytes)
636+
reg.MustRegister(emptySamples)
627637

628638
r := &ParcaReporter{
629639
stopSignal: make(chan libpf.Void),
@@ -650,6 +660,7 @@ func New(
650660
otelLibraryMetrics: make(map[string]prometheus.Metric),
651661
sampleWrites: sampleWrites,
652662
sampleWriteRequestBytes: sampleWriteRequestBytes,
663+
emptySamples: emptySamples,
653664
stacktraceWriteRequestBytes: stacktraceWriteRequestBytes,
654665
debuginfoUploadRequestBytes: debuginfoUploadRequestBytes,
655666
offlineModeConfig: offlineModeConfig,

0 commit comments

Comments
 (0)