ContextInfo class
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
let contextInfo = new ContextInfo();
contextInfo.configure(ConfigParams.fromTuples(
'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
context.uptime; // Possible result: 3454345
Constructors
- ContextInfo([String name String description ])
- Creates a new instance of this context info. [...]
Properties
- contextId ↔ String
-
Gets the unique context id.
Usually it is the current host name. [...]
read / write
- description ↔ String
-
Gets the human-readable description of the context. [...]
read / write
- name ↔ String
-
Gets the context name. [...]
read / write
- properties ↔ dynamic
-
Gets context additional parameters. [...]
read / write
- startTime ↔ DateTime
-
Gets the context start time. [...]
read / write
- uptime → int
-
Calculates the context uptime as from the start time. [...]
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
configure(
ConfigParams config) → void - Configures component by passing configuration parameters. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
fromConfig(
ConfigParams config) → ContextInfo - Creates a new ContextInfo and sets its configuration parameters. [...]