Skip to content

Add experimental instrumentation for OpenAI client #1309

Add experimental instrumentation for OpenAI client

Add experimental instrumentation for OpenAI client #1309

GitHub Actions / Test Results 11-hotspot succeeded Jan 20, 2025 in 1s

128 passed, 0 failed and 6 skipped

Tests passed successfully

Report Passed Failed Skipped Time
common/build/test-results/test/TEST-co.elastic.otel.common.AbstractSimpleChainingSpanProcessorTest.xml 2✔️ 147ms
common/build/test-results/test/TEST-co.elastic.otel.common.ChainingSpanProcessorAutoConfigurationTest.xml 3✔️ 703ms
common/build/test-results/test/TEST-co.elastic.otel.common.LocalRootSpanTest.xml 4✔️ 19ms
common/build/test-results/test/TEST-co.elastic.otel.common.MutableSpanTest.xml 5✔️ 14ms
common/build/test-results/test/TEST-co.elastic.otel.common.SpanValueTest.xml 26✔️ 142ms
common/build/test-results/test/TEST-co.elastic.otel.common.util.HexUtilsTest.xml 2✔️ 9ms
custom/build/test-results/test/TEST-co.elastic.otel.config.ConfigurationExporterTest.xml 1✔️ 1s
custom/build/test-results/test/TEST-co.elastic.otel.config.DynamicInstrumentationTest.xml 1✔️ 2ms
custom/build/test-results/test/TEST-co.elastic.otel.config.ReconcileOptionsTest.xml 3✔️ 3ms
custom/build/test-results/test/TEST-co.elastic.otel.ElasticAutoConfigurationCustomizerProviderTest.xml 3✔️ 82ms
custom/build/test-results/test/TEST-co.elastic.otel.SpanStackTraceFilterTest.xml 1✔️ 51ms
custom/build/test-results/test/TEST-co.elastic.otel.SpanStackTraceTest.xml 9✔️ 2s
inferred-spans/build/test-results/test/TEST-co.elastic.otel.InferredSpansBackwardsCompatibilityConfigTest.xml 3✔️ 9s
instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.ChatTest.xml 15✔️ 5s
instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.EmbeddingsTest.xml 2✔️ 304ms
instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.LiveAPIChatIntegrationTest.xml 3✖️ 1ms
jvmti-access/build/test-results/test/TEST-co.elastic.otel.ResourceExtractionUtilTest.xml 5✔️ 1s
jvmti-access/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingCorrelationTest$CorrelationMemory.xml 4✔️ 2✖️ 53ms
jvmti-access/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingCorrelationTest$ProfilerSocket.xml 9✔️ 43ms
resources/build/test-results/test/TEST-co.elastic.otel.resources.ResourcesAutoConfigurationTest.xml 3✔️ 61ms
testing/integration-tests/agent-internals/build/test-results/test/TEST-DistroResourceAttributesTest.xml 1✔️ 235ms
testing/integration-tests/agent-internals/build/test-results/test/TEST-SpanValueTest.xml 1✔️ 8ms
testing/integration-tests/inferred-spans-test/build/test-results/test/TEST-InferredSpansTest.xml 1✔️ 3s
testing/integration-tests/universal-profiling-test/build/test-results/test/TEST-UniversalProfilingIntegrationTest.xml 1✔️ 76ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.disruptor.PeekingPollerTest.xml 1✔️ 3ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.hostid.ProfilerHostIdApplyingSpanExporterTest.xml 2✔️ 4ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.SpanByIdSetTest.xml 3✔️ 550ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorAutoConfigTest.xml 4✔️ 210ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorTest$SharedMemory.xml 3✔️ 1✖️ 14ms
universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorTest$SpanCorrelation.xml 10✔️ 217ms

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.AbstractSimpleChainingSpanProcessorTest.xml

2 tests were completed in 147ms with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.AbstractSimpleChainingSpanProcessorTest 2✔️ 147ms

✔️ co.elastic.otel.common.AbstractSimpleChainingSpanProcessorTest

✔️ testAttributeUpdate()
✔️ testSpanDropping()

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.ChainingSpanProcessorAutoConfigurationTest.xml

3 tests were completed in 703ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.ChainingSpanProcessorAutoConfigurationTest 3✔️ 703ms

✔️ co.elastic.otel.common.ChainingSpanProcessorAutoConfigurationTest

✔️ noProcessorCreatedWithoutExporter()
✔️ multipleExporterProcessors()
✔️ verifyProcessorOrder()

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.LocalRootSpanTest.xml

