instrumentation

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MeteredCommands = util.NewStringSet()

	ShouldExportMetrics bool
)
View Source
var HookPhases = struct {
	PreBuild   HookPhase
	PostBuild  HookPhase
	PreSync    HookPhase
	PostSync   HookPhase
	PreDeploy  HookPhase
	PostDeploy HookPhase
}{
	PreBuild:   "pre-build",
	PostBuild:  "post-build",
	PreSync:    "pre-sync",
	PostSync:   "post-sync",
	PreDeploy:  "pre-deploy",
	PostDeploy: "post-deploy",
}

Functions

func AddAttributesToCurrentSpanFromContext added in v1.26.0

func AddAttributesToCurrentSpanFromContext(ctx context.Context, attrs map[string]string)

AddAttributesToCurrentSpanFromContext adds the attributes from the input map to the span pulled from the current context. This is useful when additional attributes should be added to a parent span but the span object is not directly accessible.

func AddDevIteration added in v1.18.0

func AddDevIteration(intent string)

func AddDevIterationErr added in v1.18.0

func AddDevIterationErr(i int, errorCode proto.StatusCode)

func AddFlag added in v1.18.0

func AddFlag(flag *flag.Flag)

func ExportMetrics added in v1.18.0

func ExportMetrics(exitCode int) error

func Init added in v1.26.0

func Init(configs []*latestV1.SkaffoldConfig, user string, opts ...TraceExporterOption)

Init initializes the skaffold metrics and trace tooling built on top of open-telemetry (otel)

func InitMeterFromConfig added in v1.18.0

func InitMeterFromConfig(configs []*latestV1.SkaffoldConfig, user string)

func InitTraceFromEnvVar added in v1.26.0

func InitTraceFromEnvVar(opts ...TraceExporterOption) (trace.TracerProvider, func(context.Context) error, error)

InitTraceFromEnvVar initializes the singleton skaffold tracer from the SKAFFOLD_TRACE env variable. The code here is a wrapper around the opentelemetry(otel) trace libs for usability When SKAFFOLD_TRACE is set, this will setup the proper tracer provider (& exporter), configures otel to use this tracer provider and saves the tracer provider shutdown function to be used globally so that it can be run before skaffold exits.

func PII added in v1.26.0

func PII(s string) string

PII stub function tracking trace attributes that have PII in them. Currently no trace information is uploaded so PII values are not an issue but if in the future they are uploaded this will need to properly strip PII

func SetCommand added in v1.18.0

func SetCommand(cmd string)

func SetErrorCode added in v1.18.0

func SetErrorCode(errorCode proto.StatusCode)

func SetOnlineStatus added in v1.18.0

func SetOnlineStatus()

SetOnlineStatus issues a GET request to see if the user is online. http://clients3.google.com/generate_204 is a well-known URL that returns an empty page and HTTP status 204 More info can be found here: https://www.chromium.org/chromium-os/chromiumos-design-docs/network-portal-detection

func ShutdownAndFlush added in v1.26.0

func ShutdownAndFlush(ctx context.Context, exitCode int)

func StartTrace added in v1.26.0

func StartTrace(ctx context.Context, name string, attributes ...map[string]string) (context.Context, func(options ...trace.SpanOption))

StartTrace uses the otel trace provider to export timing spans (with optional attributes) to the chosen exporter via the value set in SKAFFOLD_TRACE. Tracing is done via metadata stored in a context.Context. This means that to properly get parent/child traces, callers should use the returned context for subsequent calls in skaffold. The returned function should be called to end the trace span, for example this can be done with the form: _, endTrace = StartTrace...; defer endTrace()

func TraceEndError added in v1.26.0

func TraceEndError(err error) trace.SpanOption

TraceEndError adds an "error" attribute with value err.Error() to a span during it's end/shutdown callback This fnx is intended to used with the StartTrace callback - "endTrace" when an error occurs during the code path of trace, ex: endTrace(instrumentation.TraceEndError(err)); return nil, err

func TracerShutdown added in v1.26.0

func TracerShutdown(ctx context.Context) error

TracerShutdown is a function used to flush all current running spans and make sure they are exported. This should be called once at the end of a skaffold run to properly shutdown and export all spans for the singleton.

Types

type HookPhase added in v1.31.0

type HookPhase string

type TraceExporterConfig added in v1.26.0

type TraceExporterConfig struct {
	// contains filtered or unexported fields
}

type TraceExporterOption added in v1.26.0

type TraceExporterOption func(te *TraceExporterConfig)

func WithWriter added in v1.26.0

func WithWriter(w io.Writer) TraceExporterOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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