oteleventually

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package oteleventually provides extension components for eventually library to enable OpenTelemetry instrumentation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorAttribute is used with a metric when an error is recorded.
	ErrorAttribute = attribute.Key("error")

	// StreamTargetAttribute is the attribute identifier that contains the
	// stream target value used for EventStore.Stream calls.
	StreamTargetAttribute = attribute.Key("stream.target")

	// StreamNameAttribute is the attribute identifier that contains the Stream name,
	// or Stream instance id, when using an eventstore.Instanced.
	StreamNameAttribute = attribute.Key("stream.name")

	// StreamTypeAttribute is the attribute identifier that contains the Stream type,
	// when using an eventstore.Typed.
	StreamTypeAttribute = attribute.Key("stream.type")

	// EventTypeAttribute is the attribute identifier that contains the type of an Event.
	EventTypeAttribute = attribute.Key("event.type")

	// EventVersionAttribute is the attribute identifier that contains the version of an Event.
	EventVersionAttribute = attribute.Key("event.version")

	// SelectFromAttribute is the attribute identifier that contains the version or
	// sequence number lower bound used for Stream calls.
	SelectFromAttribute = attribute.Key("select.from")

	// VersionCheckAttribute is the attribute identifier that contains the expected
	// version provided when using Append to add new events to the Event Store.
	VersionCheckAttribute = attribute.Key("version.check")

	// VersionNewAttribute is the attribute identifier that contains the new version
	// returned by the Event Store on Append calls.
	VersionNewAttribute = attribute.Key("version.new")

	// ProjectionNameAttribute is the attribute identifier that contains the name
	// of a specific Projection.
	ProjectionNameAttribute = attribute.Key("projection.name")

	// SubscriptionNameAttribute is the attribute identifier that contains
	// the name of a subscription.
	SubscriptionNameAttribute = attribute.Key("subscrption.name")
)

Functions

This section is empty.

Types

type InstrumentedEventStore

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

InstrumentedEventStore is a wrapper to provide OpenTelemetry instrumentation for EventStore compatible implementations, and compatible with the same interface to be used seamlessly in your pre-existing code.

Use InstrumentEventStore to create new instance of this type.

func InstrumentEventStore

func InstrumentEventStore(es eventstore.Store, opts ...Option) (*InstrumentedEventStore, error)

InstrumentEventStore creates a new InstrumentedEventStore instance.

func (*InstrumentedEventStore) Append

func (es *InstrumentedEventStore) Append(
	ctx context.Context,
	id stream.ID,
	expected eventstore.VersionCheck,
	events ...eventually.Event,
) (newVersion int64, err error)

Append delegates the call to the underlying Event Store and records a trace of the result and increments the metric referenced by AppendMetric.

func (*InstrumentedEventStore) Stream

func (es *InstrumentedEventStore) Stream(
	ctx context.Context,
	eventStream eventstore.EventStream,
	target stream.Target,
	selectt eventstore.Select,
) (err error)

Stream delegates the call to the underlying Event Store and records a trace of the result.

type InstrumentedProjection

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

InstrumentedProjection wraps a projection.Applier instance to provide telemetry support using OpenTelemetry.

Use InstrumentProjection function to create a new instance.

func InstrumentProjection

func InstrumentProjection(applier projection.Applier, opts ...Option) (*InstrumentedProjection, error)

InstrumentProjection wraps a Projection Applier to provide support for exporting telemetry data using OpenTelemetry.

The name provided will be used for both traces and metrics exported.

func (*InstrumentedProjection) Apply

func (ip *InstrumentedProjection) Apply(ctx context.Context, event eventstore.Event) (err error)

Apply processes the provided Event using the underlying projection.Applier implementation, and reports telemetry data on its execution.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option specifies instrumentation configuration options.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies the metric.MeterProvider instance to use for the instrumentation. By default, the global metric.MeterProvider is used.

func WithProjectionName

func WithProjectionName(name string) Option

WithProjectionName specifies the name displayed in spans and metrics reported by the instrumentation.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies the trace.TracerProvider instance to use for the instrumentation. By default, the global trace.TracerProvider is used.

Jump to

Keyboard shortcuts

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