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

Function New

api/v1/api.go:86–103  ·  view source on GitHub ↗

New returns a new API. The log.Logger can be nil, in which case no logging is performed.

(
	l *slog.Logger,
	ms storage.MetricStore,
	flags map[string]string,
	buildInfo map[string]string,
)

Source from the content-addressed store, hash-verified

84
85// New returns a new API. The log.Logger can be nil, in which case no logging is performed.
86func New(
87 l *slog.Logger,
88 ms storage.MetricStore,
89 flags map[string]string,
90 buildInfo map[string]string,
91) *API {
92 if l == nil {
93 l = promslog.NewNopLogger()
94 }
95
96 return &API{
97 StartTime: time.Now(),
98 logger: l,
99 MetricStore: ms,
100 Flags: flags,
101 BuildInfo: buildInfo,
102 }
103}
104
105// Register registers the API handlers under their correct routes
106// in the given router.

Callers 2

TestStatusAPIFunction · 0.85
TestMetricsAPIFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestStatusAPIFunction · 0.68
TestMetricsAPIFunction · 0.68