Creates a new attribute container with only configuration.
The OpenTelemetry configuration containing trace configuration and limits
A new IAttributeContainer instance with auto-generated container ID
Creates a new attribute container with configuration and a name.
The OpenTelemetry configuration containing trace configuration and limits
The name for the container (used in the container ID)
A new IAttributeContainer instance with the specified name
Creates a new attribute container with configuration, name, and inheritance.
The OpenTelemetry configuration containing trace configuration and limits
The name for the container (used in the container ID)
Parent attributes or container to inherit from
A new IAttributeContainer instance that inherits from the specified parent
const config = { traceCfg: { generalLimits: { attributeCountLimit: 64 } } };
const parent = { "environment": "production", "region": "us-east-1" };
const child = createAttributeContainer(config, "child-container", parent);
console.log(child.get("environment")); // "production" (inherited)
child.set("service.name", "my-service"); // local attribute
Creates a new attribute container with full configuration options.
The OpenTelemetry configuration containing trace configuration and limits
The name for the container (used in the container ID)
Parent attributes or container to inherit from
Specific attribute limits to override configuration defaults
A new IAttributeContainer instance with custom limits and inheritance
const config = { traceCfg: { generalLimits: { attributeCountLimit: 64 } } };
const parent = { "environment": "production" };
const customLimits = { attributeCountLimit: 32, attributeValueLengthLimit: 256 };
const container = createAttributeContainer(config, "limited-container", parent, customLimits);
// This container has stricter limits than the default configuration
Creates a new attribute container that provides an efficient, observable key-value storage for OpenTelemetry attributes with support for inheritance, limits, and change notifications.
The container supports inherited attributes from parent containers or plain objects, enforces attribute count and value size limits, and provides efficient iteration and access patterns.
Param: otelCfg
The OpenTelemetry configuration containing trace configuration and limits
Param: name
Optional name for the container (used in the container ID)
Param: inheritAttrib
Optional parent attributes or container to inherit from
Param: attribLimits
Optional specific attribute limits to override configuration defaults
Returns
A new IAttributeContainer instance with the specified configuration
Since
3.4.0
Example