Skip to content

Comments

[Obs AI] Extend get_services tool and add get_trace_metrics tool#247474

Merged
viduni94 merged 40 commits intoelastic:mainfrom
viduni94:red-metrics-tool
Jan 8, 2026
Merged

[Obs AI] Extend get_services tool and add get_trace_metrics tool#247474
viduni94 merged 40 commits intoelastic:mainfrom
viduni94:red-metrics-tool

Conversation

@viduni94
Copy link
Contributor

@viduni94 viduni94 commented Dec 24, 2025

Closes https://github.com/elastic/obs-ai-team/issues/427
Closes https://github.com/elastic/obs-ai-team/issues/409

Summary

This PR includes the following changes

  1. Extend the get_services tool to retrieve services from logs and metrics.
  2. Adds a new tool to retrieve RED metrics for services - get_trace_metrics
  3. Allows drilling down into a particular service for further investigation

Differences between the 2 tools:

Tool get_services get_trace_metrics
Purpose High-level overview of all services Detailed drill-down into specific services
Data Sources APM, Logs, and Metrics APM only (RED/trace metrics can be obtained only for APM services)
Filtering By environment, health status By KQL filter (any field)
Grouping Fixed (by service) Flexible (by transaction, host, container, etc.)
Transaction Types Includes only the primary transaction type (the transaction type with the higher throughput) Includes all transaction types

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Cursor + Claude-4.5-Opus-High was used in this PR

@viduni94 viduni94 self-assigned this Dec 24, 2025
@viduni94 viduni94 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:obs-ai Observability AI team v9.4.0 labels Dec 24, 2025
@viduni94
Copy link
Contributor Author

/ci

@viduni94
Copy link
Contributor Author

/ci

@viduni94 viduni94 changed the title [Obs AI] Add get RED metrics tool [Obs AI] Extend get_services tool and addget_red_metrics tool Dec 29, 2025
@viduni94 viduni94 changed the title [Obs AI] Extend get_services tool and addget_red_metrics tool [Obs AI] Extend get_services tool and add get_red_metrics tool Dec 29, 2025
@viduni94
Copy link
Contributor Author

/ci

@viduni94
Copy link
Contributor Author

/ci

@viduni94 viduni94 marked this pull request as ready for review December 29, 2025 20:15
@viduni94 viduni94 requested review from a team as code owners December 29, 2025 20:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ai-team (Team:obs-ai)

@botelastic botelastic bot added the Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation label Dec 29, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-presentation-team (Team:obs-presentation)

@viduni94 viduni94 requested review from a team as code owners January 7, 2026 16:44
@viduni94
Copy link
Contributor Author

viduni94 commented Jan 7, 2026

/oblt-deploy

@arturoliduena
Copy link
Contributor

The flaky test in serverless is related to get_log_change_points tool.
Related issue - #247819

The flaky test has been fixed. I will run the Flaky test runner again.

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#10343

[✅] x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/stateful/oblt.ai_agent.stateful.config.ts: 25/25 tests passed.
[✅] x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/serverless/oblt.ai_agent.serverless.config.ts: 25/25 tests passed.

see run history

