fun filterCreateAgentEventIds()

in agents/agents-features/agents-features-opentelemetry/src/jvmTest/kotlin/ai/koog/agents/features/opentelemetry/OpenTelemetryTestData.kt [47:67]


    fun filterCreateAgentEventIds(agentId: String): List<String> {
        val operationNameAttribute = SpanAttributes.Operation.Name(OperationNameType.CREATE_AGENT)
        val expectedOperationNameKey = AttributeKey.stringKey(operationNameAttribute.key)

        val agentIdAttribute = SpanAttributes.Agent.Id(agentId)
        val expectedAgentIdAttributeKey = AttributeKey.stringKey(agentIdAttribute.key)

        val eventIdAttribute = KoogAttributes.Koog.Event.Id("")
        val expectedEventIdKey = AttributeKey.stringKey(eventIdAttribute.key)

        return collectedSpans.filter { span ->
            val attributeValue = span.attributes.get(expectedOperationNameKey)
            val agentIdValue = span.attributes.get(expectedAgentIdAttributeKey)

            attributeValue != null &&
                attributeValue == operationNameAttribute.value &&
                agentIdValue != null &&
                agentIdValue == agentIdAttribute.value
        }
            .mapNotNull { span -> span.attributes?.get(expectedEventIdKey) }
    }