发布

  • [OPIK-3247] [BE] [FE] Add experiment_id filter and project_id to Experiment entity (#4553)

    frostbyte_neo 发布于 2025-12-30 16:00:19 +00:00

    • [OPIK-3247] [BE] Add experiment_id filter and project_id to Experiment entity

    Implements backend support for filtering traces by experiment_id and exposing project_id in Experiment API.

    • Added EXPERIMENT_ID field to TraceField enum with EXPERIMENT_AGGREGATION filter strategy
    • Updated TraceDAO to filter traces by experiment_id via experiment_items subquery
    • Added project_id field to Experiment API entity
    • Updated ExperimentDAO to fetch project_id for experiments via optimized CTE
    • Updated DatabaseUtils to bind experiment_filters in trace queries

    Implements OPIK-3247: Link experiments to traces

    • [OPIK-3247] [BE] Add test for experiment_id trace filtering

    Adds integration test for filtering traces by experiment_id filter.
    Test verifies that only traces associated with the specified experiment
    are returned when filtering by experiment_id.

    • Added test method whenFilterExperimentIdEquals__thenReturnTracesFiltered
    • Creates experiments and experiment items linking traces to experiments
    • Verifies filtering works correctly for traces endpoint, stats endpoint, and search endpoint
    • [OPIK-3247] [BE] Introduce RowUtils for safer database row access

    Added a new utility class, RowUtils, to centralize the logic for safely retrieving optional values from database rows. This change replaces direct calls to getOptionalValue in multiple DAO classes (ExperimentDAO, ProjectMetricsDAO, TraceThreadMapper) with RowUtils.getOptionalValue, improving code readability and maintainability.

    • Created RowUtils class with a method to handle missing columns gracefully
    • Updated ExperimentDAO, ProjectMetricsDAO, and TraceThreadMapper to use RowUtils for fetching optional values
    • Removed redundant getOptionalValue methods from ProjectMetricsDAO and TraceThreadMapper

    This refactor enhances the robustness of database interactions across the application.

    • [OPIK-3247] [FE] Enhance experiment trace navigation and filtering
    • Added experiment_id filter functionality to the traces navigation, allowing users to view traces associated with specific experiments.
    • Introduced useExperimentsColumnsWithTraceCount hook to enhance experiments table columns with trace count navigation capabilities.
    • Updated CompareExperimentsDetails to include a navigation tag for traces when not in compare mode.
    • Modified ExperimentsPage and ExperimentsTab to utilize the new trace count navigation.
    • Added experiment_id column to TracesSpansTab for better trace identification.
    • Implemented generateExperimentIdFilter utility for generating filters based on experiment IDs.

    This update improves user experience by providing direct access to relevant traces from experiments, enhancing data visibility and navigation.

    • [OPIK-3247] [BE] Update ExperimentsResourceTest to include projectId in ignored fields
    • Added "projectId" to the EXPERIMENT_IGNORED_FIELDS array in ExperimentsResourceTest.
    • This change ensures that projectId is excluded from the experiment comparison logic during tests, maintaining consistency with other ignored fields.

    This update enhances the test coverage for experiments by properly managing the fields that should be ignored in comparisons.

    • [OPIK-3247] [FE] Add tooltip for trace count in ExperimentsPage and ExperimentsTab
    • Updated the customMeta in ExperimentsPage and ExperimentsTab to include a tooltip with the text "View experiment traces" for better user guidance.
    • Modified LinkCell component to display the tooltip when available, enhancing the user interface and experience.

    This change improves the clarity of trace navigation in the experiments table.

    • [OPIK-3247] [FE] Enhance PlaygroundOutputActions with NavigationTag and improved layout
    • Added NavigationTag component to display traces associated with a single experiment, improving trace navigation.
    • Refactored layout of PlaygroundOutputActions for better alignment and spacing of elements.
    • Updated DatasetSelectBox and MetricSelector integration for a more cohesive user experience.

    This update enhances the functionality and usability of the Playground page by providing direct access to experiment traces and improving the overall layout.

    • Replace Button with NavigationTag for experiments in Playground and remove size prop from NavigationTag

    • Add trace_count to default visible columns in ExperimentsPage and ExperimentsTab

    • Rename handleTraceCountZoomIn to navigateToExperimentTraces

    • Remove unused expectedTraces variable by inlining it

    • Refactor trace_count to use TraceCountCell component and pass callback via customMeta

    • Move navigation hook inside TraceCountCell component

    • Replace FINAL with ORDER BY LIMIT 1 BY in experiment_items queries for better performance

    下载附件