MCPcopy Index your code
hub / github.com/cortexproject/cortex / Commit

Method Commit

pkg/ruler/compat.go:95–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95func (a *PusherAppender) Commit() error {
96 a.totalWrites.Inc()
97
98 req := cortexpb.ToWriteRequest(a.labels, a.samples, nil, nil, cortexpb.RULE)
99 req.AddHistogramTimeSeries(a.histogramLabels, a.histograms)
100
101 // Set DiscardOutOfOrder flag if requested via AppendOptions
102 if a.opts != nil && a.opts.DiscardOutOfOrder {
103 req.DiscardOutOfOrder = true
104 }
105
106 // Since a.pusher is distributor, client.ReuseSlice will be called in a.pusher.Push.
107 // We shouldn't call client.ReuseSlice here.
108 _, err := a.pusher.Push(user.InjectOrgID(a.ctx, a.userID), req)
109 if err != nil {
110 // Don't report errors that ended with 4xx HTTP status code (series limits, duplicate samples, out of order, etc.)
111 if resp, ok := httpgrpc.HTTPResponseFromError(err); !ok || resp.Code/100 == 5 {
112 a.failedWrites.Inc()
113 }
114 }
115
116 a.labels = nil
117 a.samples = nil
118 a.histogramLabels = nil
119 a.histograms = nil
120 return err
121}
122
123func (a *PusherAppender) UpdateMetadata(_ storage.SeriesRef, _ labels.Labels, _ metadata.Metadata) (storage.SeriesRef, error) {
124 return 0, errors.New("update metadata unsupported")

Callers 3

TestPusherAppendableFunction · 0.45
TestPusherErrorsFunction · 0.45

Calls 4

ToWriteRequestFunction · 0.92
PushMethod · 0.65
IncMethod · 0.45

Tested by 3

TestPusherAppendableFunction · 0.36
TestPusherErrorsFunction · 0.36