ResourceInfo
in package
uses
LogsMessagesTrait
A Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the Resource.
The class named as ResourceInfo due to resource
is the soft reserved word in PHP.
Table of Contents
Properties
- $attributes : AttributesInterface
- $schemaUrl : string|null
Methods
- create() : self
- defaultResource() : ResourceInfo
- emptyResource() : ResourceInfo
- getAttributes() : AttributesInterface
- getSchemaUrl() : string|null
- merge() : ResourceInfo
- Merge current resource with an updating resource, combining all attributes. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked (even if the updated value is empty)
- serialize() : string
- logDebug() : void
- logError() : void
- logInfo() : void
- logNotice() : void
- logWarning() : void
- __construct() : mixed
- doLog() : void
- mergeSchemaUrl() : string|null
- Merge the schema URLs from the old and updating resource.
- shouldLog() : bool
Properties
$attributes
private
AttributesInterface
$attributes
$schemaUrl
private
string|null
$schemaUrl
= null
Methods
create()
public
static create(AttributesInterface $attributes[, string|null $schemaUrl = null ]) : self
Parameters
- $attributes : AttributesInterface
- $schemaUrl : string|null = null
Return values
selfdefaultResource()
public
static defaultResource() : ResourceInfo
Tags
Return values
ResourceInfoemptyResource()
public
static emptyResource() : ResourceInfo
Tags
Return values
ResourceInfogetAttributes()
public
getAttributes() : AttributesInterface
Return values
AttributesInterfacegetSchemaUrl()
public
getSchemaUrl() : string|null
Return values
string|nullmerge()
Merge current resource with an updating resource, combining all attributes. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked (even if the updated value is empty)
public
merge(ResourceInfo $updating) : ResourceInfo
Parameters
- $updating : ResourceInfo
Tags
Return values
ResourceInfoserialize()
public
serialize() : string
Return values
stringlogDebug()
protected
static logDebug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logError()
protected
static logError(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logInfo()
protected
static logInfo(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logNotice()
protected
static logNotice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logWarning()
protected
static logWarning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
__construct()
private
__construct(AttributesInterface $attributes[, string|null $schemaUrl = null ]) : mixed
Parameters
- $attributes : AttributesInterface
- $schemaUrl : string|null = null
doLog()
private
static doLog(string $level, string $message, array<string|int, mixed> $context) : void
Parameters
- $level : string
- $message : string
- $context : array<string|int, mixed>
mergeSchemaUrl()
Merge the schema URLs from the old and updating resource.
private
static mergeSchemaUrl(string|null $old, string|null $updating) : string|null
Parameters
- $old : string|null
- $updating : string|null
Tags
Return values
string|nullshouldLog()
private
static shouldLog(string $level) : bool
Parameters
- $level : string