oc

package
v0.0.4-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
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 interface{}) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL