Documentation ¶
Overview ¶
Package util is a generated protocol buffer package.
from https://github.com/mozilla-services/heka/blob/dev/message/message.proto
It is generated from these files:
util/pblog.proto
It has these top-level messages:
Header Field Message
Index ¶
- Constants
- Variables
- func GenUUID4() (string, error)
- func GetAWSPublicHostname() (hostname string, err error)
- func RawUUID4() ([]byte, error)
- func RemoteAddr(req *http.Request) string
- func ScanUUID(uuids string) ([]byte, error)
- type Field
- func (m *Field) GetName() string
- func (m *Field) GetRepresentation() string
- func (m *Field) GetValueBool() []bool
- func (m *Field) GetValueBytes() [][]byte
- func (m *Field) GetValueDouble() []float64
- func (m *Field) GetValueInteger() []int64
- func (m *Field) GetValueString() []string
- func (m *Field) GetValueType() Field_ValueType
- func (m *Field) Marshal() (data []byte, err error)
- func (m *Field) MarshalTo(data []byte) (n int, err error)
- func (*Field) ProtoMessage()
- func (m *Field) Reset()
- func (m *Field) Size() (n int)
- func (m *Field) String() string
- func (m *Field) Unmarshal(data []byte) error
- type Field_ValueType
- type Fields
- type Header
- func (m *Header) GetHmac() []byte
- func (m *Header) GetHmacHashFunction() Header_HmacHashFunction
- func (m *Header) GetHmacKeyVersion() uint32
- func (m *Header) GetHmacSigner() string
- func (m *Header) GetMessageLength() uint32
- func (m *Header) Marshal() (data []byte, err error)
- func (m *Header) MarshalTo(data []byte) (n int, err error)
- func (*Header) ProtoMessage()
- func (m *Header) Reset()
- func (m *Header) Size() (n int)
- func (m *Header) String() string
- func (m *Header) Unmarshal(data []byte) error
- type Header_HmacHashFunction
- type JsMap
- type Log
- func (r *Log) Alert(mtype, msg string, fields Fields) (err error)
- func (r *Log) Critical(mtype, msg string, fields Fields) (err error)
- func (r *Log) Debug(mtype, msg string, fields Fields) (err error)
- func (r *Log) Emergency(mtype, msg string, fields Fields) (err error)
- func (r *Log) Error(mtype, msg string, fields Fields) (err error)
- func (r *Log) Info(mtype, msg string, fields Fields) (err error)
- func (r *Log) Log(level int32, mtype, payload string, fields Fields) (err error)
- func (r *Log) Notice(mtype, msg string, fields Fields) (err error)
- func (r *Log) Warn(mtype, msg string, fields Fields) (err error)
- type Logger
- type Message
- func (m *Message) GetEnvVersion() string
- func (m *Message) GetFields() []*Field
- func (m *Message) GetHostname() string
- func (m *Message) GetLogger() string
- func (m *Message) GetPayload() string
- func (m *Message) GetPid() int32
- func (m *Message) GetSeverity() int32
- func (m *Message) GetTimestamp() int64
- func (m *Message) GetType() string
- func (m *Message) GetUuid() []byte
- func (m *Message) Marshal() (data []byte, err error)
- func (m *Message) MarshalTo(data []byte) (n int, err error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (m *Message) String() string
- func (m *Message) Unmarshal(data []byte) error
- type Metric
- func (self *Metric) Decrement(metric string)
- func (self *Metric) Increment(metric string)
- func (self *Metric) IncrementBy(metric string, count int)
- func (self *Metric) Prefix(newPrefix string)
- func (self *Metric) Snapshot() map[string]interface{}
- func (self *Metric) Timer(metric string, value int64)
- type Metrics
- type MzConfig
- type TestLog
- func (r *TestLog) Alert(mtype, msg string, fields Fields) error
- func (r *TestLog) Critical(mtype, msg string, fields Fields) error
- func (r *TestLog) Debug(mtype, msg string, fields Fields) error
- func (r *TestLog) Emergency(mtype, msg string, fields Fields) error
- func (r *TestLog) Error(mtype, msg string, fields Fields) error
- func (r *TestLog) Info(mtype, msg string, fields Fields) error
- func (r *TestLog) Log(level int32, mtype, payload string, fields Fields) error
- func (r *TestLog) Notice(mtype, msg string, fields Fields) error
- func (r *TestLog) Warn(mtype, msg string, fields Fields) error
- type TestMetric
Constants ¶
const ( EMERGENCY = iota // Everything is broken and on fire ALERT // We're broken. CRITICAL // Someone else is broken, but it's breaking us ERROR // Something bad happened. WARNING // Huh, that's not supposed to happen, but we can deal with it. NOTICE // That was odd, but not a big deal. INFO // The thing you wanted to happen happened. DEBUG // debugging. )
Message levels
const Default_Message_Severity int32 = 7
Variables ¶
var Field_ValueType_name = map[int32]string{
0: "STRING",
1: "BYTES",
2: "INTEGER",
3: "DOUBLE",
4: "BOOL",
}
var Field_ValueType_value = map[string]int32{
"STRING": 0,
"BYTES": 1,
"INTEGER": 2,
"DOUBLE": 3,
"BOOL": 4,
}
var Header_HmacHashFunction_name = map[int32]string{
0: "MD5",
1: "SHA1",
}
var Header_HmacHashFunction_value = map[string]int32{
"MD5": 0,
"SHA1": 1,
}
Functions ¶
func GetAWSPublicHostname ¶
Get the public AWS hostname for this machine. * TODO: Make this a generic utility for getting public info from * the aws meta server?
func RemoteAddr ¶
Types ¶
type Field ¶
type Field struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` ValueType *Field_ValueType `protobuf:"varint,2,opt,name=value_type,enum=util.Field_ValueType,def=0" json:"value_type,omitempty"` Representation *string `protobuf:"bytes,3,opt,name=representation" json:"representation,omitempty"` ValueString []string `protobuf:"bytes,4,rep,name=value_string" json:"value_string,omitempty"` ValueBytes [][]byte `protobuf:"bytes,5,rep,name=value_bytes" json:"value_bytes,omitempty"` ValueInteger []int64 `protobuf:"varint,6,rep,packed,name=value_integer" json:"value_integer,omitempty"` ValueDouble []float64 `protobuf:"fixed64,7,rep,packed,name=value_double" json:"value_double,omitempty"` ValueBool []bool `protobuf:"varint,8,rep,packed,name=value_bool" json:"value_bool,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*Field) GetRepresentation ¶
func (*Field) GetValueBool ¶
func (*Field) GetValueBytes ¶
func (*Field) GetValueDouble ¶
func (*Field) GetValueInteger ¶
func (*Field) GetValueString ¶
func (*Field) GetValueType ¶
func (m *Field) GetValueType() Field_ValueType
func (*Field) ProtoMessage ¶
func (*Field) ProtoMessage()
type Field_ValueType ¶
type Field_ValueType int32
const ( Field_STRING Field_ValueType = 0 Field_BYTES Field_ValueType = 1 Field_INTEGER Field_ValueType = 2 Field_DOUBLE Field_ValueType = 3 Field_BOOL Field_ValueType = 4 )
const Default_Field_ValueType Field_ValueType = Field_STRING
func (Field_ValueType) Enum ¶
func (x Field_ValueType) Enum() *Field_ValueType
func (Field_ValueType) String ¶
func (x Field_ValueType) String() string
func (*Field_ValueType) UnmarshalJSON ¶
func (x *Field_ValueType) UnmarshalJSON(data []byte) error
type Fields ¶
The fields to relay. NOTE: object reflection is VERY CPU expensive. I specify strings here to reduce that as much as possible. Please do not change this to something like map[string]interface{} since that can dramatically increase server load.
type Header ¶
type Header struct { MessageLength *uint32 `protobuf:"varint,1,req,name=message_length" json:"message_length,omitempty"` HmacHashFunction *Header_HmacHashFunction `protobuf:"varint,3,opt,name=hmac_hash_function,enum=util.Header_HmacHashFunction,def=0" json:"hmac_hash_function,omitempty"` HmacSigner *string `protobuf:"bytes,4,opt,name=hmac_signer" json:"hmac_signer,omitempty"` HmacKeyVersion *uint32 `protobuf:"varint,5,opt,name=hmac_key_version" json:"hmac_key_version,omitempty"` Hmac []byte `protobuf:"bytes,6,opt,name=hmac" json:"hmac,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*Header) GetHmacHashFunction ¶
func (m *Header) GetHmacHashFunction() Header_HmacHashFunction
func (*Header) GetHmacKeyVersion ¶
func (*Header) GetHmacSigner ¶
func (*Header) GetMessageLength ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
type Header_HmacHashFunction ¶
type Header_HmacHashFunction int32
const ( Header_MD5 Header_HmacHashFunction = 0 Header_SHA1 Header_HmacHashFunction = 1 )
const Default_Header_HmacHashFunction Header_HmacHashFunction = Header_MD5
func (Header_HmacHashFunction) Enum ¶
func (x Header_HmacHashFunction) Enum() *Header_HmacHashFunction
func (Header_HmacHashFunction) String ¶
func (x Header_HmacHashFunction) String() string
func (*Header_HmacHashFunction) UnmarshalJSON ¶
func (x *Header_HmacHashFunction) UnmarshalJSON(data []byte) error
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func (*Log) Log ¶
Logging workhorse function. Chances are you're not going to call this directly, but via one of the helper methods. of Info() .. Critical() level - One of the defined logging CONST values mtype - Message type, Short class identifier for the message payload - Main error message fields - additional optional key/value data associated with the message.
type Logger ¶
type Logger interface { Log(level int32, mtype, payload string, field Fields) error Info(mtype, payload string, field Fields) error Debug(mtype, payload string, field Fields) error Notice(mtype, payload string, field Fields) error Warn(mtype, payload string, field Fields) error Error(mtype, payload string, field Fields) error Critical(mtype, payload string, field Fields) error Alert(mtype, payload string, field Fields) error }
===
type Message ¶
type Message struct { Uuid []byte `protobuf:"bytes,1,req,name=uuid" json:"uuid,omitempty"` Timestamp *int64 `protobuf:"varint,2,req,name=timestamp" json:"timestamp,omitempty"` Type *string `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"` Logger *string `protobuf:"bytes,4,opt,name=logger" json:"logger,omitempty"` Severity *int32 `protobuf:"varint,5,opt,name=severity,def=7" json:"severity,omitempty"` Payload *string `protobuf:"bytes,6,opt,name=payload" json:"payload,omitempty"` EnvVersion *string `protobuf:"bytes,7,opt,name=env_version" json:"env_version,omitempty"` Pid *int32 `protobuf:"varint,8,opt,name=pid" json:"pid,omitempty"` Hostname *string `protobuf:"bytes,9,opt,name=hostname" json:"hostname,omitempty"` Fields []*Field `protobuf:"bytes,10,rep,name=fields" json:"fields,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*Message) GetEnvVersion ¶
func (*Message) GetHostname ¶
func (*Message) GetPayload ¶
func (*Message) GetSeverity ¶
func (*Message) GetTimestamp ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
type Metric ¶
type Metric struct {
// contains filtered or unexported fields
}
func (*Metric) IncrementBy ¶
type MzConfig ¶
type MzConfig struct {
// contains filtered or unexported fields
}
func ReadMzConfig ¶
Read a ini like configuration file into a map
func (*MzConfig) Get ¶
Get a value from the config map, providing an optional default.
This is a fairly common behavior for me.
func (*MzConfig) SetDefault ¶
Set a value if it's not already defined
type TestMetric ¶
type TestMetric struct{}
func NewTestMetric ¶
func NewTestMetric(prefix string, logger Logger, config *MzConfig) *TestMetric
func (*TestMetric) Decrement ¶
func (r *TestMetric) Decrement(string)
func (*TestMetric) Increment ¶
func (r *TestMetric) Increment(string)
func (*TestMetric) IncrementBy ¶
func (r *TestMetric) IncrementBy(string, int)
func (*TestMetric) Prefix ¶
func (r *TestMetric) Prefix(string)
func (*TestMetric) Snapshot ¶
func (r *TestMetric) Snapshot() (m map[string]interface{})
func (*TestMetric) Timer ¶
func (r *TestMetric) Timer(string, int64)