More implementation for io.opentelemetry.api.common.AttributeKey
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:
- Make the all attributes in
io.opentelemetry.semconv.trace.attributes.SemanticAttributesSemanticAttributeImpl
public class SemanticAttributeImpl<T> implements AttributeKey<T> {}
- Make the SemanticAttributes that can be recored into metrics MetricsSemanticAttributes
public class MetricsSemanticAttributes<T> extends SemanticAttributeImpl {}
- 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.
Is this an issue for the core SDK? Would anything need to change in the way we currently define the interface to make this possible? If not, please close this and open it in the semantic conventions repository. thanks!
we discussed this in the APAC SIG meeting this yesterday and I think @123liuziming is going to explore a different option for optimizations he is looking at, will wait for him to update here though