MCPcopy
hub / github.com/prometheus/pushgateway / MetricStore

Interface MetricStore

storage/interface.go:27–68  ·  view source on GitHub ↗

MetricStore is the interface to the storage layer for metrics. All its methods must be safe to be called concurrently.

Source from the content-addressed store, hash-verified

25// MetricStore is the interface to the storage layer for metrics. All its
26// methods must be safe to be called concurrently.
27type MetricStore interface {
28 // SubmitWriteRequest submits a WriteRequest for processing. There is no
29 // guarantee when a request will be processed, but it is guaranteed that
30 // the requests are processed in the order of submission.
31 SubmitWriteRequest(req WriteRequest)
32 // GetMetricFamilies returns all the currently saved MetricFamilies. The
33 // returned MetricFamilies are guaranteed to not be modified by the
34 // MetricStore anymore. However, they may still be read somewhere else,
35 // so the caller is not allowed to modify the returned MetricFamilies.
36 // If different groups have saved MetricFamilies of the same name, they
37 // are all merged into one MetricFamily by concatenating the contained
38 // Metrics. Inconsistent help strings are logged, and one of the
39 // versions will "win". Inconsistent types and inconsistent or duplicate
40 // label sets will go undetected.
41 GetMetricFamilies() []*dto.MetricFamily
42 // GetMetricFamiliesMap returns a map grouping-key -> MetricGroup. The
43 // MetricFamily pointed to by the Metrics map in each MetricGroup is
44 // guaranteed to not be modified by the MetricStore anymore. However,
45 // they may still be read somewhere else, so the caller is not allowed
46 // to modify it. Otherwise, the returned nested map can be seen as a
47 // deep copy of the internal state of the MetricStore and completely
48 // owned by the caller.
49 GetMetricFamiliesMap() GroupingKeyToMetricGroup
50 // Shutdown must only be called after the caller has made sure that
51 // SubmitWriteRequests is not called anymore. (If it is called later,
52 // the request might get submitted, but not processed anymore.) The
53 // Shutdown method waits for the write request queue to empty, then it
54 // persists the content of the MetricStore (if supported by the
55 // implementation). Also, all internal goroutines are stopped. This
56 // method blocks until all of that is complete. If an error is
57 // encountered, it is returned (whereupon the MetricStorage is in an
58 // undefinded state). If nil is returned, the MetricStore cannot be
59 // "restarted" again, but it can still be used for read operations.
60 Shutdown() error
61 // Healthy returns nil if the MetricStore is currently working as
62 // expected. Otherwise, a non-nil error is returned.
63 Healthy() error
64 // Ready returns nil if the MetricStore is ready to be used (all files
65 // are opened and checkpoints have been restored). Otherwise, a non-nil
66 // error is returned.
67 Ready() error
68}
69
70// WriteRequest is a request to change the MetricStore, i.e. to process it, a
71// write lock has to be acquired.

Callers 11

PushFunction · 0.65
DeleteFunction · 0.65
WipeMetricStoreFunction · 0.65
checkMetricFamiliesFunction · 0.65
checkMetricFamilyGroupsFunction · 0.65
metricsMethod · 0.65
StatusFunction · 0.65
WipeMetricStoreFunction · 0.65
shutdownServerOnQuitFunction · 0.65
HealthyFunction · 0.65
ReadyFunction · 0.65

Implementers 2

DiskMetricStorestorage/diskmetricstore.go
MockMetricStorehandler/handler_test.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…