发布

  • [OPIK-3295] [BE]Spring AI OpenTelemetry integration fix to display tags and metadata with latest version of the library (#4277)

    frostbyte_neo 发布于 2025-12-04 18:04:59 +00:00

    • [OPIK-3295] [BE] Enhance OpenTelemetry mapping utilities and tests to support usage field extraction
    • Introduced extractUsageField and related helper methods in OpenTelemetryMappingUtils for advanced usage extraction.
    • Added usage key mapping and JSON object handling for input_tokens, output_tokens, and nested usage data.
    • Refactored OpenTelemetryMapper to delegate usage field processing to OpenTelemetryMappingUtils.
    • Extended unit tests in OpenTelemetryMappingUtilsTest for comprehensive validation of usage extraction scenarios, including fallback logic and error handling.
    • [OPIK-3321] [BE] Add new OpenTelemetry mapping rules for GenAI metadata handling
    • Added temperature, response.id, finish_reasons, and operation.name rules to enhance metadata extraction.
    • Expanded GenAI rules for improved span and telemetry mapping logic.
    • [OPIK-3337] [BE] Add OpenTelemetry mapping rules for tags extraction and metadata support
    • Introduced new mapping rules for opik.tags and opik.metadata to enhance attribute processing.
    • Implemented extractTags in OpenTelemetryMappingUtils for robust tag extraction from various formats.
    • Updated OpenTelemetryMapper to handle tag and metadata mapping.
    • Extended unit tests in OpenTelemetryMappingUtilsTest to validate extractTags functionality across diverse scenarios.
    • [OPIK-3452] [BE] Update RandomUtils method usage in OpenTelemetryResourceTest
    • Replaced deprecated nextInt with randomInt for generating batch sizes in unit tests.
    • [OPIK-3295] [BE] Enhance OpenTelemetry metadata mapping logic
    • Added prefix support for opik.metadata rule to allow dynamic key matching.
    • Updated unit tests in OpenTelemetryResourceTest to include validation for prefixed metadata keys and new inline values.
    • [OPIK-3478] [BE] Refactor OpenTelemetry mapping and tagging utilities
    • Cleaned up JSON object handling logic in OpenTelemetryMappingUtils to simplify usage extraction and improve fallback handling.
    • Updated access modifiers for helper methods (tryExtractUsageFromString, tryExtractUsageFromJsonObject) for better encapsulation.
    • Improved debug logging across OpenTelemetryMappingUtils for enhanced error traceability.
    • Applied formatting fixes and improved readability in OpenTelemetryMapper and related tests.
    • Adjusted and expanded unit tests in OpenTelemetryResourceTest and OpenTelemetryMappingUtilsTest to validate updated logic.
    • [OPIK-3295] [DOCS] Update Spring AI integration with Opik
    • Added detailed setup steps, including prerequisites, environment variables, and installation instructions.
    • Introduced multiple methods to run the demo application.
    • Updated sample configuration files and example code to enhance clarity.
    • Included instructions for testing the demo application with REST API requests.
    • Added new image springai_opentelemetry_integration.png to showcase Opik traces.
    • Optimised images with calibre/image-actions

    • [OPIK-3295] [DOCS] Update of documentation

    • [OPIK-3295] [DOCS] Removed conflicting file

    • Optimised images with calibre/image-actions

    • [OPIK-3295] [BE] Update OpenTelemetryMapper to include all imports

    • Added imports for extractTags, extractToJsonColumn, and extractUsageField from OpenTelemetryMappingUtils.
    • [OPIK-3295] [BE] Refactor tests with parameterized cases and centralized data sources
    • Replaced repetitive test methods with parameterized tests using @ParameterizedTest and @MethodSource.
    • Introduced centralized test data generators for invalid JSON strings, usage field values, and tag values.
    • Simplified and reduced redundant test logic in OpenTelemetryMappingUtilsTest.

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    下载附件