4 tests were completed in 19ms with 4 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.LocalRootSpanTest 4✔️ 19ms

✔️ co.elastic.otel.common.LocalRootSpanTest

✔️ checkRemoteSpan()
✔️ checkInferredSpanDetected()
✔️ checkNested()
✔️ checkRemoteParent()

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.MutableSpanTest.xml

5 tests were completed in 14ms with 5 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.MutableSpanTest 5✔️ 14ms

✔️ co.elastic.otel.common.MutableSpanTest

✔️ testAttributesMutations()
✔️ noDoubleWrapping()
✔️ freezeAfterMutation()
✔️ noSpanDataCopyWithoutMutation()
✔️ testAttributesReusedIfNotMutated()

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.SpanValueTest.xml

26 tests were completed in 142ms with 26 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.SpanValueTest 26✔️ 142ms

✔️ co.elastic.otel.common.SpanValueTest

✔️ testInvalidSpanDetected()
✔️ [1] Early Span, dense SpanValue
✔️ [2] Early Span, sparse SpanValue
✔️ [3] Early ReadableSpan, dense SpanValue
✔️ [4] Early ReadableSpan, sparse SpanValue
✔️ [5] New Span, dense SpanValue
✔️ [6] New Span, sparse SpanValue
✔️ [7] MutableSpan, dense SpanValue
✔️ [8] MutableSpan, sparse SpanValue
✔️ verifyMutableSpanUnwrapped()
✔️ [1] Early Span, dense SpanValue
✔️ [2] Early Span, sparse SpanValue
✔️ [3] Early ReadableSpan, dense SpanValue
✔️ [4] Early ReadableSpan, sparse SpanValue
✔️ [5] New Span, dense SpanValue
✔️ [6] New Span, sparse SpanValue
✔️ [7] MutableSpan, dense SpanValue
✔️ [8] MutableSpan, sparse SpanValue
✔️ [1] Early Span, dense SpanValue
✔️ [2] Early Span, sparse SpanValue
✔️ [3] Early ReadableSpan, dense SpanValue
✔️ [4] Early ReadableSpan, sparse SpanValue
✔️ [5] New Span, dense SpanValue
✔️ [6] New Span, sparse SpanValue
✔️ [7] MutableSpan, dense SpanValue
✔️ [8] MutableSpan, sparse SpanValue

✔️ common/build/test-results/test/TEST-co.elastic.otel.common.util.HexUtilsTest.xml

2 tests were completed in 9ms with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.common.util.HexUtilsTest 2✔️ 9ms

✔️ co.elastic.otel.common.util.HexUtilsTest

✔️ bytesToHexString()
✔️ writeHexToByteBuffer()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.config.ConfigurationExporterTest.xml

1 tests were completed in 1s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.config.ConfigurationExporterTest 1✔️ 1s

✔️ co.elastic.otel.config.ConfigurationExporterTest

✔️ testGeneratedConfigurationDocsAreUpToDate()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.config.DynamicInstrumentationTest.xml

1 tests were completed in 2ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.config.DynamicInstrumentationTest 1✔️ 2ms

✔️ co.elastic.otel.config.DynamicInstrumentationTest

✔️ checkForPublicImplementations()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.config.ReconcileOptionsTest.xml

3 tests were completed in 3ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.config.ReconcileOptionsTest 3✔️ 3ms

✔️ co.elastic.otel.config.ReconcileOptionsTest

✔️ reconcileWithOneDifferentOption()
✔️ reconcileWithoutOneOption()
✔️ reconcileAllOptions()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.ElasticAutoConfigurationCustomizerProviderTest.xml

3 tests were completed in 82ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.ElasticAutoConfigurationCustomizerProviderTest 3✔️ 82ms

✔️ co.elastic.otel.ElasticAutoConfigurationCustomizerProviderTest

✔️ disableExperimentalRuntimeMetrics()
✔️ defaultConfiguration()
✔️ disableCustomResourceProvider()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.SpanStackTraceFilterTest.xml

1 tests were completed in 51ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.SpanStackTraceFilterTest 1✔️ 51ms

✔️ co.elastic.otel.SpanStackTraceFilterTest

✔️ filtering()

✔️ custom/build/test-results/test/TEST-co.elastic.otel.SpanStackTraceTest.xml

9 tests were completed in 2s with 9 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.SpanStackTraceTest 9✔️ 2s

