info

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 5 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultInfoFactory

func NewDefaultInfoFactory() *build.Factory

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.

Jump to

Keyboard shortcuts

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