Skip to content

[Search]Add custom telemetry events#265310

Merged
efegurkan merged 9 commits into
elastic:mainfrom
efegurkan:ebt-audit-custom-events
Apr 28, 2026
Merged

[Search]Add custom telemetry events#265310
efegurkan merged 9 commits into
elastic:mainfrom
efegurkan:ebt-audit-custom-events

Conversation

@efegurkan
Copy link
Copy Markdown
Member

@efegurkan efegurkan commented Apr 23, 2026

Summary

Adds a bunch of custom events for EBT on Search.

Created by Claude instructed by @efegurkan

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • 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.

Comment thread x-pack/platform/plugins/shared/search_inference_endpoints/public/application.tsx Outdated
@efegurkan efegurkan added release_note:skip Skip the PR/issue when compiling release notes Team:Search backport:all-open Backport to all branches that could still receive a release labels Apr 23, 2026
@efegurkan efegurkan marked this pull request as ready for review April 23, 2026 15:43
@efegurkan efegurkan requested a review from a team as a code owner April 23, 2026 15:43
@efegurkan efegurkan changed the title Add custom events for EBT [Search]Add custom telemetry events Apr 23, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 23, 2026

Approvability

Verdict: Needs human review

This PR adds telemetry event tracking across search plugins - straightforward instrumentation that doesn't change business logic. However, the author does not own any of the modified files (all owned by @elastic/search-kibana), and there are unresolved reviewer comments about implementation details that the designated code owners should address.

You can customize Macroscope's approvability policy. Learn more.

@efegurkan
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@efegurkan efegurkan requested a review from a team as a code owner April 24, 2026 15:21
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 24, 2026

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] affected Scout: [ observability / observability ] plugin / local-serverless-observability_complete - Observability Landing Page - redirects to page specified in defaultRoute uiSetting
  • [job] [logs] Jest Tests #1 / ModelSettings renders loading spinner when loading
  • [job] [logs] Jest Tests #1 / ModelSettings renders loading spinner when loading
  • [job] [logs] Jest Tests #1 / ModelSettings renders page header and sections when loaded
  • [job] [logs] Jest Tests #1 / ModelSettings renders page header and sections when loaded
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should disable delete action for preconfigured endpoints in grouped tables
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should disable delete action for preconfigured endpoints in grouped tables
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should display accordions with tables for model groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should display accordions with tables for model groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should enable delete action for user-defined endpoints in grouped tables
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should enable delete action for user-defined endpoints in grouped tables
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should have expected endpoint table columns
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should have expected endpoint table columns
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should show empty prompt when search removes all groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should show empty prompt when search removes all groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should show expected group labels and endpoint counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by models should show expected group labels and endpoint counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should display all inference ids in the table
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should display all inference ids in the table
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should display all service providers and model ids in the table
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should display all service providers and model ids in the table
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should not disable delete action for other endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should not disable delete action for other endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should only disable delete action for preconfigured endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should only disable delete action for preconfigured endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should show preconfigured badge only for preconfigured endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should show preconfigured badge only for preconfigured endpoints
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should show tech preview badge only for reranker-v1 model, multilingual-embed-v1, rerank-v1, and preconfigured elser_model_2
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by none should show tech preview badge only for reranker-v1 model, multilingual-embed-v1, rerank-v1, and preconfigured elser_model_2
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should display accordions with tables for service groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should display accordions with tables for service groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should have expected endpoint table columns
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should have expected endpoint table columns
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should show empty prompt when search removes all groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should show empty prompt when search removes all groups
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should show expected group labels and endpoint counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded group by service should show expected group labels and endpoint counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded should display endpoint stats with correct counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded should display endpoint stats with correct counts
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded should show the correct task type badge for each endpoint
  • [job] [logs] Jest Tests #1 / When the tabular page is loaded should show the correct task type badge for each endpoint

History

@efegurkan
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

