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 NewClient(ctx context.Context, jsonCreds []byte, universeDomain string) (*Client, error)
- func NewClientWithAccessToken(ctx context.Context, accessToken string, universeDomain string) (*Client, error)
- func NewClientWithGCE(ctx context.Context, universeDomain string) (*Client, error)
- func NewClientWithImpersonation(ctx context.Context, jsonCreds []byte, impersonateSA string, ...) (*Client, error)
- func NewClientWithPassThrough(ctx context.Context, headers map[string]string, universeDomain string) (*Client, error)
- func (c *Client) Close() error
- func (c *Client) GetTrace(ctx context.Context, q *TraceQuery) (*cloudtracepb.Trace, error)
- func (c *Client) ListProjects(ctx context.Context, query string) ([]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.
// If query is non-empty it is forwarded to the Resource Manager search filter.
ListProjects(ctx context.Context, query string) ([]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 spans, and a resourcemanager client to list projects
func NewClientWithAccessToken ¶ added in v1.2.0
func NewClientWithAccessToken(ctx context.Context, accessToken string, universeDomain string) (*Client, error)
NewClientWithAccessToken creates a new Client using an access token for authentication. Since the datasource is re-created whenever the token changes, we can treat this token as static.
func NewClientWithGCE ¶
NewClientWithGCE 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, universeDomain string) (*Client, error)
NewClientWithImpersonation creates a new Client using service account impersonation
func NewClientWithPassThrough ¶ added in v1.3.0
func NewClientWithPassThrough(ctx context.Context, headers map[string]string, universeDomain string) (*Client, error)
NewClientWithPassThrough creates a new Client using OAuth browser credentials
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 ¶
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