✔️ co.elastic.otel.SpanStackTraceTest

✔️ [1] otel.java.experimental.span-stacktrace.min.duration
✔️ [2] elastic.otel.java.span-stacktrace.min.duration
✔️ [3] elastic.otel.java.span.stacktrace.min.duration
✔️ checkStackTracePresent()
✔️ checkInferredSpansIgnored()
✔️ [1] otel.java.experimental.span-stacktrace.min.duration
✔️ [2] elastic.otel.java.span-stacktrace.min.duration
✔️ [3] elastic.otel.java.span.stacktrace.min.duration
✔️ checkMinDurationRespected()

✔️ inferred-spans/build/test-results/test/TEST-co.elastic.otel.InferredSpansBackwardsCompatibilityConfigTest.xml

3 tests were completed in 9s with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.InferredSpansBackwardsCompatibilityConfigTest 3✔️ 9s

✔️ co.elastic.otel.InferredSpansBackwardsCompatibilityConfigTest

✔️ checkAllLegacyOptions(Path)
✔️ ensureOptionsTakePrecedenceOverLegacyOptions()
✔️ checkDisabledbyDefault()

✔️ instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.ChatTest.xml

15 tests were completed in 5s with 15 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.openai.ChatTest 15✔️ 5s

✔️ co.elastic.otel.openai.ChatTest

✔️ allTheClientOptions()
✔️ captureMessageContent()
✔️ toolsWithFollowupAndCaptureContent()
✔️ disableEvents()
✔️ stream()
✔️ streamAllTheClientOptions()
✔️ toolCalls()
✔️ chat()
✔️ streamWithIncludeUsage()
✔️ connectionError()
✔️ toolCallsWithCaptureMessageContent()
✔️ streamWithCaptureMessageContent()
✔️ multipleChoicesWithCaptureContent()
✔️ streamToolsAndCaptureMessageContent()
✔️ connectionErrorStream()

✔️ instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.EmbeddingsTest.xml

2 tests were completed in 304ms with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.openai.EmbeddingsTest 2✔️ 304ms

✔️ co.elastic.otel.openai.EmbeddingsTest

✔️ basic()
✔️ invalidModel()

✔️ instrumentation/openai-client-instrumentation/build/test-results/test/TEST-co.elastic.otel.openai.LiveAPIChatIntegrationTest.xml

3 tests were completed in 1ms with 0 passed, 0 failed and 3 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.openai.LiveAPIChatIntegrationTest 3✖️ 1ms

✔️ co.elastic.otel.openai.LiveAPIChatIntegrationTest

✖️ captureMessageContent()
✖️ toolCallsWithCaptureMessageContent()
✖️ streamWithCaptureMessageContent()

✔️ jvmti-access/build/test-results/test/TEST-co.elastic.otel.ResourceExtractionUtilTest.xml

5 tests were completed in 1s with 5 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.ResourceExtractionUtilTest 5✔️ 1s

✔️ co.elastic.otel.ResourceExtractionUtilTest

✔️ exportResourceToDirectoryIdempotence(Path)
✔️ testContentDoesNotMatch(Path)
✔️ exportResourceToDirectoryInMultipleThreads(Path)
✔️ exportResourceToDirectory(Path)
✔️ exportResourceToDirectory_throwExceptionIfNotFound(Path)

✔️ jvmti-access/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingCorrelationTest$CorrelationMemory.xml

6 tests were completed in 53ms with 4 passed, 0 failed and 2 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.UniversalProfilingCorrelationTest$CorrelationMemory 4✔️ 2✖️ 53ms

✔️ co.elastic.otel.UniversalProfilingCorrelationTest$CorrelationMemory

✔️ ensureProcessStorageBufferNotGCed()
✖️ testVirtualThreadsStoragePropagatedWithMounts()
✔️ testPlatformThreadStorage()
✔️ testProcessStorage()
✖️ testVirtualThreadsExcludedByDefault()
✔️ enablingVirtualThreadSupportDoesNotThrow()

✔️ jvmti-access/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingCorrelationTest$ProfilerSocket.xml

9 tests were completed in 43ms with 9 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.UniversalProfilingCorrelationTest$ProfilerSocket 9✔️ 43ms

✔️ co.elastic.otel.UniversalProfilingCorrelationTest$ProfilerSocket

