client

package
v0.0.0-...-3736fb9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	// State is the state of the alert.
	State string
	// Value is the value of the alert.
	Value string
	// ActiveAt was when the alert started.
	ActiveAt time.Time
}

Alert represents a Prometheus alert.

type CallOption

type CallOption func(o *callOptions) error

CallOption is an option for method.

func WithActiveAt

func WithActiveAt(t time.Time) CallOption

WithActiveAt restrics alerts to ones from this time to now.

func WithEnd

func WithEnd(t time.Time) CallOption

Withend sets the maximum time a trace had to start in order to be included.

func WithLabels

func WithLabels(labels []string) CallOption

WithLabels restricts alerts to ones that have all these labels.

func WithLimit

func WithLimit(i int32) CallOption

WithLimt sets the maximum amount of return values. When using Cassandra, this is not a limit, it is some weird value where increasing it can increase how deep cassandra searches for traces. In that case, setting 20 might return 10 results but setting 100 might return 20.

func WithOperation

func WithOperation(s string) CallOption

WithOperation restricts traces to ones that have this operation.

func WithStart

func WithStart(t time.Time) CallOption

WithStart sets the minimum time a trace had to start in order to be included.

func WithStates

func WithStates(states []string) CallOption

WithStates restrics alerts to ones that have one of these states.

func WithTags

func WithTags(tags []string) CallOption

WithTags restricts resuts to ones that have all these tags.

type Log

type Log struct {
	Time  time.Time
	Key   string
	Value string
}

type Ops

type Ops struct {
	// contains filtered or unexported fields
}

Ops is a client for interacting with the Ops service.

func New

func New(addr string) (*Ops, error)

New is the constructor for Client. addr is the server's [host]:[port].

func (*Ops) Alerts

func (o *Ops) Alerts(ctx context.Context, options ...CallOption) ([]Alert, error)

Alerts returns a list of Prometheus alerts that are firing.

func (*Ops) ChangeSampling

func (o *Ops) ChangeSampling(ctx context.Context, sampler *pb.ChangeSamplingReq) error

ChangeSampling is used to change the sampling rate of the service.

func (*Ops) DeployedVersion

func (o *Ops) DeployedVersion(ctx context.Context) (string, error)

DeployedVersion will return the deployed version of the application according to Prometheus.

func (*Ops) ListTraces

func (o *Ops) ListTraces(ctx context.Context, options ...CallOption) ([]TraceItem, error)

ListTraces lists traces for the Petstore. By default it pulls the latest 10 items.

func (*Ops) ShowLogs

func (o *Ops) ShowLogs(ctx context.Context, id string) ([]Log, error)

func (*Ops) ShowTrace

func (o *Ops) ShowTrace(ctx context.Context, id string) (*pb.ShowTraceResp, error)

ShowTrace returns the Jaeger URL that is going to have the trace.

type TraceData

type TraceData struct {
	ID         string
	Operations []string
	Errors     []string
	Tags       []string
	Duration   time.Time
}

type TraceItem

type TraceItem struct {
	// ID is the ID of the trace in hex form.
	ID string
	// Start is the start time of the trace.
	Start time.Time
}

TraceItem details information on a trace.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL