circuitotel

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

README

circuitotel

An open telemetry implementation of circuit library metric collector

Usage

For many users, the defaults will work just fine. You can also pass a custom metric provider to your factory.

	// For many, the default factory is sufficient
	var f circuitotel.Factory
	manager := circuit.Manager{
		// Pass the factory constructor to your manager
		DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
			f.CommandPropertiesConstructor,
		},
	}
	_ = manager.MustCreateCircuit("test-circuit")

Traces

We do not start traces since it's expected the downstream itself will trace. Instead, we pass circuit events to the passed in span.

Metrics

We gather all circuit exposed metrics as histograms or counters

Documentation

Index

Examples

Constants

View Source
const ScopeName = "github.com/cep21/circuitotel"

Variables

This section is empty.

Functions

func Version

func Version() string

Types

type Factory

type Factory struct {
	MeterProvider metric.MeterProvider
	// contains filtered or unexported fields
}
Example
// Make a factory.  With defaults, it uses the
// global meter provider.
factory := circuitotel.Factory{
	// You can pass your own provider if you wish
	// MeterProvider: nil
}
manager := circuit.Manager{
	// Pass the factory constructor to your manager
	DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
		factory.CommandPropertiesConstructor,
	},
}
// Now make and use circuits like normal
c := manager.MustCreateCircuit("test-circuit")
_ = c.Execute(context.Background(), func(_ context.Context) error {
	return nil
}, nil)
Output:

Example (Simple)
// For many, the default factory is sufficient
var f circuitotel.Factory
manager := circuit.Manager{
	// Pass the factory constructor to your manager
	DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
		f.CommandPropertiesConstructor,
	},
}
_ = manager.MustCreateCircuit("test-circuit")
Output:

func (*Factory) CommandPropertiesConstructor

func (f *Factory) CommandPropertiesConstructor(name string) circuit.Config

Jump to

Keyboard shortcuts

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