Skip to content

feat: create agent_traces plugin in observability workspace#11387

Merged
ps48 merged 13 commits into
opensearch-project:mainfrom
joshuali925:agent-traces
Feb 27, 2026
Merged

feat: create agent_traces plugin in observability workspace#11387
ps48 merged 13 commits into
opensearch-project:mainfrom
joshuali925:agent-traces

Conversation

@joshuali925

@joshuali925 joshuali925 commented Feb 25, 2026

Copy link
Copy Markdown
Member

Description

This PR copies the explore plugin and modifies it to agent_traces plugin (see #11345 for details on agent tracing) by implementing the following:

  1. copy explore plugin and rename it to agent_traces
  2. remove unused components like logs/metrics/traces page, visualizations, etc.
    1. the old data table and embeddable is kept as is for now, for displaying the saved search of agent traces in a dashboard
  3. implement traces table and spans table for agent tracing use case
  4. implement flyout to show span details with trace tree, agent graph, and timeline views
  5. add feature flag --explore.agentTraces.enabled=true. It is kept under explore for easier management. This feature is disabled by default.

This is a very large PR since the plugin is duplicated from an existing large plugin, not built from scratch. I'd recommend reviewing the changes outside of the agent_traces directory and inside src/plugins/agent_traces/public/application/pages/. The other parts are duplicated code, and they may still contain code unused by agent traces plugin.

There are some pending items will be added as followup:

  1. re-implement agent graph using a different library
  2. update "Kind" label text and colors

Issues Resolved

closes #11345

Screenshot

image image image image (agent graph will be re-implemented using a different library)

Testing the changes

UT

Changelog

  • feat: create agent_traces plugin in observability workspace

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Caution

Review failed

The head commit changed during the review from dd2fd9d to b023a63.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Stylelint (17.3.0)
src/plugins/agent_traces/public/application/legacy/discover/application/components/loading_spinner/loading_spinner.scss

ConfigurationError: Could not find "@osd/stylelint-config". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:241:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:208:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:73:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:126:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:202:19)

src/plugins/agent_traces/public/application/legacy/discover/application/components/no_index_patterns/no_index_patterns.scss

ConfigurationError: Could not find "@osd/stylelint-config". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:241:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:208:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:73:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:126:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:202:19)

src/plugins/agent_traces/public/application/legacy/discover/application/components/no_results/no_results.scss

ConfigurationError: Could not find "@osd/stylelint-config". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:241:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:208:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:73:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:126:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:202:19)

  • 9 others

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@lezzago

lezzago commented Feb 25, 2026

Copy link
Copy Markdown
Member

Do we want consistency on where to collapse the trace calls for the child calls? The discover trace page has the collapse button on the left, but in the trace details side panel, it is on the left.

This created an odd inconsistency experience.

@joshuali925

Copy link
Copy Markdown
Member Author

Do we want consistency on where to collapse the trace calls for the child calls? The discover trace page has the collapse button on the left, but in the trace details side panel, it is on the left.

This created an odd inconsistency experience.

I believe for the tree view, it's not clear to users if we use the "Kind" label as collapse/expand button, so the button moved and aligned on the right. The traditional gantt chart view still has collapse button on the left for both discover traces and agent traces. But I agree it appears inconsistent. @jasonlhamazon what do you think

@codecov

codecov Bot commented Feb 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.78461% with 374 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.02%. Comparing base (3a571b5) to head (f99c449).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...cation/context/dataset_context/dataset_context.tsx 10.63% 41 Missing and 1 partial ⚠️
...s/public/application/pages/traces/traces_table.tsx 52.38% 33 Missing and 7 partials ⚠️
...ation/pages/traces/flyout/trace_details_flyout.tsx 54.65% 29 Missing and 10 partials ⚠️
.../actions/processors/trace_aggregation_processor.ts 71.17% 22 Missing and 10 partials ⚠️
...aces/public/application/utils/multi_query_utils.ts 46.55% 29 Missing and 2 partials ⚠️
...e_management/actions/processors/histogram_utils.ts 3.44% 28 Missing ⚠️
.../application/pages/traces/flow/trace_flow_view.tsx 48.00% 22 Missing and 4 partials ⚠️
...races/trace_details/traces/ppl_resolve_helpers.tsx 88.39% 4 Missing and 9 partials ⚠️
...agent_traces/public/__mock__/index_pattern_mock.ts 50.00% 10 Missing and 2 partials ⚠️
...es/public/application/pages/traces/spans_table.tsx 72.09% 11 Missing and 1 partial ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11387      +/-   ##
==========================================
+ Coverage   60.26%   61.02%   +0.75%     
==========================================
  Files        4661     4898     +237     
  Lines      130163   135501    +5338     
  Branches    22189    23502    +1313     
