Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResourceInfo.php

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\Resource

Code

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,
    ]);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal