Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hook_defaults_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func (f HookInsertBeginFunc) IsPlugin() bool { return true }

// HookMetricEmitFunc is a convenience helper for implementing
// rivertype.HookMetricEmit using a simple function instead of a struct.
//
// Notably, this function is invoked each time River emits a metric. Metrics are
// emitted in very hot paths like job fetching, and should therefore not block
// on network I/O or anything else, and should usually pass metrics through to
// an asynchronous instrumentation package like OpenTelemetry.
type HookMetricEmitFunc func(ctx context.Context, params *rivertype.HookMetricEmitParams)

func (f HookMetricEmitFunc) IsHook() bool { return true }
Expand Down
4 changes: 2 additions & 2 deletions rivertype/river_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ type HookInsertBegin interface {
type HookMetricEmit interface {
Hook

// MetricEmit is invoked each time River emits a metric. This is invoked in
// very hot paths like job fetching, and should therefore not block on
// MetricEmit is invoked each time River emits a metric. Metrics are emitted
// in very hot paths like job fetching, and should therefore not block on
// network I/O or anything else, and should usually pass metrics through to
// an asynchronous instrumentation package like OpenTelemetry.
MetricEmit(ctx context.Context, params *HookMetricEmitParams)
Expand Down
Loading