Documentation ¶
Index ¶
- func GetListTracesFilter(queryText string) (string, error)
- func GetServiceName(span *tracepb.TraceSpan) string
- func GetSpanOperationName(span *tracepb.TraceSpan) string
- func GetTags(span *tracepb.TraceSpan) (serviceTags json.RawMessage, spanTags json.RawMessage, err error)
- func GetTraceName(span *tracepb.TraceSpan) string
- type API
- type AlertManagerAlert
- type AlertManagerTime
- type Alertmanager
- type Client
- func (c *Client) Close() error
- func (c *Client) GetTrace(ctx context.Context, q *TraceQuery) (*cloudtracepb.Trace, error)
- func (c *Client) ListProjects(ctx context.Context) ([]string, error)
- func (c *Client) ListTraces(ctx context.Context, q *TracesQuery) ([]*cloudtracepb.Trace, error)
- func (c *Client) TestConnection(ctx context.Context, projectID string) error
- type TimeRange
- type TraceQuery
- type TracesQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetListTracesFilter ¶
GetListTracesFilter takes the raw query text from a user and converts it to a filter string as expected by the Cloud Trace API
func GetServiceName ¶
GetServiceName returns the service name for the span
func GetSpanOperationName ¶
GetSpanOperationName gets the name and method label value for the span and combines them to create a descriptive name
func GetTags ¶
func GetTags(span *tracepb.TraceSpan) (serviceTags json.RawMessage, spanTags json.RawMessage, err error)
GetTags converts Google Trace labels to Grafana service and span tags
func GetTraceName ¶
GetTraceName gets the name, service label value, and method label value for the span and combines them to create a descriptive name
Types ¶
type API ¶
type API interface { // ListTraces retrieves all traces matching some query filter up to the given limit ListTraces(context.Context, *TracesQuery) ([]*cloudtracepb.Trace, error) // GetTrace retrieves a trace matching a trace ID GetTrace(context.Context, *TraceQuery) (*cloudtracepb.Trace, error) // TestConnection queries for any trace from the given project TestConnection(ctx context.Context, projectID string) error // ListProjects returns the project IDs of all visible projects ListProjects(context.Context) ([]string, error) // Close closes the underlying connection to the GCP API Close() error }
API implements the methods we need to query traces and list projects from GCP
type AlertManagerAlert ¶
type AlertManagerAlert struct { Status string `json:"status"` Labels map[string]string `json:"labels"` Annotations map[string]string `json:"annotations"` StartsAt AlertManagerTime `json:"startsAt"` EndsAt AlertManagerTime `json:"endsAt,omitempty"` }
type AlertManagerTime ¶
AlertManagerTime takes care of representing time.Time as RFC3339. See https://prometheus.io/docs/alerting/0.27/clients/
func (AlertManagerTime) MarshalJSON ¶
func (a AlertManagerTime) MarshalJSON() ([]byte, error)
func (AlertManagerTime) String ¶
func (a AlertManagerTime) String() string
func (*AlertManagerTime) UnmarshalJSON ¶
func (a *AlertManagerTime) UnmarshalJSON(jsonRepr []byte) error
type Alertmanager ¶
func NewAlertmanager ¶
func (*Alertmanager) Post ¶
func (s *Alertmanager) Post(ctx context.Context, entries []*cloudtracepb.Trace) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a GCP trace client to fetch traces and spance, and a resourcemanager client to list projects
func NewClientWithGCE ¶
NewClient creates a new Client using GCE metadata for authentication
func NewClientWithImpersonation ¶
func NewClientWithImpersonation(ctx context.Context, jsonCreds []byte, impersonateSA string) (*Client, error)
NewClient creates a new Clients using service account impersonation
func (*Client) GetTrace ¶
func (c *Client) GetTrace(ctx context.Context, q *TraceQuery) (*cloudtracepb.Trace, error)
GetTrace retrieves a single trace given a trace ID
func (*Client) ListProjects ¶
ListProjects returns the project IDs of all visible projects
func (*Client) ListTraces ¶
func (c *Client) ListTraces(ctx context.Context, q *TracesQuery) ([]*cloudtracepb.Trace, error)
ListTraces retrieves all traces matching some query filter up to the given limit
type TraceQuery ¶
TraceQuery is the information from a Grafana query needed to query GCP for a trace