Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultInfoFactory ¶
Types ¶
type ContextInfo ¶
type ContextInfo struct { Name string `json:"name"` Description string `json:"description"` ContextId string `json:"context_id"` StartTime time.Time `json:"start_time"` Properties map[string]string `json:"properties"` }
Context information component that provides detail information about execution context: container or/and process.
Most often ContextInfo is used by logging and performance counters to identify source of the collected logs and metrics.
Configuration parameters
name: the context (container or process) name description: human-readable description of the context properties: entire section of additional descriptive properties ...
Example
contextInfo := NewContextInfo(); contextInfo.Configure(NewConfigParamsFromTuples( "name", "MyMicroservice", "description", "My first microservice" )); context.Name; // Result: "MyMicroservice" context.ContextId; // Possible result: "mylaptop" context.StartTime; // Possible result: 2018-01-01:22:12:23.45Z
func NewContextInfo ¶
func NewContextInfo() *ContextInfo
Creates a new instance of this context info. Returns *ContextInfo
func NewContextInfoFromConfig ¶
func NewContextInfoFromConfig(cfg *config.ConfigParams) *ContextInfo
Creates a new instance of this context info. Parameters:
- ncfg *config.ConfigParams a context configuration parameters.
Returns *ContextInfo
func (*ContextInfo) Configure ¶
func (c *ContextInfo) Configure(cfg *config.ConfigParams)
Configures component by passing configuration parameters. Parameters:
- config *config.ConfigParams configuration parameters to be set.
func (*ContextInfo) Uptime ¶
func (c *ContextInfo) Uptime() int64
Calculates the context uptime as from the start time. Returns int64 number of milliseconds from the context start time.
Click to show internal directories.
Click to hide internal directories.