==========================================
+ Hits        78439    82685    +4246     
- Misses      46130    46876     +746     
- Partials     5594     5940     +346     
Flag Coverage Δ
Linux_1 24.80% <ø> (-0.02%) ⬇️
Linux_2 38.36% <ø> (+0.04%) ⬆️
Linux_3 42.59% <76.78%> (?)
Linux_4 33.61% <ø> (-0.02%) ⬇️
Windows_1 24.82% <ø> (+<0.01%) ⬆️
Windows_2 38.34% <ø> (+0.04%) ⬆️
Windows_3 42.59% <76.78%> (+2.43%) ⬆️
Windows_4 33.61% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
…tion

Signed-off-by: Joshua Li <joshuali925@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit 44a2725.

'Diff too large, requires skip by maintainers after manual review'


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

return response;
};

export const escapePPLValue = (value: any): string => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse something that exists in discover traces?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't want agent traces to depend on explore bundle, right now they are independent plugins to reduce impact

Comment thread src/plugins/agent_traces/public/application/pages/traces/hooks/use_agent_spans.ts Outdated

@ps48 ps48 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment - Multiple files (ppl_request_helpers.tsx, ppl_request_trace.tsx, ppl_resolve_helpers.tsx, etc.) contain no JSX. Should use .ts.

Comment thread src/plugins/agent_traces/public/application/pages/agent_traces_page.scss Outdated
Comment thread src/plugins/agent_traces/public/application/pages/traces/table_shared.tsx Outdated
Comment thread src/plugins/agent_traces/public/application/pages/traces/flow/node_types.ts Outdated
Comment on lines +275 to +276
traceSpansCache,
traceLoadingState,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including Map state objects (traceSpansCache, spanSpansCache) in useCallback deps creates new function references on every cache update, cascading re-renders to child tables. Use useRef for the cache instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think using ref the consumer will never re-render, i added a ref along with state for now, will check it later

Comment thread src/plugins/agent_traces/public/application/pages/traces/spans_table.tsx Outdated
@github-actions

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit a5e4011.

'Diff too large, requires skip by maintainers after manual review'


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit 17c186a.

'Diff too large, requires skip by maintainers after manual review'


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit f99c449.

'Diff too large, reduce your PR size or requires skip by maintainers after manual review'


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@ps48 ps48 merged commit 999feaf into opensearch-project:main Feb 27, 2026
105 of 109 checks passed
@jasonlhamazon

Copy link
Copy Markdown
Contributor

Do we want consistency on where to collapse the trace calls for the child calls? The discover trace page has the collapse button on the left, but in the trace details side panel, it is on the left.

This created an odd inconsistency experience.

@lezzago @joshuali925 , we should keep this for the trace tree. This is a known pattern for the trace tree view that we observe in this space in the industry.

markdboyd pushed a commit to cloud-gov/OpenSearch-Dashboards that referenced this pull request Mar 9, 2026
…ch-project#11387)

* add agent_traces plugin similar to explore

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add explore.agentTraces.enabled feature flag

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* copy explore plugin as agent_traces plugin

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add plugin entry files with dynamic feature flag

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add agent_traces page

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Changeset file for PR opensearch-project#11387 created/updated

* fix lint

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* update table styles

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* feat: add copy button to parent span field in detail panel

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* feat: add hover tooltip to timeline gantt bars

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* refactor: use EuiBadge for span category badges and expand categorization

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* address comments

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* show token acount when input or output tokens is missing

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Agent Traces: Agent Observability for OpenSearch Dashboards

5 participants