Documentation ¶
Index ¶
- Constants
- func ErrStatus(err error) attribute.KeyValue
- func Partition(id types.PartitionID) attribute.KeyValue
- func PeerID(key attribute.Key, id peer.ID) attribute.KeyValue
- func Round(round uint64) attribute.KeyValue
- func Shard(partition types.PartitionID, shard types.ShardID, extra ...attribute.KeyValue) metric.MeasurementOption
- func TxHash(value []byte) attribute.KeyValue
- func UnitID(id []byte) attribute.KeyValue
- type Factory
- type MeterAndTracer
- type MeterTracerLogger
- func (mtl MeterTracerLogger) Logger() *slog.Logger
- func (mtl MeterTracerLogger) Meter(name string, opts ...metric.MeterOption) metric.Meter
- func (mtl MeterTracerLogger) PrometheusRegisterer() prometheus.Registerer
- func (mtl MeterTracerLogger) RoundLogger(curRound func() uint64) *slog.Logger
- func (mtl MeterTracerLogger) Shutdown() error
- func (mtl MeterTracerLogger) Tracer(name string, options ...trace.TracerOption) trace.Tracer
- func (mtl MeterTracerLogger) TracerProvider() trace.TracerProvider
Constants ¶
View Source
const NodeIDKey attribute.Key = "service.node.name" // ECS convention
View Source
const TxHashKey attribute.Key = "tx.hash"
View Source
const TxTypeKey attribute.Key = "tx.type"
View Source
const UnitIDKey attribute.Key = "unit_id"
Variables ¶
This section is empty.
Functions ¶
func ErrStatus ¶
ErrStatus returns attribute named "status" with value "ok" if the param err is nil and "err" when it is not.
func Shard ¶
func Shard(partition types.PartitionID, shard types.ShardID, extra ...attribute.KeyValue) metric.MeasurementOption
Types ¶
type Factory ¶
type Factory struct{}
func NewFactory ¶
func NewFactory() Factory
func (Factory) Observability ¶
func (Factory) Observability(metrics, traces string) (MeterAndTracer, error)
type MeterAndTracer ¶
type MeterAndTracer interface { Tracer(name string, options ...trace.TracerOption) trace.Tracer TracerProvider() trace.TracerProvider Meter(name string, opts ...metric.MeterOption) metric.Meter PrometheusRegisterer() prometheus.Registerer Shutdown() error }
MeterAndTracer combines Metrics and Tracing related methods
type MeterTracerLogger ¶
type MeterTracerLogger struct {
// contains filtered or unexported fields
}
func WithLogger ¶
func WithLogger(obs MeterAndTracer, log *slog.Logger) MeterTracerLogger
WithLogger combines "metrics and tracing provider" and logger into single "observability provider". It is mostly meant to be used to "replace logger" in the situations where sublogger is created (ie logger.With) for a scope and needs to be passed as single observability parameter.
func (MeterTracerLogger) Logger ¶
func (mtl MeterTracerLogger) Logger() *slog.Logger
func (MeterTracerLogger) Meter ¶
func (mtl MeterTracerLogger) Meter(name string, opts ...metric.MeterOption) metric.Meter
func (MeterTracerLogger) PrometheusRegisterer ¶
func (mtl MeterTracerLogger) PrometheusRegisterer() prometheus.Registerer
func (MeterTracerLogger) RoundLogger ¶
func (mtl MeterTracerLogger) RoundLogger(curRound func() uint64) *slog.Logger
RoundLogger returns logger which adds Round attribute to each log record, the curRound callback is used to get the current round value.
func (MeterTracerLogger) Shutdown ¶
func (mtl MeterTracerLogger) Shutdown() error
func (MeterTracerLogger) Tracer ¶
func (mtl MeterTracerLogger) Tracer(name string, options ...trace.TracerOption) trace.Tracer
func (MeterTracerLogger) TracerProvider ¶
func (mtl MeterTracerLogger) TracerProvider() trace.TracerProvider
Click to show internal directories.
Click to hide internal directories.