Documentation
¶
Index ¶
- Variables
- func ClientWithTelemetry(name string, wt func(http.RoundTripper) http.RoundTripper) func(http.RoundTripper) http.RoundTripper
- func InstrumentErrorCounter(counter *prometheus.CounterVec, next http.RoundTripper) promhttp.RoundTripperFunc
- func NewGrpcServer(opt ...grpc.ServerOption) *grpc.Server
- func SetClientBurst(name string, burst int)
- func SetClientQPS(name string, qps float32)
- func WithTelemetry(handler http.Handler) http.Handler
- type MockProm
- func (m *MockProm) AlertManagers(ctx context.Context) (promv1.AlertManagersResult, error)
- func (m *MockProm) Alerts(ctx context.Context) (promv1.AlertsResult, error)
- func (m *MockProm) Buildinfo(ctx context.Context) (promv1.BuildinfoResult, error)
- func (m *MockProm) CleanTombstones(ctx context.Context) error
- func (m *MockProm) Config(ctx context.Context) (promv1.ConfigResult, error)
- func (m *MockProm) DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error
- func (m *MockProm) Flags(ctx context.Context) (promv1.FlagsResult, error)
- func (m *MockProm) LabelNames(ctx context.Context, matches []string, startTime time.Time, endTime time.Time, ...) ([]string, promv1.Warnings, error)
- func (m *MockProm) LabelValues(ctx context.Context, label string, matches []string, startTime time.Time, ...) (model.LabelValues, promv1.Warnings, error)
- func (m *MockProm) Metadata(ctx context.Context, metric string, limit string) (map[string][]promv1.Metadata, error)
- func (m *MockProm) Query(ctx context.Context, query string, ts time.Time, opts ...promv1.Option) (model.Value, promv1.Warnings, error)
- func (m *MockProm) QueryExemplars(ctx context.Context, query string, startTime time.Time, endTime time.Time) ([]promv1.ExemplarQueryResult, error)
- func (m *MockProm) QueryRange(ctx context.Context, query string, r promv1.Range, opts ...promv1.Option) (model.Value, promv1.Warnings, error)
- func (m *MockProm) Rules(ctx context.Context) (promv1.RulesResult, error)
- func (m *MockProm) Runtimeinfo(ctx context.Context) (promv1.RuntimeinfoResult, error)
- func (m *MockProm) Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time, ...) ([]model.LabelSet, promv1.Warnings, error)
- func (m *MockProm) Snapshot(ctx context.Context, skipHead bool) (promv1.SnapshotResult, error)
- func (m *MockProm) TSDB(ctx context.Context, opts ...promv1.Option) (promv1.TSDBResult, error)
- func (m *MockProm) Targets(ctx context.Context) (promv1.TargetsResult, error)
- func (m *MockProm) TargetsMetadata(ctx context.Context, matchTarget string, metric string, limit string) ([]promv1.MetricMetadata, error)
- func (m *MockProm) WalReplay(ctx context.Context) (promv1.WalReplayStatus, error)
Constants ¶
This section is empty.
Variables ¶
var ( // RequestLatencyBucketsSeconds represents latency buckets to record (seconds) RequestLatencyBucketsSeconds = append(append(append( prometheus.LinearBuckets(0.01, 0.01, 5), prometheus.LinearBuckets(0.1, 0.1, 5)...), prometheus.LinearBuckets(1, 1, 5)...), prometheus.LinearBuckets(10, 10, 5)...) // ResponseSizeBuckets represents response size buckets (bytes) ResponseSizeBuckets = append(append(append( prometheus.LinearBuckets(100, 100, 5), prometheus.LinearBuckets(1000, 1000, 5)...), prometheus.LinearBuckets(10000, 10000, 5)...), prometheus.LinearBuckets(1000000, 1000000, 5)...) )
Functions ¶
func ClientWithTelemetry ¶
func ClientWithTelemetry(name string, wt func(http.RoundTripper) http.RoundTripper) func(http.RoundTripper) http.RoundTripper
ClientWithTelemetry instruments the HTTP client with prometheus
func InstrumentErrorCounter ¶
func InstrumentErrorCounter(counter *prometheus.CounterVec, next http.RoundTripper) promhttp.RoundTripperFunc
func NewGrpcServer ¶
func NewGrpcServer(opt ...grpc.ServerOption) *grpc.Server
NewGrpcServer returns a grpc server pre-configured with prometheus interceptors and oc-grpc handler
func SetClientBurst ¶
func SetClientQPS ¶
Types ¶
type MockProm ¶
type MockProm struct { Res model.Value QueriesExecuted []string // expose the queries our Mock Prometheus receives, to test query generation // contains filtered or unexported fields }
MockProm satisfies the promv1.API interface for testing. TODO: move this into something shared under /controller, or into /pkg
func (*MockProm) AlertManagers ¶
AlertManagers returns an overview of the current state of the Prometheus alert manager discovery.
func (*MockProm) Buildinfo ¶
Buildinfo returns various build information properties about the Prometheus server
func (*MockProm) CleanTombstones ¶
CleanTombstones removes the deleted data from disk and cleans up the existing tombstones.
func (*MockProm) DeleteSeries ¶
func (m *MockProm) DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error
DeleteSeries deletes data for a selection of series in a time range.
func (*MockProm) LabelNames ¶
func (m *MockProm) LabelNames(ctx context.Context, matches []string, startTime time.Time, endTime time.Time, opts ...promv1.Option) ([]string, promv1.Warnings, error)
LabelNames returns the unique label names present in the block in sorted order by given time range and matchers.
func (*MockProm) LabelValues ¶
func (m *MockProm) LabelValues(ctx context.Context, label string, matches []string, startTime time.Time, endTime time.Time, opts ...promv1.Option) (model.LabelValues, promv1.Warnings, error)
LabelValues performs a query for the values of the given label, time range and matchers.
func (*MockProm) Metadata ¶
func (m *MockProm) Metadata(ctx context.Context, metric string, limit string) (map[string][]promv1.Metadata, error)
Metadata returns the metadata of the specified metric
func (*MockProm) Query ¶
func (m *MockProm) Query(ctx context.Context, query string, ts time.Time, opts ...promv1.Option) (model.Value, promv1.Warnings, error)
Query performs a query for the given time.
func (*MockProm) QueryExemplars ¶
func (m *MockProm) QueryExemplars(ctx context.Context, query string, startTime time.Time, endTime time.Time) ([]promv1.ExemplarQueryResult, error)
QueryExemplars performs a query for exemplars by the given query and time range.
func (*MockProm) QueryRange ¶
func (m *MockProm) QueryRange(ctx context.Context, query string, r promv1.Range, opts ...promv1.Option) (model.Value, promv1.Warnings, error)
QueryRange performs a query for the given range.
func (*MockProm) Rules ¶
Rules returns a list of alerting and recording rules that are currently loaded.
func (*MockProm) Runtimeinfo ¶
Runtimeinfo returns the runtime info about Prometheus
func (*MockProm) Series ¶
func (m *MockProm) Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time, opts ...promv1.Option) ([]model.LabelSet, promv1.Warnings, error)
Series finds series by label matchers.
func (*MockProm) Snapshot ¶
Snapshot creates a snapshot of all current data into snapshots/<datetime>-<rand> under the TSDB's data directory and returns the directory as response.
func (*MockProm) Targets ¶
Targets returns an overview of the current state of the Prometheus target discovery.