function ResourceInfo::serialize
File
-
vendor/
open-telemetry/ sdk/ Resource/ ResourceInfo.php, line 45
Class
- ResourceInfo
- 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…
Namespace
OpenTelemetry\SDK\ResourceCode
public function serialize() : string {
$copyOfAttributesAsArray = array_slice($this->attributes
->toArray(), 0);
//This may be overly cautious (in trying to avoid mutating the source array)
ksort($copyOfAttributesAsArray);
//sort the associative array by keys since the serializer will consider equal arrays different otherwise
//The exact return value doesn't matter, as long as it can distinguish between instances that represent the same/different resources
return serialize([
'schemaUrl' => $this->schemaUrl,
'attributes' => $copyOfAttributesAsArray,
]);
}