Skip to content

API design: SpanBuilder::attributes #794

Closed
@LukeMathWalker

Description

@LukeMathWalker

Attributes attached to a SpanBuilder are currently stored as a Vec<opentelemetry::KeyValue> - see docs.

This makes it impossible to access the value attached to a specific key or to verify that an attribute is present in O(1). It always take O(n), where n is the number of attributes - this can be significant.

Why was a Vec<KeyValue> chosen over a HashMap<Key, Value>?
I see it gets later processed into an EvictedHashMap when SpanBuilder gets converted into a Span 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commonArea:common issues that not related to specific pillarenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions