function ResourceInfo::merge
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)
@todo can we optimize this to avoid re-validating the attributes on merge?
See also
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.2…
File
-
vendor/
open-telemetry/ sdk/ Resource/ ResourceInfo.php, line 64
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 merge(ResourceInfo $updating) : ResourceInfo {
$schemaUrl = self::mergeSchemaUrl($this->getSchemaUrl(), $updating->getSchemaUrl());
$attributes = Attributes::factory()->builder()
->merge($this->getAttributes(), $updating->getAttributes());
return ResourceInfo::create($attributes, $schemaUrl);
}