Documentation ¶
Index ¶
- Variables
- func AddAttributesToCurrentSpanFromContext(ctx context.Context, attrs map[string]string)
- func AddCliBuildTargetPlatforms(platforms string)
- func AddDeployNodePlatforms(platforms string)
- func AddDevIteration(intent string)
- func AddDevIterationErr(i int, errorCode proto.StatusCode)
- func AddFlag(flag *flag.Flag)
- func AddResolvedBuildTargetPlatforms(platforms string)
- func AddResourceFilter(source string, typ string)
- func ExportMetrics(exitCode int) error
- func Init(configs []*latest.SkaffoldConfig, user, deployCtx string, ...)
- func InitMeterFromConfig(configs []*latest.SkaffoldConfig, user, deployCtx string)
- func InitTraceFromEnvVar(opts ...TraceExporterOption) (trace.TracerProvider, func(context.Context) error, error)
- func PII(s string) string
- func SetCommand(cmd string)
- func SetErrorCode(errorCode proto.StatusCode)
- func SetOnlineStatus()
- func ShutdownAndFlush(ctx context.Context, exitCode int)
- func StartTrace(ctx context.Context, name string, attributes ...map[string]string) (context.Context, func(options ...trace.SpanOption))
- func TraceEndError(err error) trace.SpanOption
- func TracerShutdown(ctx context.Context) error
- type HookPhase
- type TraceExporterConfig
- type TraceExporterOption
Constants ¶
This section is empty.
Variables ¶
var ( MeteredCommands = stringset.New() ShouldExportMetrics bool )
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
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 ¶ added in v1.37.0
func AddCliBuildTargetPlatforms(platforms string)
func AddDeployNodePlatforms ¶ added in v1.37.0
func AddDeployNodePlatforms(platforms string)
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 AddResolvedBuildTargetPlatforms ¶ added in v1.37.0
func AddResolvedBuildTargetPlatforms(platforms string)
func AddResourceFilter ¶ added in v1.37.0
func ExportMetrics ¶ added in v1.18.0
func Init ¶ added in v1.26.0
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 ¶ added in v1.18.0
func InitMeterFromConfig(configs []*latest.SkaffoldConfig, user, deployCtx 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
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 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
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 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