✔️ [1] true
✔️ [2] false
✔️ receiveTraceCorrelationMessage(Path)
✔️ receiveProfilerRegistrationMessage(Path)
✔️ badFileName()
✔️ receiveUnknownMessage(Path)
✔️ tooLongFileName()
✔️ decodeTruncatedMessage(Path)
✔️ checkTruncatedMessageHandling(Path)

✔️ resources/build/test-results/test/TEST-co.elastic.otel.resources.ResourcesAutoConfigurationTest.xml

3 tests were completed in 61ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.resources.ResourcesAutoConfigurationTest 3✔️ 61ms

✔️ co.elastic.otel.resources.ResourcesAutoConfigurationTest

✔️ explicitly_disabled()
✔️ explicitly_enabled()
✔️ elastic_defaults()

✔️ testing/integration-tests/agent-internals/build/test-results/test/TEST-DistroResourceAttributesTest.xml

1 tests were completed in 235ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
DistroResourceAttributesTest 1✔️ 235ms

✔️ DistroResourceAttributesTest

✔️ checkDistroName()

✔️ testing/integration-tests/agent-internals/build/test-results/test/TEST-SpanValueTest.xml

1 tests were completed in 8ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
SpanValueTest 1✔️ 8ms

✔️ SpanValueTest

✔️ ensureStoredAsFields()

✔️ testing/integration-tests/inferred-spans-test/build/test-results/test/TEST-InferredSpansTest.xml

1 tests were completed in 3s with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
InferredSpansTest 1✔️ 3s

✔️ InferredSpansTest

✔️ checkInferredSpansFunctional()

✔️ testing/integration-tests/universal-profiling-test/build/test-results/test/TEST-UniversalProfilingIntegrationTest.xml

1 tests were completed in 76ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
UniversalProfilingIntegrationTest 1✔️ 76ms

✔️ UniversalProfilingIntegrationTest

✔️ checkIntegrationActive()

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.disruptor.PeekingPollerTest.xml

1 tests were completed in 3ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.disruptor.PeekingPollerTest 1✔️ 3ms

✔️ co.elastic.otel.disruptor.PeekingPollerTest

✔️ testPeekingFunction()

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.hostid.ProfilerHostIdApplyingSpanExporterTest.xml

2 tests were completed in 4ms with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.hostid.ProfilerHostIdApplyingSpanExporterTest 2✔️ 4ms

✔️ co.elastic.otel.hostid.ProfilerHostIdApplyingSpanExporterTest

✔️ ensureApplicationProvidedHostIdTakesPrecedence()
✔️ checkHostIdUpdated()

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.SpanByIdSetTest.xml

3 tests were completed in 550ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.SpanByIdSetTest 3✔️ 550ms

✔️ co.elastic.otel.SpanByIdSetTest

✔️ duplicateAddAndRemove()
✔️ testStaleEntriesExpunged()
✔️ checkLookup()

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorAutoConfigTest.xml

4 tests were completed in 210ms with 4 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.UniversalProfilingProcessorAutoConfigTest 4✔️ 210ms

✔️ co.elastic.otel.UniversalProfilingProcessorAutoConfigTest

✔️ checkEnabledButInactiveByDefault()
✔️ testFailureDoesNotCrashAutoConfig()
✔️ testDisabling()
✔️ testAllSettings(Path)

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorTest$SharedMemory.xml

4 tests were completed in 14ms with 3 passed, 0 failed and 1 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.UniversalProfilingProcessorTest$SharedMemory 3✔️ 1✖️ 14ms

✔️ co.elastic.otel.UniversalProfilingProcessorTest$SharedMemory

✔️ testProcessStoragePopulated()
✔️ testNestedActivations()
✔️ testRemoteSpanIgnored()
✖️ testVirtualThreadSupport(boolean)

✔️ universal-profiling-integration/build/test-results/test/TEST-co.elastic.otel.UniversalProfilingProcessorTest$SpanCorrelation.xml

10 tests were completed in 217ms with 10 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
co.elastic.otel.UniversalProfilingProcessorTest$SpanCorrelation 10✔️ 217ms

✔️ co.elastic.otel.UniversalProfilingProcessorTest$SpanCorrelation

✔️ bufferCapacityExceeded()
✔️ checkCorrelationFunctional()
✔️ [1] true
✔️ [2] false
✔️ badSocketPath()
✔️ nonLocalRootSpansNotDelayed()
✔️ socketParentDirCreated()
✔️ unsampledSpansNotCorrelated()
✔️ ensureCorrelationDoesNotPreventSpanGC()
✔️ shutdownFlushesBufferedSpans()