Documentation ¶
Index ¶
- func AddDeploymentRequestSpanAttributes(span otrace.Span, request *pb.DeploymentRequest)
- func New(ctx context.Context, serviceName string, collectorEndpointURL string) (*trace.TracerProvider, error)
- func TraceID(ctx context.Context) string
- func TraceParentHeader(ctx context.Context) string
- func Tracer() otrace.Tracer
- func WithTraceParent(ctx context.Context, traceParent string) context.Context
- type PipelineTimings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDeploymentRequestSpanAttributes ¶
func AddDeploymentRequestSpanAttributes(span otrace.Span, request *pb.DeploymentRequest)
Copies interesting values from the deployment request onto the span, so it can be filtered in Grafana.
func New ¶
func New(ctx context.Context, serviceName string, collectorEndpointURL string) (*trace.TracerProvider, error)
Initialize the OpenTelemetry library.
You MUST call `Shutdown()` on the tracer provider before exiting, lest traces are not sent to the collector.
func TraceID ¶
TraceID extracts the trace ID from the context. If the context does not embed a trace, an empty string is returned.
func TraceParentHeader ¶
TraceParentHeader extracts the trace parent header value from the context.
A trace parent header contains the following data:
Version - Trace ID - Span ID - Flags
00-3b03c24a4efad25e514890c874dc9e33-59c10f1945da62ca-01
Types ¶
type PipelineTimings ¶
type PipelineTimings struct { LatestCommit time.Time Start time.Time BuildStart time.Time AttestStart time.Time End time.Time }
Holds timestamps from pipeline indicating when certain steps were started or finished. If `Validate()` returns nil, this object is safe to use and contains chronologically ordered timestamps for every field.
func ParsePipelineTelemetry ¶
func ParsePipelineTelemetry(s string) (*PipelineTimings, error)
Parse pipeline build timings.
Uses the following input format:
latest_commit=1726040395,pipeline_start=1726050395,pipeline_end=1726050512,build_start=1726050400,attest_start=1726050492
This output usually comes from `docker-build-push.steps.output.telemetry`.
If there is no timing data, both return values will be nil. If all timing data is valid, returns a timings object and nil error.
func (*PipelineTimings) StartTracing ¶
Imports tracing data from the build pipeline and starts a new top-level trace.
The tracing data is generated by the GitHub action `docker-build-push`.
Callers MUST call `span.End()` in order to send traces to the collector.
func (*PipelineTimings) Validate ¶
func (pt *PipelineTimings) Validate() error