tracking

package
v0.0.0-...-c693443 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppEventData

type AppEventData struct {
	EnterpriseID string `json:"enterprise_id,omitempty"`
	TeamID       string `json:"team_id,omitempty"`
	UserID       string `json:"user_id,omitempty"`
	// Template holds information for the sample app template used as part of the `create` command
	Template string `json:"template,omitempty"`
}

AppEventData holds information about the Slack App being interacted with via the CLI

type AuthEventData

type AuthEventData struct {
	EnterpriseID string `json:"enterprise_id,omitempty"`
	TeamID       string `json:"team_id,omitempty"`
	UserID       string `json:"user_id,omitempty"`
}

AuthEventData holds information about the user who is using the CLI's authentication

type EventContext

type EventContext struct {
	AIAgent          string   `json:"ai_agent,omitempty"`
	Arch             string   `json:"arch"`
	Binary           string   `json:"bin"`
	CLIVersion       string   `json:"cli_version"`
	Command          string   `json:"command,omitempty"`
	CommandCanonical string   `json:"command_canonical,omitempty"`
	Flags            []string `json:"flags,omitempty"`
	Host             string   `json:"host"`
	OS               string   `json:"os"`
	ProjectID        string   `json:"project_id,omitempty"`
	Runtime          string   `json:"runtime,omitempty"`
	RuntimeVersion   string   `json:"runtime_version,omitempty"`
	SessionID        string   `json:"session_id"`
	SystemID         string   `json:"system_id"`
}

EventContext contains information / metadata about the CLI session

type EventData

type EventData struct {
	// App holds information about the application being operated on by the CLI
	App AppEventData `json:"app,omitempty"`
	// Auth holds information about the user's authentication
	Auth AuthEventData `json:"auth,omitempty"`
	// ErrorCode holds information about a specific error raised during the CLI session
	ErrorCode string `json:"error_code,omitempty"`
	// ErrorMessage holds information about any errors raised during the CLI session
	ErrorMessage string `json:"error_msg,omitempty"`
}

EventData contains logging/metrics data related to this CLI process invocation. DO NOT use this for business logic! Try to avoid changing fields in this struct, as this makes long-term data analyses difficult! If you add a field here, make sure it has `omitempty` and if it needs PII redaction or similar cleaning operations, implement that in tracking.go's CleanSessionData method

type EventTracker

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

func NewEventTracker

func NewEventTracker() *EventTracker

NewEventTracker returns an EventTracker instance, for tracking event-related data and metrics

func (*EventTracker) FlushToLogstash

func (e *EventTracker) FlushToLogstash(ctx context.Context, cfg *config.Config, ioStream iostreams.IOStreamer, exitCode iostreams.ExitCode) error

FlushToLogstash will send an event representing this session to logstash

func (*EventTracker) SetAppEnterpriseID

func (e *EventTracker) SetAppEnterpriseID(id string)

SetAppEnterpriseID sets the app enterprise ID associated to this CLI execution for metrics

func (*EventTracker) SetAppTeamID

func (e *EventTracker) SetAppTeamID(id string)

SetAppTeamID sets the app team ID associated to this CLI execution for metrics

func (*EventTracker) SetAppTemplate

func (e *EventTracker) SetAppTemplate(template string)

SetAppTemplate sets the app template used in this CLI execution for metrics

func (*EventTracker) SetAppUserID

func (e *EventTracker) SetAppUserID(id string)

SetAppUserID sets the app user ID associated to this CLI execution for metrics

func (*EventTracker) SetAuthEnterpriseID

func (e *EventTracker) SetAuthEnterpriseID(id string)

SetAuthEnterpriseID sets the auth enterprise ID associated to this CLI execution for metrics

func (*EventTracker) SetAuthTeamID

func (e *EventTracker) SetAuthTeamID(id string)

SetAuthTeamID sets the auth team ID associated to this CLI execution for metrics

func (*EventTracker) SetAuthUserID

func (e *EventTracker) SetAuthUserID(id string)

SetAuthTeamID sets the auth team ID associated to this CLI execution for metrics

func (*EventTracker) SetErrorCode

func (e *EventTracker) SetErrorCode(code string)

SetErrorCode sets the error code associated to this CLI execution for metrics

func (*EventTracker) SetErrorMessage

func (e *EventTracker) SetErrorMessage(err string)

SetErrorMessage sets the error message associated to this CLI execution for metrics

type EventTrackerMock

type EventTrackerMock struct {
	mock.Mock
}

func (*EventTrackerMock) AddDefaultMocks

func (m *EventTrackerMock) AddDefaultMocks()

func (*EventTrackerMock) FlushToLogstash

func (m *EventTrackerMock) FlushToLogstash(ctx context.Context, cfg *config.Config, io iostreams.IOStreamer, exitCode iostreams.ExitCode) error

func (*EventTrackerMock) SetAppEnterpriseID

func (m *EventTrackerMock) SetAppEnterpriseID(id string)

func (*EventTrackerMock) SetAppTeamID

func (m *EventTrackerMock) SetAppTeamID(id string)

func (*EventTrackerMock) SetAppTemplate

func (m *EventTrackerMock) SetAppTemplate(template string)

func (*EventTrackerMock) SetAppUserID

func (m *EventTrackerMock) SetAppUserID(id string)

func (*EventTrackerMock) SetAuthEnterpriseID

func (m *EventTrackerMock) SetAuthEnterpriseID(id string)

func (*EventTrackerMock) SetAuthTeamID

func (m *EventTrackerMock) SetAuthTeamID(id string)

func (*EventTrackerMock) SetAuthUserID

func (m *EventTrackerMock) SetAuthUserID(id string)

func (*EventTrackerMock) SetErrorCode

func (m *EventTrackerMock) SetErrorCode(code string)

func (*EventTrackerMock) SetErrorMessage

func (m *EventTrackerMock) SetErrorMessage(err string)

type EventType

type EventType string
const (
	// Error event is raised when an error occurs and the slack CLI will exit with a non-zero exit code.
	Error EventType = "error"
	// Interrupt event occurs when a terminal signal interrupts the CLI process.
	Interrupt EventType = "interrupt"
	// Success event occurs when the CLI intends to exit with a zero exit code.
	Success EventType = "success"
)

type LogstashEvent

type LogstashEvent struct {
	Context   EventContext `json:"context"`
	Data      EventData    `json:"data,omitempty"`
	Event     EventType    `json:"event"`
	Timestamp int64        `json:"timestamp"`
}

type TrackingManager

type TrackingManager interface {
	FlushToLogstash(ctx context.Context, cfg *config.Config, io iostreams.IOStreamer, exitCode iostreams.ExitCode) error

	// Setter methods for metric fields
	SetErrorCode(code string)
	SetErrorMessage(err string)
	SetAuthEnterpriseID(id string)
	SetAuthTeamID(id string)
	SetAuthUserID(id string)
	SetAppEnterpriseID(id string)
	SetAppTeamID(id string)
	SetAppUserID(id string)
	SetAppTemplate(template string)
	// contains filtered or unexported methods
}

TrackingManager is an interface for tracking metrics and events related to CLI activity

Jump to

Keyboard shortcuts

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