function SpanLimitsBuilder::build
@phan-suppress PhanDeprecatedClassConstant
See also
https://github.com/open-telemetry/opentelemetry-specification/blob/main…
File
-
vendor/
open-telemetry/ sdk/ Trace/ SpanLimitsBuilder.php, line 112
Class
Namespace
OpenTelemetry\SDK\TraceCode
public function build() : SpanLimits {
$attributeCountLimit = $this->attributeCountLimit ?: Configuration::getInt(Env::OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, SpanLimits::DEFAULT_SPAN_ATTRIBUTE_COUNT_LIMIT);
$attributeValueLengthLimit = $this->attributeValueLengthLimit ?: Configuration::getInt(Env::OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, SpanLimits::DEFAULT_SPAN_ATTRIBUTE_LENGTH_LIMIT);
$eventCountLimit = $this->eventCountLimit ?: Configuration::getInt(Env::OTEL_SPAN_EVENT_COUNT_LIMIT, SpanLimits::DEFAULT_SPAN_EVENT_COUNT_LIMIT);
$linkCountLimit = $this->linkCountLimit ?: Configuration::getInt(Env::OTEL_SPAN_LINK_COUNT_LIMIT, SpanLimits::DEFAULT_SPAN_LINK_COUNT_LIMIT);
$attributePerEventCountLimit = $this->attributePerEventCountLimit ?: Configuration::getInt(Env::OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, SpanLimits::DEFAULT_EVENT_ATTRIBUTE_COUNT_LIMIT);
$attributePerLinkCountLimit = $this->attributePerLinkCountLimit ?: Configuration::getInt(Env::OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, SpanLimits::DEFAULT_LINK_ATTRIBUTE_COUNT_LIMIT);
if ($attributeValueLengthLimit === PHP_INT_MAX) {
$attributeValueLengthLimit = null;
}
$spanAttributesFactory = Attributes::factory($attributeCountLimit, $attributeValueLengthLimit);
if (!$this->retainGeneralIdentityAttributes) {
$spanAttributesFactory = new FilteredAttributesFactory($spanAttributesFactory, [
TraceAttributes::USER_ID,
TraceAttributes::USER_ROLES,
]);
}
return new SpanLimits($spanAttributesFactory, Attributes::factory($attributePerEventCountLimit, $attributeValueLengthLimit), Attributes::factory($attributePerLinkCountLimit, $attributeValueLengthLimit), $eventCountLimit, $linkCountLimit);
}