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 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 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 ¶ added in v1.1.0
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