@@ -32,8 +32,6 @@ import (
3232 lru "github.com/elastic/go-freelru"
3333 "github.com/klauspost/compress/zstd"
3434 "github.com/parca-dev/oomprof/oomprof"
35- "github.com/parca-dev/parca-agent/metrics"
36- "github.com/parca-dev/parca-agent/reporter/metadata"
3735 "github.com/prometheus/client_golang/prometheus"
3836 "github.com/prometheus/common/model"
3937 "github.com/prometheus/prometheus/model/labels"
@@ -46,6 +44,9 @@ import (
4644 "go.opentelemetry.io/ebpf-profiler/reporter"
4745 "go.opentelemetry.io/ebpf-profiler/reporter/samples"
4846 "go.opentelemetry.io/ebpf-profiler/support"
47+
48+ "github.com/parca-dev/parca-agent/metrics"
49+ "github.com/parca-dev/parca-agent/reporter/metadata"
4950)
5051
5152// Assert that we implement the full Reporter interface.
@@ -126,6 +127,7 @@ type ParcaReporter struct {
126127 otelLibraryMetrics map [string ]prometheus.Metric
127128
128129 // Our own metrics
130+ sampleWrites prometheus.Counter
129131 sampleWriteRequestBytes prometheus.Counter
130132 stacktraceWriteRequestBytes prometheus.Counter
131133 debuginfoUploadRequestBytes prometheus.Counter
@@ -598,6 +600,10 @@ func New(
598600 return nil , err
599601 }
600602
603+ sampleWrites := prometheus .NewCounter (prometheus.CounterOpts {
604+ Name : "sample_writes_total" ,
605+ Help : "the total number of samples written in WriteRequest calls for sample records" ,
606+ })
601607 sampleWriteRequestBytes := prometheus .NewCounter (prometheus.CounterOpts {
602608 Name : "sample_write_request_bytes" ,
603609 Help : "the total number of bytes written in WriteRequest calls for sample records" ,
@@ -612,6 +618,7 @@ func New(
612618 })
613619
614620 reg .MustRegister (sampleWriteRequestBytes )
621+ reg .MustRegister (sampleWrites )
615622 reg .MustRegister (stacktraceWriteRequestBytes )
616623 reg .MustRegister (debuginfoUploadRequestBytes )
617624
@@ -638,6 +645,7 @@ func New(
638645 },
639646 reg : reg ,
640647 otelLibraryMetrics : make (map [string ]prometheus.Metric ),
648+ sampleWrites : sampleWrites ,
641649 sampleWriteRequestBytes : sampleWriteRequestBytes ,
642650 stacktraceWriteRequestBytes : stacktraceWriteRequestBytes ,
643651 debuginfoUploadRequestBytes : debuginfoUploadRequestBytes ,
@@ -934,6 +942,7 @@ func (r *ParcaReporter) logDataForOfflineMode(ctx context.Context, buf *bytes.Bu
934942 return fmt .Errorf ("Failed to write to log %s: %v" , r .offlineModeLogPath , err )
935943 }
936944
945+ r .sampleWrites .Add (float64 (record .NumRows ()))
937946 r .sampleWriteRequestBytes .Add (float64 (buf .Len ()))
938947
939948 sidFieldIdx := nLabelCols
@@ -1055,6 +1064,8 @@ func (r *ParcaReporter) reportDataToBackend(ctx context.Context, buf *bytes.Buff
10551064 }); err != nil {
10561065 return err
10571066 }
1067+
1068+ r .sampleWrites .Add (float64 (record .NumRows ()))
10581069 r .sampleWriteRequestBytes .Add (float64 (buf .Len ()))
10591070
10601071 log .Debugf ("Sent profile with %d samples" , record .NumRows ())
0 commit comments