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 CISystem() 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 NewFloat64ValueRecorder(m metric.Meter, name string, mos ...metric.Float64CounterOption) float64ValueRecorder
- func NewInt64ValueRecorder(m metric.Meter, name string, mos ...metric.Int64CounterOption) int64ValueRecorder
- 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.SpanEndOption))
- func TraceEndError(err error) trace.SpanEndOption
- 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 ¶
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 AddResolvedBuildTargetPlatforms ¶
func AddResolvedBuildTargetPlatforms(platforms string)
func AddResourceFilter ¶
func CISystem ¶ added in v2.4.0
func CISystem() string
CISystem deduce ciSystem from environment variables
func ExportMetrics ¶
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 ¶
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 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 ¶
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 ¶
type TraceExporterConfig struct {
// contains filtered or unexported fields
}
type TraceExporterOption ¶
type TraceExporterOption func(te *TraceExporterConfig)
func WithWriter ¶
func WithWriter(w io.Writer) TraceExporterOption