Documentation
¶
Index ¶
- func Emit(ctx context.Context, event Event)
- func Register(name string, factory FactoryFunc)
- func RegisterNull()
- func SetDefaultEmitter(m EventEmitter)
- func WithBytesMeter(ctx context.Context) context.Context
- func WithCounter(ctx context.Context, name string) context.Context
- func WithExistingBytesMeter(ctx context.Context, bm Meter) context.Context
- type Event
- type EventEmitter
- type FactoryFunc
- type Meter
- type MeterLogData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, factory FactoryFunc)
func RegisterNull ¶
func RegisterNull()
func SetDefaultEmitter ¶
func SetDefaultEmitter(m EventEmitter)
Types ¶
type Event ¶
type Event struct {
Endpoint string `json:"endpoint"`
Network string `json:"network"` // can be omitted if the emitter is set up with a global network config
Metrics map[string]float64 `json:"metrics,omitempty"`
OutputModuleHash string `json:"output_module_hash,omitempty"` //substreams-only field
// OrganizationID identify the organization that emitted the event.
//
// This was previously named UserID but has been renamed to OrganizationID to
// better reflect the real underlying data in this field.
//
// As a measure of ensuring backward compatibility, we kept the JSON version as
// 'user_id' for now, we should search better how this is used to change it safely.
OrganizationID string `json:"user_id"`
ApiKeyID string `json:"api_key_id"`
IpAddress string `json:"ip_address"`
Meta string `json:"meta"`
Timestamp time.Time `json:"timestamp"`
}
func (Event) MarshalLogObject ¶
func (ev Event) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (Event) ToProto ¶
func (ev Event) ToProto() *pbmetering.Event
type EventEmitter ¶
func GetDefaultEmitter ¶
func GetDefaultEmitter() EventEmitter
type FactoryFunc ¶
type FactoryFunc func(config string, logger *zap.Logger) (EventEmitter, error)
type Meter ¶
type Meter interface {
AddBytesWritten(n int)
AddBytesRead(n int)
AddBytesWrittenCtx(ctx context.Context, n int)
AddBytesReadCtx(ctx context.Context, n int)
BytesWritten() uint64
BytesRead() uint64
BytesWrittenDelta() uint64
BytesReadDelta() uint64
AddCounter(name string)
CountInc(name string, n int)
CountDec(name string, n int)
GetCount(name string) int
GetCountAndReset(name string) int
ResetCount(name string)
}
var NoopBytesMeter Meter = &noopMeter{}
func GetBytesMeter ¶
func NewBytesMeter ¶
func NewBytesMeter() Meter
type MeterLogData ¶
func (*MeterLogData) MarshalLogObject ¶
func (mld *MeterLogData) MarshalLogObject(enc zapcore.ObjectEncoder) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.