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

Breadcrumb

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

function AttributesBuilder::offsetSet

@phan-suppress PhanUndeclaredClassAttribute

File

vendor/open-telemetry/sdk/Common/Attribute/AttributesBuilder.php, line 61

Class

AttributesBuilder
@internal

Namespace

OpenTelemetry\SDK\Common\Attribute

Code

public function offsetSet($offset, $value) : void {
    if ($offset === null) {
        return;
    }
    if ($value === null) {
        unset($this->attributes[$offset]);
        return;
    }
    if (!$this->attributeValidator
        ->validate($value)) {
        self::logWarning($this->attributeValidator
            ->getInvalidMessage() . ': ' . $offset);
        $this->droppedAttributesCount++;
        return;
    }
    if (count($this->attributes) === $this->attributeCountLimit && !array_key_exists($offset, $this->attributes)) {
        $this->droppedAttributesCount++;
        return;
    }
    $this->attributes[$offset] = $this->normalizeValue($value);
    
    //@todo "There SHOULD be a message printed in the SDK's log to indicate to the user that an attribute was
    //       discarded due to such a limit. To prevent excessive logging, the message MUST be printed at most
    //       once per <thing> (i.e., not per discarded attribute)."
}

API Navigation

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