instrument

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Consumer

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

func NewConsumer

func NewConsumer(ctx context.Context,
	config *types.Config,
	gitReaderFactory *events.ReaderFactory[*gitevents.Reader],
	repoStore store.RepoStore,
	principalInfoCache store.PrincipalInfoCache,
	instrumentation Service,
) (Consumer, error)

func ProvideGitConsumer

func ProvideGitConsumer(
	ctx context.Context,
	config *types.Config,
	gitReaderFactory *events.ReaderFactory[*gitevents.Reader],
	repoStore store.RepoStore,
	principalInfoCache store.PrincipalInfoCache,
	instrumentation Service,
) (Consumer, error)

type CreationType

type CreationType string
const (
	CreationTypeCreate CreationType = "CREATE"
	CreationTypeImport CreationType = "IMPORT"
)

type Event

type Event struct {
	Type       EventType            `json:"event"`
	Category   string               `json:"category"`
	Principal  *types.PrincipalInfo `json:"user_id,omitempty"`
	GroupID    string               `json:"group_id,omitempty"`
	Timestamp  time.Time            `json:"timestamp,omitempty"`
	Path       string               `json:"path"`
	RemoteAddr string               `json:"remote_addr"`
	Properties map[Property]any     `json:"properties,omitempty"`
}

type EventType

type EventType string
const (
	EventTypeRepositoryCreate    EventType = "Repository create"
	EventTypeRepositoryCount     EventType = "Repository count"
	EventTypeCommitCount         EventType = "Commit count"
	EventTypeCreateCommit        EventType = "Create commit"
	EventTypeCreateBranch        EventType = "Create branch"
	EventTypeCreateTag           EventType = "Create tag"
	EventTypeCreatePullRequest   EventType = "Create pull request"
	EventTypeMergePullRequest    EventType = "Merge pull request"
	EventTypeReviewPullRequest   EventType = "Review pull request"
	EventTypeCreatePRComment     EventType = "Create PR comment"
	EventTypeCreateBranchRule    EventType = "Create branch rule"
	EventTypePRSuggestionApplied EventType = "Pull request suggestion applied"
)

func (EventType) String

func (e EventType) String() string

type Noop

type Noop struct {
}

func (Noop) Close

func (n Noop) Close(context.Context) error

func (Noop) Track

func (n Noop) Track(
	context.Context,
	Event,
) error

type Property

type Property string
const (
	PropertyRepositoryID              Property = "repository_id"
	PropertyRepositoryName            Property = "repository_name"
	PropertyRepositoryCreationType    Property = "creation_type"
	PropertyPullRequestID             Property = "pull_request_id"
	PropertyCommentIsReplied          Property = "comment_is_replied"
	PropertyCommentContainsSuggestion Property = "contains_suggestion"
	PropertyMergeStrategy             Property = "merge_strategy"
	PropertyRuleID                    Property = "rule_id"
	PropertyIsDefaultBranch           Property = "is_default_branch"
	PropertyDecision                  Property = "decision"
	PropertyRepositories              Property = "repositories"
)

type RepositoryCount

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

func NewRepositoryCount

func NewRepositoryCount(
	ctx context.Context,
	config *types.Config,
	svc Service,
	repoStore store.RepoStore,
	scheduler *job.Scheduler,
	executor *job.Executor,
) (*RepositoryCount, error)

func ProvideRepositoryCount

func ProvideRepositoryCount(
	ctx context.Context,
	config *types.Config,
	svc Service,
	repoStore store.RepoStore,
	scheduler *job.Scheduler,
	executor *job.Executor,
) (*RepositoryCount, error)

func (*RepositoryCount) Handle

type Service

type Service interface {
	Track(ctx context.Context, event Event) error
	Close(ctx context.Context) error
}

func ProvideService

func ProvideService() Service

Jump to

Keyboard shortcuts

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