function AttributesBuilder::offsetSet
@phan-suppress PhanUndeclaredClassAttribute
File
-
vendor/
open-telemetry/ sdk/ Common/ Attribute/ AttributesBuilder.php, line 61
Class
- AttributesBuilder
- @internal
Namespace
OpenTelemetry\SDK\Common\AttributeCode
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)."
}