@viduni94 viduni94 enabled auto-merge (squash) January 7, 2026 21:02
return getAgentBuilderResourceAvailability({ core, request, logger });
},
},
handler: async ({ start, end, kqlFilter, groupBy }, context) => {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps groupBy should default to SERVICE_NAME at top level (here). Then you can type it as required everywhere

Suggested change
handler: async ({ start, end, kqlFilter, groupBy }, context) => {
handler: async ({ start, end, kqlFilter, groupBy = SERVICE_NAME }, context) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That still won't handle the empty string for groupBy yeah? If an empty string is passed from the UI

#247474 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

That still won't handle the empty string for groupBy yeah? If an empty string is passed from the UI

An empty string is something we can either disallow or handle at the top level as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added const groupByField = groupBy || 'service.name'; at the top level.

@viduni94 viduni94 disabled auto-merge January 7, 2026 21:59
@viduni94 viduni94 enabled auto-merge (squash) January 7, 2026 23:00
@viduni94 viduni94 merged commit c8f30f8 into elastic:main Jan 8, 2026
13 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #18 / Alerting bulkMuteUnmute bulk mute should mute multiple alert instances for a single rule
  • [job] [logs] Scout: [ security / security_solution ] plugin / enables risk score followed by the store
  • [job] [logs] Scout: [ security / security_solution ] plugin / serverless-security - Entity analytics dashboard page - enables risk score followed by the store

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/synthtrace 147 168 +21
Unknown metric groups

API count

id before after diff
@kbn/synthtrace 157 185 +28

History

cc @viduni94

devamanv pushed a commit to devamanv/kibana that referenced this pull request Jan 12, 2026
…lastic#247474)

Closes elastic/obs-ai-team#427
Closes elastic/obs-ai-team#409

## Summary

This PR includes the following changes

1. Extend the `get_services` tool to retrieve services from logs and
metrics.
2. Adds a new tool to retrieve RED metrics for services -
`get_trace_metrics`
3. Allows drilling down into a particular service for further
investigation

Differences between the 2 tools:

Tool | get_services | get_trace_metrics
-- | -- | --
Purpose | High-level overview of all services | Detailed drill-down
into specific services
Data Sources | APM, Logs, and Metrics | APM only (RED/trace metrics can
be obtained only for APM services)
Filtering | By environment, health status | By KQL filter (any field)
Grouping | Fixed (by service) | Flexible (by transaction, host,
container, etc.)
Transaction Types | Includes only the primary transaction type (the
transaction type with the higher throughput) | Includes all transaction
types

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

_Cursor + Claude-4.5-Opus-High was used in this PR_

---------

Co-authored-by: Arturo Lidueña <arturo.liduena@elastic.co>
viduni94 added a commit that referenced this pull request Jan 13, 2026
…#248513)

Closes elastic/obs-ai-team#452

## Summary

This PR moves the trace metrics implementation from the APM plugin to
the Observability Agent Builder plugin.
- The reason for this change is to keep all the tool implementations
within the Observability Agent Builder plugin.
(The trace metrics implementation was originally included in the APM
plugin as it used some helpers defined in the APM plugin)

### Changes
- The trace metrics implementation was removed from the APM plugin and
moved to the Observability Agent Builder plugin
- Helpers used to calculate trace metrics that were located in the APM
plugin were moved to the `apm-data-access` plugin (The Observability
Agent Builder plugin already depends on the `apm-data-access` plugin)

Helpers that were moved from the APM plugin to the `apm-data-access`
plugin:
- `calculateThroughputWithRange`
- `getOutcomeAggregation`
- `calculateFailedTransactionRate`
- `getDurationFieldForTransactions`
- `isSummaryFieldSupportedByDocType`
- `getHasTransactionsEvents`

Additionally, `getRollupIntervalForTimeRange` helper that was defined in
the Observability Agent Builder plugin was also moved to the
`apm-data-access` plugin. (See
[comment](#247474 (comment)))

### Checklist

- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@sorenlouv
Copy link
Member

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

sorenlouv pushed a commit to sorenlouv/kibana that referenced this pull request Jan 14, 2026
…lastic#247474)

Closes elastic/obs-ai-team#427
Closes elastic/obs-ai-team#409

This PR includes the following changes

1. Extend the `get_services` tool to retrieve services from logs and
metrics.
2. Adds a new tool to retrieve RED metrics for services -
`get_trace_metrics`
3. Allows drilling down into a particular service for further
investigation

Differences between the 2 tools:

Tool | get_services | get_trace_metrics
-- | -- | --
Purpose | High-level overview of all services | Detailed drill-down
into specific services
Data Sources | APM, Logs, and Metrics | APM only (RED/trace metrics can
be obtained only for APM services)
Filtering | By environment, health status | By KQL filter (any field)
Grouping | Fixed (by service) | Flexible (by transaction, host,
container, etc.)
Transaction Types | Includes only the primary transaction type (the
transaction type with the higher throughput) | Includes all transaction
types

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

_Cursor + Claude-4.5-Opus-High was used in this PR_

---------

Co-authored-by: Arturo Lidueña <arturo.liduena@elastic.co>
(cherry picked from commit c8f30f8)
sorenlouv added a commit that referenced this pull request Jan 16, 2026
… tool (#247474) | [Obs AI] Replace `get_data_sources` with `get_index_info` tool (#248234) (#249116)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Obs AI] Extend `get_services` tool and add `get_trace_metrics` tool
(#247474)](#247474)
- [[Obs AI] Replace `get_data_sources` with `get_index_info` tool
(#248234)](#248234)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Viduni
Wickramarachchi","email":"viduni.wickramarachchi@elastic.co"},"sourceCommit":{"committedDate":"2026-01-08T00:55:54Z","message":"[Obs
AI] Extend `get_services` tool and add `get_trace_metrics` tool
(#247474)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/427\nCloses
https://github.com/elastic/obs-ai-team/issues/409\n\n## Summary\n\nThis
PR includes the following changes\n\n1. Extend the `get_services` tool
to retrieve services from logs and\nmetrics.\n2. Adds a new tool to
retrieve RED metrics for services -\n`get_trace_metrics`\n3. Allows
drilling down into a particular service for
further\ninvestigation\n\nDifferences between the 2 tools:\n\nTool |
get_services | get_trace_metrics\n-- | -- | --\nPurpose | High-level
overview of all services | Detailed drill-down\ninto specific
services\nData Sources | APM, Logs, and Metrics | APM only (RED/trace
metrics can\nbe obtained only for APM services)\nFiltering |
By environment, health status | By KQL filter (any field)\nGrouping |
Fixed (by service) | Flexible (by transaction, host,\ncontainer,
etc.)\nTransaction Types | Includes only the primary transaction type
(the\ntransaction type with the higher throughput) | Includes all
transaction\ntypes\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n_Cursor + Claude-4.5-Opus-High
was used in this PR_\n\n---------\n\nCo-authored-by: Arturo Lidueña
<arturo.liduena@elastic.co>","sha":"c8f30f8add706ecc1ae81a4f4aa97cb25e6035ac","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","Team:obs-ai","v9.4.0","Team:obs-presentation"],"title":"[Obs
AI] Extend `get_services` tool and add `get_trace_metrics`
tool","number":247474,"url":"https://github.com/elastic/kibana/pull/247474","mergeCommit":{"message":"[Obs
AI] Extend `get_services` tool and add `get_trace_metrics` tool
(#247474)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/427\nCloses
https://github.com/elastic/obs-ai-team/issues/409\n\n## Summary\n\nThis
PR includes the following changes\n\n1. Extend the `get_services` tool
to retrieve services from logs and\nmetrics.\n2. Adds a new tool to
retrieve RED metrics for services -\n`get_trace_metrics`\n3. Allows
drilling down into a particular service for
further\ninvestigation\n\nDifferences between the 2 tools:\n\nTool |
get_services | get_trace_metrics\n-- | -- | --\nPurpose | High-level
overview of all services | Detailed drill-down\ninto specific
services\nData Sources | APM, Logs, and Metrics | APM only (RED/trace
metrics can\nbe obtained only for APM services)\nFiltering |
By environment, health status | By KQL filter (any field)\nGrouping |
Fixed (by service) | Flexible (by transaction, host,\ncontainer,
etc.)\nTransaction Types | Includes only the primary transaction type
(the\ntransaction type with the higher throughput) | Includes all
transaction\ntypes\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n_Cursor + Claude-4.5-Opus-High
was used in this PR_\n\n---------\n\nCo-authored-by: Arturo Lidueña
<arturo.liduena@elastic.co>","sha":"c8f30f8add706ecc1ae81a4f4aa97cb25e6035ac"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247474","number":247474,"mergeCommit":{"message":"[Obs
AI] Extend `get_services` tool and add `get_trace_metrics` tool
(#247474)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/427\nCloses
https://github.com/elastic/obs-ai-team/issues/409\n\n## Summary\n\nThis
PR includes the following changes\n\n1. Extend the `get_services` tool
to retrieve services from logs and\nmetrics.\n2. Adds a new tool to
retrieve RED metrics for services -\n`get_trace_metrics`\n3. Allows
drilling down into a particular service for
further\ninvestigation\n\nDifferences between the 2 tools:\n\nTool |
get_services | get_trace_metrics\n-- | -- | --\nPurpose | High-level
overview of all services | Detailed drill-down\ninto specific
services\nData Sources | APM, Logs, and Metrics | APM only (RED/trace
metrics can\nbe obtained only for APM services)\nFiltering |
By environment, health status | By KQL filter (any field)\nGrouping |
Fixed (by service) | Flexible (by transaction, host,\ncontainer,
etc.)\nTransaction Types | Includes only the primary transaction type
(the\ntransaction type with the higher throughput) | Includes all
transaction\ntypes\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n_Cursor + Claude-4.5-Opus-High
was used in this PR_\n\n---------\n\nCo-authored-by: Arturo Lidueña
<arturo.liduena@elastic.co>","sha":"c8f30f8add706ecc1ae81a4f4aa97cb25e6035ac"}}]},{"author":{"name":"Søren
Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2026-01-14T22:16:47Z","message":"[Obs
AI] Replace `get_data_sources` with `get_index_info` tool
(#248234)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/455\n\nThis PR introduces
the `get_index_info` tool which replaces\n`get_data_sources` and adds
field discovery capabilities. This is\nsimilar to the `get_dataset_info`
tool we have for Obs AI Assistant.\n\n### What it does\n\nThe tool has
three operations:\n\n**`get_index_info({ operation: \"get-overview\"
})`**\nReturns the same data sources as `get_data_sources` (APM indices,
logs,\nmetrics, alerts) plus a list of curated observability fields that
exist\nin the cluster. Each field includes a `schema` indicator (`ecs`,
`otel`,\nor `internal`).\n\n**`get_index_info({ operation:
\"list-fields\", index, start?, end?,\nkqlFilter?, intent?
})`**\nReturns fields with actual data. If the LLM specifies an `intent`
and\nthere are >100 fields, we filter them using a model to just the
relevant\nones.\n\n**`get_index_info({ operation: \"get-field-values\",
index, fields })`**\nReturns field values:\n- Distinct values for
keyword fields\n- Min/max ranges for numeric and date fields\n\n###
Purpose of tool\n\nThe LLM needs to know what fields exist in the user's
cluster before\nbuilding queries. Without this, it guesses field names
which leads to\ninvalid filters and confusing errors. This is especially
important\nbecause customers can use different schemas (ECS vs
OTel).\n\n\n## Manual testing\n\nRun the synthtrace scenario to populate
observability indices with test\ndata:\n\n```bash\nnode
scripts/synthtrace \\\n
src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/tools/get_index_info/curated_fields.ts
\\\n --from \"now-15m\" --to \"now\" --clean --workers=1\n```\n\n###
Execute tool to get overview\n\n```\nPOST
kbn:///api/agent_builder/tools/_execute\n{\n \"tool_id\":
\"observability.get_index_info\",\n \"tool_params\": { \"operation\":
\"get-overview\" }\n}\n```\n\n\n### Execute tool to get field
values\n\n```\nPOST kbn:///api/agent_builder/tools/_execute\n{\n
\"tool_id\": \"observability.get_index_info\",\n \"tool_params\": {
\"operation\": \"get-field-values\", \"index\": \"metrics-*\",
\"fields\": \"host.name\"
}\n}\n```","sha":"b6be8eb281bd6371e150f6cb79e6651066ccf865","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.3.0","v9.4.0","Team:obs-presentation"],"title":"[Obs
AI] Replace `get_data_sources` with `get_index_info`
tool","number":248234,"url":"https://github.com/elastic/kibana/pull/248234","mergeCommit":{"message":"[Obs
AI] Replace `get_data_sources` with `get_index_info` tool
(#248234)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/455\n\nThis PR introduces
the `get_index_info` tool which replaces\n`get_data_sources` and adds
field discovery capabilities. This is\nsimilar to the `get_dataset_info`
tool we have for Obs AI Assistant.\n\n### What it does\n\nThe tool has
three operations:\n\n**`get_index_info({ operation: \"get-overview\"
})`**\nReturns the same data sources as `get_data_sources` (APM indices,
logs,\nmetrics, alerts) plus a list of curated observability fields that
exist\nin the cluster. Each field includes a `schema` indicator (`ecs`,
`otel`,\nor `internal`).\n\n**`get_index_info({ operation:
\"list-fields\", index, start?, end?,\nkqlFilter?, intent?
})`**\nReturns fields with actual data. If the LLM specifies an `intent`
and\nthere are >100 fields, we filter them using a model to just the
relevant\nones.\n\n**`get_index_info({ operation: \"get-field-values\",
index, fields })`**\nReturns field values:\n- Distinct values for
keyword fields\n- Min/max ranges for numeric and date fields\n\n###
Purpose of tool\n\nThe LLM needs to know what fields exist in the user's
cluster before\nbuilding queries. Without this, it guesses field names
which leads to\ninvalid filters and confusing errors. This is especially
important\nbecause customers can use different schemas (ECS vs
OTel).\n\n\n## Manual testing\n\nRun the synthtrace scenario to populate
observability indices with test\ndata:\n\n```bash\nnode
scripts/synthtrace \\\n
src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/tools/get_index_info/curated_fields.ts
\\\n --from \"now-15m\" --to \"now\" --clean --workers=1\n```\n\n###
Execute tool to get overview\n\n```\nPOST
kbn:///api/agent_builder/tools/_execute\n{\n \"tool_id\":
\"observability.get_index_info\",\n \"tool_params\": { \"operation\":
\"get-overview\" }\n}\n```\n\n\n### Execute tool to get field
values\n\n```\nPOST kbn:///api/agent_builder/tools/_execute\n{\n
\"tool_id\": \"observability.get_index_info\",\n \"tool_params\": {
\"operation\": \"get-field-values\", \"index\": \"metrics-*\",
\"fields\": \"host.name\"
}\n}\n```","sha":"b6be8eb281bd6371e150f6cb79e6651066ccf865"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248234","number":248234,"mergeCommit":{"message":"[Obs
AI] Replace `get_data_sources` with `get_index_info` tool
(#248234)\n\nCloses
https://github.com/elastic/obs-ai-team/issues/455\n\nThis PR introduces
the `get_index_info` tool which replaces\n`get_data_sources` and adds
field discovery capabilities. This is\nsimilar to the `get_dataset_info`
tool we have for Obs AI Assistant.\n\n### What it does\n\nThe tool has
three operations:\n\n**`get_index_info({ operation: \"get-overview\"
})`**\nReturns the same data sources as `get_data_sources` (APM indices,
logs,\nmetrics, alerts) plus a list of curated observability fields that
exist\nin the cluster. Each field includes a `schema` indicator (`ecs`,
`otel`,\nor `internal`).\n\n**`get_index_info({ operation:
\"list-fields\", index, start?, end?,\nkqlFilter?, intent?
})`**\nReturns fields with actual data. If the LLM specifies an `intent`
and\nthere are >100 fields, we filter them using a model to just the
relevant\nones.\n\n**`get_index_info({ operation: \"get-field-values\",
index, fields })`**\nReturns field values:\n- Distinct values for
keyword fields\n- Min/max ranges for numeric and date fields\n\n###
Purpose of tool\n\nThe LLM needs to know what fields exist in the user's
cluster before\nbuilding queries. Without this, it guesses field names
which leads to\ninvalid filters and confusing errors. This is especially
important\nbecause customers can use different schemas (ECS vs
OTel).\n\n\n## Manual testing\n\nRun the synthtrace scenario to populate
observability indices with test\ndata:\n\n```bash\nnode
scripts/synthtrace \\\n
src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/tools/get_index_info/curated_fields.ts
\\\n --from \"now-15m\" --to \"now\" --clean --workers=1\n```\n\n###
Execute tool to get overview\n\n```\nPOST
kbn:///api/agent_builder/tools/_execute\n{\n \"tool_id\":
\"observability.get_index_info\",\n \"tool_params\": { \"operation\":
\"get-overview\" }\n}\n```\n\n\n### Execute tool to get field
values\n\n```\nPOST kbn:///api/agent_builder/tools/_execute\n{\n
\"tool_id\": \"observability.get_index_info\",\n \"tool_params\": {
\"operation\": \"get-field-values\", \"index\": \"metrics-*\",
\"fields\": \"host.name\"
}\n}\n```","sha":"b6be8eb281bd6371e150f6cb79e6651066ccf865"}}]}]
BACKPORT-->

---------

Co-authored-by: Viduni Wickramarachchi <viduni.wickramarachchi@elastic.co>
Co-authored-by: Arturo Lidueña <arturo.liduena@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
smith pushed a commit to smith/kibana that referenced this pull request Jan 16, 2026
…elastic#248513)

Closes elastic/obs-ai-team#452

## Summary

This PR moves the trace metrics implementation from the APM plugin to
the Observability Agent Builder plugin.
- The reason for this change is to keep all the tool implementations
within the Observability Agent Builder plugin.
(The trace metrics implementation was originally included in the APM
plugin as it used some helpers defined in the APM plugin)

### Changes
- The trace metrics implementation was removed from the APM plugin and
moved to the Observability Agent Builder plugin
- Helpers used to calculate trace metrics that were located in the APM
plugin were moved to the `apm-data-access` plugin (The Observability
Agent Builder plugin already depends on the `apm-data-access` plugin)

Helpers that were moved from the APM plugin to the `apm-data-access`
plugin:
- `calculateThroughputWithRange`
- `getOutcomeAggregation`
- `calculateFailedTransactionRate`
- `getDurationFieldForTransactions`
- `isSummaryFieldSupportedByDocType`
- `getHasTransactionsEvents`

Additionally, `getRollupIntervalForTimeRange` helper that was defined in
the Observability Agent Builder plugin was also moved to the
`apm-data-access` plugin. (See
[comment](elastic#247474 (comment)))

### Checklist

- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-ai Observability AI team Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.3.0 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants