Skip to content

More implementation for io.opentelemetry.api.common.AttributeKey #7175

@123liuziming

Description

@123liuziming

Currently, we have only one implementation io.opentelemetry.api.internal.InternalAttributeKeyImpl for io.opentelemetry.api.common.AttributeKey, and we may have more implementation for that, for example:

  1. Make the all attributes in io.opentelemetry.semconv.trace.attributes.SemanticAttributes SemanticAttributeImpl
public class SemanticAttributeImpl<T> implements AttributeKey<T> {}
  1. Make the SemanticAttributes that can be recored into metrics MetricsSemanticAttributes
public class MetricsSemanticAttributes<T> extends SemanticAttributeImpl {}
  1. Make the other attributes CustomAttributeImpl

If AttributeKey is classified, we can do a lot of performance optimisation. For example, we can filter out MetricsAttributes of SemanticAttributes by just calling xx.getclass().equals(MetricsAttributes) instead of traversing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestSuggest an idea for this project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions