MSP-8172 Add vendor

This commit is contained in:
Синельник Тимур Романович committed 2026-07-29 12:52:27 +03:00
1 parent 5175d87e08
commit eb066cb055
2619 files changed
+757077 -2

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
package report
import (
"github.com/getsentry/sentry-go/internal/protocol"
"github.com/getsentry/sentry-go/internal/ratelimit"
)
// ReportableItem is the minimal surface needed for client report accounting.
type ReportableItem interface {
GetCategory() ratelimit.Category
}
// ClientReportRecorder is used by components that need to record lost/discarded events.
type ClientReportRecorder interface {
Record(reason DiscardReason, category ratelimit.Category, quantity int64)
RecordOne(reason DiscardReason, category ratelimit.Category)
RecordForEnvelope(reason DiscardReason, envelope *protocol.Envelope)
RecordItem(reason DiscardReason, item ReportableItem)
}
// ClientReportProvider is used by the single component responsible for sending client reports.
type ClientReportProvider interface {
TakeReport() *ClientReport
AttachToEnvelope(envelope *protocol.Envelope)
}
// noopRecorder is a no-op implementation of ClientReportRecorder.
type noopRecorder struct{}
func (noopRecorder) Record(DiscardReason, ratelimit.Category, int64) {}
func (noopRecorder) RecordOne(DiscardReason, ratelimit.Category) {}
func (noopRecorder) RecordForEnvelope(DiscardReason, *protocol.Envelope) {}
func (noopRecorder) RecordItem(DiscardReason, ReportableItem) {}
// noopProvider is a no-op implementation of ClientReportProvider.
type noopProvider struct{}
func (noopProvider) TakeReport() *ClientReport { return nil }
func (noopProvider) AttachToEnvelope(_ *protocol.Envelope) {}
// NoopRecorder returns a no-op ClientReportRecorder that silently discards all records.
func NoopRecorder() ClientReportRecorder { return noopRecorder{} }
// NoopProvider returns a no-op ClientReportProvider that always returns nil reports.
func NoopProvider() ClientReportProvider { return noopProvider{} }