gocloud.devgocloud.dev/internal/oc Index | Files

package oc

import "gocloud.dev/internal/oc"

Package oc supports OpenCensus tracing and metrics for the Go Cloud Development Kit.

Index

Variables

var (
	MethodKey   = tag.MustNewKey("gocdk_method")
	StatusKey   = tag.MustNewKey("gocdk_status")
	ProviderKey = tag.MustNewKey("gocdk_provider")
)

Tag keys used for the standard Go CDK views.

Functions

func LatencyMeasure

func LatencyMeasure(pkg string) *stats.Float64Measure

LatencyMeasure returns the measure for method call latency used by Go CDK APIs.

func ProviderName

func ProviderName(driver any) string

ProviderName returns the name of the provider associated with the driver value. It is intended to be used to set Tracer.Provider. It actually returns the package path of the driver's type.

func Views

func Views(pkg string, latencyMeasure *stats.Float64Measure) []*view.View

Views returns the views supported by Go CDK APIs.

Types

type Tracer

type Tracer struct {
	Package        string
	Provider       string
	LatencyMeasure *stats.Float64Measure
}

A Tracer supports OpenCensus tracing and latency metrics.

func (*Tracer) End

func (t *Tracer) End(ctx context.Context, err error)

End ends a span with the given error, and records a latency measurement.

func (*Tracer) Start

func (t *Tracer) Start(ctx context.Context, methodName string) context.Context

Start adds a span to the trace, and prepares for recording a latency measurement.

Source Files

metrics.go trace.go

Version
v0.41.0 (latest)
Published
Mar 30, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
55 seconds ago

Tools for package owners.