instrumentation

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MeteredCommands = stringset.New()

	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

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 AddCliBuildTargetPlatforms

func AddCliBuildTargetPlatforms(platforms string)

func AddDeployNodePlatforms

func AddDeployNodePlatforms(platforms string)

func AddDevIteration

func AddDevIteration(intent string)

func AddDevIterationErr

func AddDevIterationErr(i int, errorCode proto.StatusCode)

func AddFlag

func AddFlag(flag *flag.Flag)

func AddResolvedBuildTargetPlatforms

func AddResolvedBuildTargetPlatforms(platforms string)

func AddResourceFilter

func AddResourceFilter(source string, typ string)

func CISystem added in v2.4.0

func CISystem() string

CISystem deduce ciSystem from environment variables

func ExportMetrics

func ExportMetrics(exitCode int) error

func Init

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

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

func InitMeterFromConfig

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

func InitTraceFromEnvVar

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 NewFloat64ValueRecorder

func NewFloat64ValueRecorder(m metric.Meter, name string, mos ...metric.Float64CounterOption) float64ValueRecorder

func NewInt64ValueRecorder

func NewInt64ValueRecorder(m metric.Meter, name string, mos ...metric.Int64CounterOption) int64ValueRecorder

func PII

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

func SetCommand(cmd string)

func SetErrorCode

func SetErrorCode(errorCode proto.StatusCode)

func SetOnlineStatus

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

func ShutdownAndFlush(ctx context.Context, exitCode int)

func StartTrace

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

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

func TraceEndError(err error) trace.SpanEndOption

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

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

type HookPhase string

type TraceExporterConfig

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

type TraceExporterOption

type TraceExporterOption func(te *TraceExporterConfig)

func WithWriter

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