def _get_attributes_if_set()

in instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py [0:0]


def _get_attributes_if_set(span: Span, names: Iterable) -> Attributes:
    """Returns a dict with any attribute found in the span attributes"""
    attributes = span.attributes
    return {name: attributes[name] for name in names if name in attributes}