Comment on lines +34 to +40
export const useUsageTracker = () => {
const ctx = useContext(UsageTrackerContext);
if (!ctx) {
throw new Error('UsageTrackerContext should be used inside of the UsageTrackerContextProvider');
}
return ctx;
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low contexts/usage_tracker_context.tsx:34

The check if (!ctx) in useUsageTracker will never throw because UsageTrackerContext is created with a default value (createEmptyUsageTracker()). When useContext is called outside a provider, it returns that default value — a truthy object — so ctx is never falsy. The safeguard silently succeeds with the empty tracker instead of alerting developers.

-export const useUsageTracker = () => {
-  const ctx = useContext(UsageTrackerContext);
-  if (!ctx) {
-    throw new Error('UsageTrackerContext should be used inside of the UsageTrackerContextProvider');
-  }
-  return ctx;
-};
🤖 Copy this AI Prompt to have your agent fix this:
In file x-pack/platform/plugins/shared/search_inference_endpoints/public/contexts/usage_tracker_context.tsx around lines 34-40:

The check `if (!ctx)` in `useUsageTracker` will never throw because `UsageTrackerContext` is created with a default value (`createEmptyUsageTracker()`). When `useContext` is called outside a provider, it returns that default value — a truthy object — so `ctx` is never falsy. The safeguard silently succeeds with the empty tracker instead of alerting developers.

Evidence trail:
x-pack/platform/plugins/shared/search_inference_endpoints/public/contexts/usage_tracker_context.tsx lines 17, 33-38: Context created with `createEmptyUsageTracker()` as default value, and `useUsageTracker` checks `if (!ctx)` which can never be falsy.

x-pack/platform/plugins/shared/search_inference_endpoints/public/usage_tracker.ts lines 37-41: `createEmptyUsageTracker` returns a truthy object `{ click: ..., count: ..., load: ... }`.

Comment on lines +8 to +22
export enum EventType {
ENDPOINT_CREATED = 'searchInferenceEndpoints_endpoint_created',
ENDPOINT_EDITED = 'searchInferenceEndpoints_endpoint_edited',
DEFAULT_MODEL_CHANGED = 'searchInferenceEndpoints_default_model_changed',
FEATURE_SETTINGS_SAVED = 'searchInferenceEndpoints_feature_settings_saved',
FILTER_APPLIED = 'searchInferenceEndpoints_filter_applied',
GROUP_BY_CHANGED = 'searchInferenceEndpoints_group_by_changed',
EMPTY_STATE_VIEWED = 'searchInferenceEndpoints_empty_state_viewed',
FLYOUT_OPENED = 'searchInferenceEndpoints_flyout_opened',
FLYOUT_CLOSED = 'searchInferenceEndpoints_flyout_closed',
MODAL_OPENED = 'searchInferenceEndpoints_modal_opened',
MODAL_CLOSED = 'searchInferenceEndpoints_modal_closed',
EIS_MODEL_VIEWED = 'searchInferenceEndpoints_eis_model_viewed',
COPY_TO_FEATURE_TOGGLED = 'searchInferenceEndpoints_copy_to_feature_toggled',
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These events include a prefix, but the other plugin events don't. Is it worth aligning them so they either all have a prefix or none do?

);

const handleCloseModal = useCallback(() => {
usageTracker.count(EventType.MODAL_CLOSED);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this track whether it's an add or edit modal being closed?

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.

good point

}) => {
const usageTracker = useUsageTracker();
useEffect(() => {
usageTracker.count(EventType.EMPTY_STATE_VIEWED);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this use load() since is this is tracking a view, not an action?

const usageTracker = useUsageTracker();

useEffect(() => {
usageTracker.count([EventType.EIS_MODEL_VIEWED, `${EventType.EIS_MODEL_VIEWED}_${modelId}`]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this use load() since is this is tracking a view, not an action?

Copy link
Copy Markdown
Contributor

@seialkali seialkali left a comment

Choose a reason for hiding this comment

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

LTGM!

@efegurkan efegurkan enabled auto-merge (squash) April 28, 2026 10:25
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
searchGettingStarted 270 271 +1
searchHomepage 270 271 +1
searchInferenceEndpoints 236 239 +3
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
searchGettingStarted 216.0KB 216.4KB +329.0B
searchHomepage 74.1KB 74.9KB +753.0B
searchInferenceEndpoints 215.8KB 218.8KB +2.9KB
total +4.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
searchGettingStarted 6.4KB 6.4KB -1.0B
searchInferenceEndpoints 8.6KB 8.7KB +64.0B
total +63.0B

History

@efegurkan efegurkan merged commit b701678 into elastic:main Apr 28, 2026
20 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3, 9.4

https://github.com/elastic/kibana/actions/runs/25049422553

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts
9.3 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.3:
- [HTTP] Safer client calls and new browser buildPath utility (#257230)
9.4 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.4:
- refactor(search): updates copy for getting started elasti ai agent (#265597)
- [Search] Getting Started UX clean-up (#262634)
- [Inference UI] Add scout tests for feature settings page (#261790)

Manual backport

To create the backport manually run:

node scripts/backport --pr 265310

Questions ?

Please refer to the Backport tool documentation

smith pushed a commit to smith/kibana that referenced this pull request Apr 28, 2026
## Summary

Adds a bunch of custom events for EBT on Search.

Created by Claude instructed by @efegurkan

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 29, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

8 similar comments
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 265310 locally
cc: @efegurkan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release backport missing Added to PRs automatically when the are determined to be missing a backport. release_note:skip Skip the PR/issue when compiling release notes Team:Search v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants