antagonism

package
v0.0.0-...-5489e0b Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package antagonism provides types and functions for analyzing antagonisms (durations of time in which *victim* work was runnable but didn't run, while *antagonism* work ran instead) within traces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyze

func Analyze[T any, CP, SP, DP fmt.Stringer](
	t trace.Wrapper[T, CP, SP, DP],
	logger antagonismLogger[T, CP, SP, DP],
	groups []*Group[T, CP, SP, DP],
) error

Analyze the provided trace for antagonisms in each provided antagonism group, logging the results to the provided logger.

Types

type ElementarySpanner

type ElementarySpanner[T any, CP, SP, DP fmt.Stringer] interface {
	ElementarySpan() trace.ElementarySpan[T, CP, SP, DP]
	// contains filtered or unexported methods
}

ElementarySpanner wraps a Trace elementary span for antagonism logging.

type Group

type Group[T any, CP, SP, DP fmt.Stringer] struct {
	// contains filtered or unexported fields
}

Group specifies a single 'antagonism group'.

func NewGroup

func NewGroup[T any, CP, SP, DP fmt.Stringer](
	name string,
) *Group[T, CP, SP, DP]

NewGroup returns a new antagonism Group with the specified name and span finder.

func (*Group[T, CP, SP, DP]) Name

func (g *Group[T, CP, SP, DP]) Name() string

Name returns the receiver's group name.

func (*Group[T, CP, SP, DP]) WithAntagonistElementarySpansFn

func (g *Group[T, CP, SP, DP]) WithAntagonistElementarySpansFn(
	fn func(trace.Wrapper[T, CP, SP, DP]) ([]trace.ElementarySpan[T, CP, SP, DP], error),
) *Group[T, CP, SP, DP]

WithAntagonistElementarySpansFn specifies that the receiver's set of antagonists should be generated, as a list of ElementarySpans, by the provided function. If the receiver has already specified an antagonist SpanFinder or elementary span function, the previous value is overwritten.

func (*Group[T, CP, SP, DP]) WithAntagonistFinder

func (g *Group[T, CP, SP, DP]) WithAntagonistFinder(
	antagonistFinder *trace.SpanFinder[T, CP, SP, DP],
) *Group[T, CP, SP, DP]

WithAntagonistFinder specifies that the receiver's set of antagonists should match the provided SpanFinder, returning the receiver to facilitate streaming. If the receiver has already specified an antagonist SpanFinder or elementary span function, the previous value is overwritten.

func (*Group[T, CP, SP, DP]) WithVictimElementarySpansFn

func (g *Group[T, CP, SP, DP]) WithVictimElementarySpansFn(
	fn func(trace.Wrapper[T, CP, SP, DP]) ([]trace.ElementarySpan[T, CP, SP, DP], error),
) *Group[T, CP, SP, DP]

WithVictimElementarySpansFn specifies that the receiver's set of victims should be generated, as a list of ElementarySpans, by the provided function. If the receiver has already specified a victim SpanFinder or elementary span function, the previous value is overwritten.

func (*Group[T, CP, SP, DP]) WithVictimFinder

func (g *Group[T, CP, SP, DP]) WithVictimFinder(
	victimFinder *trace.SpanFinder[T, CP, SP, DP],
) *Group[T, CP, SP, DP]

WithVictimFinder specifies that the receiver's set of victims should match the provided SpanFinder, returning the receiver to facilitate streaming. If the receiver has already specified a victim SpanFinder or elementary span function, the previous value is overwritten.

Jump to

Keyboard shortcuts

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