Commit graph

573 commits

Author SHA1 Message Date
Sergi Romeu
5ac2d34cd8
[APM][Settings][Custom Links] Prevent unnecessary suggestion requests (#218927)
## Summary

Closes #190218

This PR aims to fix the multiple requests produced when interacting with
the custom links flyout, using `memo` and `useMemo` from React to
prevent rerenders and redundant api calls.


https://github.com/user-attachments/assets/f8b058cd-dc02-41ef-8389-809a006b8eda

## How to test
1. Start Kibana and run any synthtrace scenario
2. Go to APM -> Settings -> Custom Links
3. Play with the inputs, the calls should be made once per field (if you
already requested service.name, it will be cached, regardless of which
input you are using)
2025-04-24 14:18:14 +02:00
Marco Liberati
ef323daf52
[chore] Import common react-use methods in shared bundle (#218640)
## Summary

Similar to #217034, #217202 and #217467 this time applied to
`react-use`.

This is a slightly different approach than #217034 as we're caching here
only the most common/frequently used methods from the `react-use`
library and leaving the rest to be loaded within the specific plugin
chunks.

What this PR does it fundamentally:
* adds `7.x kb` to the shared bundle
* overall the startup bundle size shrinks about `3.5 kb`
* the async bundle size shrinks of about `350 kb` (mainly due to 3
imports which were targeting `react-use/lib`).

An alternative approach would be to just fix the async import strings in
there, but I thought to it was worth it to make the long step here.
Feedback appreciated.
2025-04-24 14:13:25 +02:00
Maryam Saeidi
2c736f4441
[Alert controls] Fix refreshing controls and remove extra loading of the alert table (#214612)
## Summary

This PR fixes:
1. refreshing controls when the alert search bar is refreshed
2. the extra initial loading of the alert table in the alerts page
(related to https://github.com/elastic/kibana/issues/183412)
2025-04-24 14:10:28 +02:00
Mykola Harmash
4629bae49b
[Oblt Onboarding] Expand e2e test coverage for k8s OTel flow (#217958)
Closes https://github.com/elastic/kibana/issues/207736

This change expands the current e2e ensemble test for K8S OTel flow to
also check application instrumentation. The test opens the APM service
inventory, finds and click on the instrumented application and checks
that at least one transaction is visible on the service details screen.

[🔒 Corresponding PR in Ensemble
repo](https://github.com/elastic/ensemble/pull/536).

> [!NOTE]
> This change needs to be merged and deployed on edge before we can
enable the test on Ensemble side because a couple of test IDs were added
to the UI

### How to test

1. Create a local K8S cluster (e.g. using minikube)
2. Add a java application to the cluster which later be instrumented
using these commands:
```
kubectl create namespace java
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: java-app
  name: java-app
  namespace: java
spec:
  replicas: 1
  selector:
    matchLabels:
      app: java-app
  template:
    metadata:
      labels:
        app: java-app
    spec:
      containers:
      - name: java-app
        image: docker.elastic.co/demos/apm/k8s-webhook-test
        env:
        - name: OTEL_INSTRUMENTATION_METHODS_INCLUDE
          value: "test.Testing[methodB]"
EOF
```
4. Run kibana locally and navigate to the K8S OTel flow
5. Run the Playwright test:
```
npx playwright test -c ./x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/playwright.config.ts --project stateful --reporter list --headed x-pack/solutions/observability/plugins/observability_onboarding/e2e/playwright/stateful/kubernetes_otel.spec.ts
```
6. Once the test pauses, go through the onboarding instructions,
including the instrumentation part (use `java-app` as application name
and `java` as the namespace in the instrumentation command)
7. Wait for the test to un-pause and continue
2025-04-24 10:45:44 +02:00
Marco Liberati
20ad78de1d
[chore] Add rule to avoid duplicate fp-ts imports (#218593)
## Summary

This PR is the counter part of
https://github.com/elastic/kibana/pull/217034 to avoid making the same
mistake again in the future.
2025-04-23 16:35:17 +02:00
Miriam
5669a50c0f
[ObsUX][A11y] Add aria-label for elements announcements (#218766)
Closes https://github.com/elastic/kibana/issues/212649

## Summary

Added aria-label and proper html tags (example <button>) for elements to
be properly announced to screen reader users.

Check https://github.com/elastic/kibana/issues/212649 for steps to
reproduce
2025-04-23 14:15:42 +01:00
Francesco Fagnani
17118d594e
[Synthetics] Disable use logical AND when filter is removed (#218910)
This PR fixes an issue found in #217985 



https://github.com/user-attachments/assets/3b995e0f-1b33-4740-99ca-29b3760c46da
2025-04-23 10:54:08 +02:00
Dario Gieselaar
dd7ed50d9b
[Inference] Run EIS locally (#215475)
1. Make sure you're connected to [Infra
Vault](https://docs.elastic.dev/vault/infra-vault/home) using oidc:
`$ VAULT_ADDR={...} vault login -method oidc`

2. Run the `eis` script:
`$ node scripts/eis.js`

2a. After it's started, run ES with:
`$ yarn es snapshot --license trial -E
xpack.inference.elastic.url=http://localhost:8443`
2b. The command will output credentials for a preconfigured EIS
connector. Paste it into kibana(.dev).yml.

3. Start Kibana as usual. 

4. Run:
`yarn run ts-node --transpile-only
x-pack/solutions/observability/packages/kbn-genai-cli/recipes/hello_world.ts`

This should output:

```
 ~/dev/kibana  eis-connector-cli *219  yarn run ts-node --transpile-only x-pack/solutions/observability/packages/kbn-genai-cli/recipes/hello_world.ts
yarn run v1.22.22
$ /Users/dariogieselaar/dev/kibana/node_modules/.bin/ts-node --transpile-only x-pack/solutions/observability/packages/kbn-genai-cli/recipes/hello_world.ts 
 info Discovered kibana running at: http://elastic:changeme@127.0.0.1:5601/kbn
 info {
        id: 'extract_personal_details',
        content: '',
        output: { name: 'Sarah', age: 29, city: 'San Francisco' }
      }
  Done in 5.47s.
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dima Arnautov <arnautov.dima@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-23 08:08:33 +02:00
Francesco Fagnani
061b93093e
[Synthetics] Add logical AND to monitor tags and locations filter (#217985) 2025-04-23 08:01:40 +02:00
Bailey Cash
2df2e78906
[SLO] Bulk Purge SLI data (#218287)
## Summary

Resolves #210025 

Introduces starter API for bulk purging of SLI data. 
**docs coming pending review**
Users can submit a list of SLO ids for which they would like to purge
rollup data, as well as a purge policy:

```
    "purgePolicy": {
        "purgeType": "fixed_age",
        "age": "1w"
    }
```

```
    "purgePolicy": {
        "purgeType": "fixed_time",
        "age": "2025-04-01T00:00:00Z"
    }
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-22 23:58:31 +02:00
Bailey Cash
6e67bf46a4
[SLO] Update user in audit trail for enable/disable slo (#218739)
## Summary

Update user when an SLO is enabled or disabled.
2025-04-22 23:41:25 +02:00
Chris Cowan
54ab27581b
[Data-Forge] Optimizing the event generation code (#218688)
## Summary

This PR refactors the `createEvents` function to improve the readability
the execution along with optimizations. Part of the refactor is to
remove the recursiveness to reduce the chances of "blowing the stack". I
also added a back-off feature to the queue so when it's saturated the
process will wait progressively longer until things improve. I also
changed the how the continuous "wait" works. If it falls too far behind,
it will index as fast as it can to catch up and vise-versa it will wait
longer if it get's too far ahead of the current time.

To test the back-off, run the following command. If you keep increasing
the events-per-cycle, eventually it will saturate the queue and start
backing off.

```
node x-pack/scripts/data_forge.js --dataset fake_hosts --lookback now-5m --events-per-cycle 10000 --index-interval 10000
```

This also includes an optimizations for the `fake_hosts` dataset. Before
this change, `randomBetween` would create arrays with all the possible
numbers then randomly sample them 🤮 (lazy programming). The new
implementation just calculates the random value between the min and max,
mods that number by the `step` argument, then subtracts the remainder to
bring the number down to the closes step. For example if you do
`randomBetween(0, 10, 5)` you will get either `0`, `5`, or `10`.

I also refactored how the network values so the counters for
`system.network.[in|out].bytes` match the
`host.network.[ingress|egress].bytes` gauges so if you where to compare
them on a Lens visualization, the values would match (as they should).

And last but not least... I added a new option `--slash-logs` that will
index this data directly to `logs` without installing index templates,
pipelines, or components. This is useful for testing the new Streams
feature. Use [the commands from this
Gist](https://gist.github.com/simianhacker/4116a6def82f1270722fef1366e3d422)
to enable and setup streams, then test with:

```
node x-pack/scripts/data_forge.js --dataset fake_stack --lookback now-5m --events-per-cycle 10 --index-interval 10000 --slash-logs
```
2025-04-22 09:26:02 -06:00
Milosz Marcinkowski
8caec69036
[APM][OTel] Fix span url link when transactionId missing in Span Links (#218232)
Closes #214557

### Summary

Use `traceId` to generate url link to Span as fallback when
`transactionId` is missing.

### How to test

1. Run the following synthtrace scenario: `node scripts/synthtrace
span_links.ts --live --uniqueIds --clean --logLevel=debug --scenarioOpts
pipeline=apmToOtel`
2. Go to **Service** -> **Transactions** -> in **Transaction waterfall**
click **Span Links** label -> select **Outgoing links** from downdown ->
check if **Span** link works


https://github.com/user-attachments/assets/c22fdc5e-7ba9-4817-a78b-bf5fb9a53651

---------

Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
2025-04-22 15:24:21 +02:00
Kevin Delemme
56b3e21fc3
chore(slo): cleanup route dependencies (#218619) 2025-04-22 09:20:36 -04:00
Justin Kambic
cc18709d01
[Observability] Make create annotations form keyboard navigable (#217918)
## Summary

Partially addresses #210531.

This doesn't fully fix the ticket linked, as elements that control the
annotation look in the second half of the form still trigger re-renders.
This means the focus will still be lost when those elements are
modified.

This is going to require significant refactoring of this form, but this
patch will at least make the elements reachable via tabbing.

The custom `onBlur` removed here doesn't seem to impact the form and the
rendering issues are prominent in any case.

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
2025-04-22 08:45:10 -04:00
Sergi Romeu
2dea36a0a6
[ObsUX][Infra] Filter out null values from sourceDataStreams (#218772)
## Summary

Part of #213045

This PR fixes an issue when the `observability:entityCentricExperience`
flag is enabled.
By some reason, we may get null values in `sourceDataStreams` and when
we try to validate it with the zod schema, it breaks.
2025-04-22 12:37:09 +02:00
Alexey Antonov
ff25581c34
fix: [Platform:Dashboards:DashboardEditMode] Observability embeddables get announced incorrectly (#217674)
Closes: #215689

**Description:**
When user clicks on add panel and then selects any of the observability
embeddable panels (SLO burn rate, SLO Overview, SLO Alerts, SLO Error
budget, Monitors overview, Monitors stats), Kibana announces them as
"you are in a modal dialog. Press escape or tap click outside the
dialog....This doesn't give non-sighted user context about the add panel
action they are trying to execute.

**Changes Made:**
1. Added `aria-labelledby={flyoutTitleId}` for mentioned places
2025-04-22 12:34:29 +02:00
Francesco Fagnani
b936b4719e
[Synthetics] When changing condition type of a monitor status rule other conditions are not changed (#216426)
This PR closes #197786 .



https://github.com/user-attachments/assets/85c92b09-f477-4e42-9fb7-a8143876e079
2025-04-22 10:21:48 +02:00
Francesco Fagnani
af381920ee
[Synthetics] Fixed monitor history histogram and group by location issue (#218550)
This PR closes #217105 and closes #217118 



https://github.com/user-attachments/assets/4426c5bc-dfda-483c-a974-3a3d6832d6c7

---------

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
2025-04-22 09:28:35 +02:00
Christiane (Tina) Heiligers
1fe09dcff4
RenamesrenderReactTestingLibraryWithI18n to renderWithI18n (#218371)
## Summary

This PR only renames the helper, no test implementations were changed.

Why now?

Migrating tests from Enzyme to RTL means that all usage of
`mountWithIntl` has to change and will likely be replaced by the helper
that wraps RTL render with I18n. [A shorter name improves devEx](url).

ATM, consumption is limited to a few tests, reducing the number of
codeowner reviews required.

### Identify risks

- [x] In progress work and open PRs might fail. Updating from main will
prompt an undefined function that will need to be renamed.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-21 10:21:59 +03:00
Sergi Romeu
36c495c9f0
[ObsUX][Infra] Fix broken storybook stories (#218090)
## Summary

Closes #218063

This PR fixes the broken storybook stories we have for Infra.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-18 18:54:14 +02:00
Yuliia Naumenko
221c199ed1
[Search Connectors][Serverless] Add Search Connectors UI to the Stack Management data Section (#213509)
**!!MAJORITY OF THE CHANGED FILES ARE MOVED OR COPIED!!**

### Vision

According to the product vision we will build a new simple UI/UX in the
future https://github.com/elastic/security-team/issues/11790

This PR is a first iteration on enabling Content Connectors Management
UI in Serverless Kibana Stack Management.
Elastic Managed content connectors will be available only for Security
and Observability projects.
### Current PR scope

1. Used initial search_connectors plugin and renamed it to
content_connectors + moved from `x-pack/solutions/search` to
`x-pack/platform/plugins/shared`
2. Copy relevant connectors UI and routes from enterprise_search plugin.
3. Introduce the new Stack Management card/navigation option under the
Data section.
4. Enabled this plugin only in Serverless for Security and Observability
projects.
5. For making PR smaller Pipelines tab was not moved. And according to
Search team vision this functionality should be dropped anyway soon.
6. Extended fleet package logic to include elastic_connectors for
security and o11y serverless projects
7. Added back `search:agentless-connectors-manager` task

In Stack Management navigation:
<img width="2062" alt="Screenshot 2025-04-15 at 3 51 43 PM"
src="https://github.com/user-attachments/assets/5c93ba01-9a6a-4eac-a21d-1370f03b8f35"
/>

Stack Management cards:
<img width="2081" alt="Screenshot 2025-04-10 at 8 41 43 PM"
src="https://github.com/user-attachments/assets/3def1c12-561b-4a84-8241-4dd61cd9313d"
/>


Create Elastic Managed Connector UI (on Agentless):

<img width="1822" alt="Screenshot 2025-04-15 at 3 55 29 PM"
src="https://github.com/user-attachments/assets/6e9fea48-85e7-43df-919d-0e5492d0e704"
/>

Create Self Managed Connector UI:

<img width="2064" alt="Screenshot 2025-04-15 at 3 55 49 PM"
src="https://github.com/user-attachments/assets/d5051898-c8fa-4e41-b9ea-b41d4ed4a0d5"
/>

### Next steps

- [ ] Remove duplicated code between content_connectors,
enterprise_search and serverless_search
- [ ] Extract [common server
libs](https://github.com/elastic/kibana/tree/main/x-pack/solutions/search/plugins/enterprise_search/server/lib)
to the shared package `kbn-search-connectors`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Artem Shelkovnikov <artem.shelkovnikov@elastic.co>
Co-authored-by: Artem Shelkovnikov <lavatroublebubble@gmail.com>
Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
2025-04-18 04:50:56 +02:00
Cauê Marcondes
822aef361c
[APM]Embeddable Trace Waterfall Enhancements (#217679)
For the embeddable waterfall to be successful, we want to remove
unnecessary information and be able to select which records should be
displayed.

We need to remove:
- Accordions
- Services Legend

We want to display (or hide anything that isn't):
- root,
- direct parent,
- current span or transaction (highlighted)
- up to 2 children.
- Errors will be represented with an icon in the embeddable form of the
waterfall and the badge in the regular form


https://github.com/user-attachments/assets/bf8d34d7-173c-4a1a-8ccf-2f98f43fc625

## Using the embeddable:

1: Loads standard trace waterfall (like the one on APM UI)
```
<ReactEmbeddableRenderer
    type="APM_TRACE_WATERFALL_EMBEDDABLE"
    getParentApi={() => ({
      getSerializedStateForChild: () => ({
        rawState: {
          serviceName: 'foo',
          traceId: 'e7b9d541fae0e25106291f7ac0947acd',
          entryTransactionId: '2d94d9d4fda31c18',
          rangeFrom: '2025-03-26T00:00:00.513Z',
          rangeTo: '2025-03-26T20:52:42.513Z',
          displayLimit: 5, //optional param when omitted it renders the entire waterfall
        },
      }),
    })}
    hidePanelChrome={true}
  />
```

2: Loads focused trace waterfall (some trace events are hidden and a
summary is available)
```
<ReactEmbeddableRenderer
    type="APM_TRACE_WATERFALL_EMBEDDABLE"
    getParentApi={() => ({
      getSerializedStateForChild: () => ({
        rawState: {
          traceId: 'e7b9d541fae0e25106291f7ac0947acd',
          rangeFrom: '2025-03-26T00:00:00.513Z',
          rangeTo: '2025-03-26T20:52:42.513Z',
          docId: SPAN_OR_TRANSACTION_ID
        },
      }),
    })}
    hidePanelChrome={true}
  />
```
2025-04-17 12:10:31 -03:00
Marco Liberati
e21bec3f31
[chore] Reuse bundled lodash and lodash/fp dependency (#217467)
## Summary

After #217202 and #217034 this the another attempt with `lodash` and
`lodash/fp`.

In short:
`lodash` and `lodash/fp` have a special webpack treatment as they are
imported within the shared bundle.
Now webpack is not smart enough to understand that `import camelCase
from 'lodash/camelCase';` is still pointing to `lodash` and it thinks
that `lodash/camelCase` is a different package, de-optimizing the
bundling caching system.
So I’ve tweaked the import to make it point to the shared bundle and
save few kbs here and there
2025-04-17 14:54:25 +02:00
Francesco Fagnani
ec939b6718
[Synthetics] Changed embeddable view when only one monitor in one location is selected (#218402)
This PR closes #208981 by adding a new action to the Monitor card to
view only that monitor in the dashboard.



https://github.com/user-attachments/assets/f500d220-b57f-4c43-a632-b2383e33988e

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
2025-04-17 14:03:40 +02:00
Gerard Soldevila
cf94c2fe0f
SKA: Relocate ai assistant management (#218129)
## Summary

Pre-requisite for https://github.com/elastic/kibana/pull/216088, as the
`AI Assistant Management` configuration settings should be available for
Search too.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-17 13:55:02 +02:00
Mykola Harmash
35407c9240
[Oblt Onboarding][K8S OTel] Override docker image in values.yml for serverless (#218527)
The current `values.yml` on serverless uses
`docker.elastic.co/beats/elastic-agent:9.0.0` which doesn't exist. [The
actual fix](https://github.com/elastic/elastic-agent/pull/7882) will be
in v9.0.1 but in the meantime we have to do a workaround on the Kibana
side and override the broken value in the code snippet.

![CleanShot 2025-04-17 at 09 25
18@2x](https://github.com/user-attachments/assets/134af691-0417-4a46-86d7-1efbac75f02a)
2025-04-17 12:17:53 +02:00
Francesco Fagnani
e96f0566ce
[Synthetics] Fixed test run logs per page (#218458) 2025-04-17 07:34:38 +02:00
Marco Liberati
0a6bc1b46c
[chore] Bundle fp-ts into the shared bundle (#217034)
## Summary

Just had some fun and made fp-ts available in the shared bundle, with
support for partial imports.

Changes in this PR:
* aligned `fp-ts` direct imports to the format: `fp-ts/<module>`
* Mapped the direct imports into the shared bundle re-using the same
`fp-ts` module under the hood
2025-04-16 18:01:41 +02:00
jennypavlova
f816e7b84f
[APM][OTel] Encode service name in the APM URLs (#217092)
Closes #213943

## Summary

This PR ensures the service name is always encoded in the APM UIs. It's
a follow-up of https://github.com/elastic/kibana/pull/215031 and aims to
find a better solution to the problem:
- Add the encoding directly to `formatRequest` as suggested there
- I saw that there are many places where we use legacy Url builders, so
I will try to replace them where possible and use
apm router link method where the path is encoded
([ref](7158e0201b/src/platform/packages/shared/kbn-typed-react-router-config/src/create_router.ts (L184-L185)))
- The PR includes the changes to address the issue above:
   - Replaced and removed `LegacyAPMLink`
- Refactored `useAPMHref` to support encoding (and extracted and test
the encoding logic)
     - Example usage: 
        - Before: 
        ```js
           useAPMHref({
                path: `/services/${serviceName}/.....`,
                persistedFilters,
           });
        ```
        - After:
        ```js
          useAPMHref({
              path: '/services/{serviceName}/.......}',
              pathParams: { serviceName },
              persistedFilters,
         });
        ```
   - Used the APM router link method as much as possible


## Testing
- Run `node scripts/synthtrace trace_with_service_names_with_slashes.ts
--clean --live --uniqueIds --live`
- Go to service inventory and click the links:


https://github.com/user-attachments/assets/fcd4fbfc-4125-4cc8-9b00-53c5f375423f
2025-04-16 17:52:33 +02:00
Mykola Harmash
fc686f8a6d
[Oblt Onboarding] Remove Custom Logs flow (#216053)
Closes https://github.com/elastic/kibana/issues/208025

This change deleted the "Stream log files" onboarding flow which is now
replaced by the Auto Detect flow.

| Before | After |
| --- | --- |
| ![CleanShot 2025-03-27 at 14 55
55@2x](https://github.com/user-attachments/assets/46a90769-8b3d-495f-b600-9a8f24964761)
| ![CleanShot 2025-03-27 at 14 56
28@2x](https://github.com/user-attachments/assets/e800cab8-cfd2-48e8-8d1a-8a41c037d532)
|


Changes made:
* Deleted UI components responsible for rendering the Custom Logs flow
* Deleted the definition for a custom card in the onboarding search
results
* Deleted API endpoints and supporting files used only by the Custom
Logs flow
* `/internal/observability_onboarding/logs/setup/environment` endpoint
was still used by the OTel Host flow, so it was moved to a dedicated
OTel route and pathname changed to
`/internal/observability_onboarding/otel_host/setup`
* Functionality of the `/internal/observability_onboarding/otel/api_key`
endpoint was merged into the above mentioned OTel route, so UI has to
make a single API request to get all the necessary information from the
server
* Deleted Scout UI tests for the Custom Logs flow
* Deleted API integration tests for the deleted endpoints
* API tests that we previously testing
`/internal/observability_onboarding/logs/flow` were converted to test
`/internal/observability_onboarding/flow'` used by the Auto Detect flow

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-16 11:01:18 +02:00
Francesco Fagnani
ec88cca373
[Synthetics] Added drilldown to synthetics stats overview embeddable (#217688)
This PR closes #208066 by adding drilldowns to the synthetics stats
overview embeddable.



https://github.com/user-attachments/assets/fe8d9eb0-ecdc-449d-93af-7d165c541d46
2025-04-16 09:52:16 +02:00
jennypavlova
7c9a3ee1f2
[APM][OTel] EDOT error summary fix (#217885)
## Summary

This PR fixes the issue with the error summary missing items using edot.
It includes e2e tests with synthtrace for both edot and otel services.

TODO 

- [x] Test with serverless (waiting for the PR to be deployed)
Tested on serverless works as expected: 

<img width="2560" alt="image"
src="https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f"
/>
2025-04-15 21:44:11 +02:00
Shahzad
83f3d614cc
[Custom threshold rule] Allow group for ip type fields !! (#216062)
Allow group by for ip fields !!

---------

Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-15 20:15:02 +02:00
Drew Tate
9b4403b7dc
[ES|QL] remove worker (#218006)
## Summary

Fix https://github.com/elastic/kibana/issues/217923

Investigations in https://github.com/elastic/kibana/issues/217368 showed
that there was basically no performance impact to passing the AST across
a thread boundary. But we also didn't detect a pressing reason to remove
the worker.

Since then, however, we noticed another cost associated with the worker:
it's a hefty Javascript file, even in production builds. In addition, we
are doing parsing on the main thread _and_ the worker, so the
`kbn-esql-ast` package is actually being loaded and parsed twice by the
browser, once for the main thread and once for the worker.

This PR removes our worker. Our parsing associated with validation and
autocomplete will still be done asynchronously, but on the main thread.

I do not see any regression in perceived performance.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2025-04-15 10:18:07 -06:00
Francesco Fagnani
f693e7218e
[Synthetics] Sync global parameters is called in the endpoints to add, edit or delete global params (#216197)
This PR closes #215668.

The global parameters are synched in the endpoints where they are
created, edited or deleted.

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
2025-04-15 16:53:14 +02:00
Carlos Crespo
5423655975
[Infra] Check ML permissions before requesting ML data (#218069)
fixes [#189213](https://github.com/elastic/kibana/issues/189213)

## Summary

Checks whether the user has permission to ML before triggering requests
to fetch ML data


### How to test

- Create a user whose role doesn't have permission to ML, but has
permission to O11y apps
- Run `node scripts/synthtrace infra_hosts_with_apm_hosts --live
--clean`
 - Navigate to Inventory Infrastructure / Hosts View

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-15 12:02:51 +02:00
Marco Vettorello
a9c9354382
[Charts] Use chartTheme hook everywhere (#217370)
## Summary

This PR fixes the existing usage of the chart themes by using the
provided `useElasticChartsTheme` hook that is color mode aware and theme
adaptive (borealis/amsterdam)

Some charts where using just the Light theme version or the legacy (aka
amsterdam theme), and I've applied the hook to pick up the correct
theme.

TO REVIEWERS: Please pull down the PR and check if the actual changed
charts looks correct with the new theme configuration.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
2025-04-14 18:09:15 +02:00
Shahzad
760106eb86
[Observability] Related alerts based on scoring !! (#215673)
## Summary

Copying most of https://github.com/elastic/kibana/pull/214017 !!

Fixes https://github.com/elastic/kibana/issues/214372

### Implementation
We are now using response ops alerts table with custom score querying
based on tags/groups matches and Jaccard similarity on documents !!


<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/b3a69280-c05d-4100-be6a-2c8dadcc051d"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
Co-authored-by: Kevin Delemme <kevin.delemme@elastic.co>
2025-04-14 11:35:40 -04:00
Miriam
26d9f5f7d0
[ObsUX][A11y] Fix focus for popover in details flyout (#218095)
Closes https://github.com/elastic/kibana/issues/212633

## Summary

Fixed navigation by keeping focus on Popover opener element

### How to test
Observability -> Infrastructure -> Infrastructure inventory page.
1. Navigate to any square below All button.
2. Press Enter.
3. Navigate to infographic for Host IP.
4. Press Enter.
5. Press Esc.

Expected result: Navigation continues to next element when Tab key is
pressed.

BEFORE 


https://github.com/user-attachments/assets/e9ee6ff6-895d-408f-b165-0f8edd4eb197

AFTER


https://github.com/user-attachments/assets/b01e6955-b659-4d9a-abcf-1ece48adc161
2025-04-14 15:15:25 +01:00
Cauê Marcondes
5d96f36e54
[APM]Handle ELASTIC_PROFILER_STACK_TRACE_IDS for apm-profiler integration (#217020)
Depends on https://github.com/elastic/elasticsearch/pull/125608

# Summary

`ELASTIC_PROFILER_STACK_TRACE_IDS` is introduced for OTel based data
streams. The same information is stored in
`TRANSACTION_PROFILER_STACK_TRACE_IDS` in the classic APM data streams.

Prior to this PR apm<->profiling integration did not work for OTel SDKs.
This PR adds handling for the new field name.

<img width="1159" alt="Screenshot 2025-04-03 at 10 05 28"
src="https://github.com/user-attachments/assets/ce3ad092-d4f4-4a16-843e-923c72938fe1"
/>

<img width="1772" alt="Screenshot 2025-04-03 at 10 05 40"
src="https://github.com/user-attachments/assets/8b2682fe-6f2e-49a4-9995-d83997a05f02"
/>

---------

Co-authored-by: Greg Kalapos <gergo@kalapos.net>
2025-04-14 15:17:08 +02:00
Anton Dosov
ef0322d8d0
[jest] @emotion/babel-preset-css-prop (#216489)
## Summary

Partially address https://github.com/elastic/kibana/issues/216459

This PR adds `@emotion/babel-preset-css-prop` to jest config to improve
jest and emotion integration. There are some tradeoffs: this is a better
setup for emotion + testing library, but there are some seemingly
regressions for enzyme. We think these are right tradeoffs to make,
since we optimize for emotion+testing library.

### Main upsides are 😄 

#### 🟢 Fixes snapshots with css prop

`You have tried to stringify object returned from \`css\` function. It
isn't supposed to be used directly (e.g. as value of the \`className\`
prop), but rather handed to emotion so it can handle it (e.g. as value
of \`css\` prop).` is replaced with proper emotion css classname.

![Screenshot 2025-04-04 at 14 57
52](https://github.com/user-attachments/assets/f4a746d6-2451-4703-ab39-57be7171b10b)

#### 🟢 We will be able to use jest style matchers for emotion
`toHaveStyleRule`

https://emotion.sh/docs/@emotion/jest#tohavestylerule

_they can be used locally now, but we plan to follow up with global
extend_

###  Considerations 🫤  

#### 🟡 jsx doesn't work inside jest.mock function 

Example: 

```
jest.mock('./components/alert_header_title', () => ({
    > 27 |   AlertHeaderTitle: jest.fn().mockReturnValue(<div></div>), 
         |                                                                           ^
      28 | }));
```

Fails with an error. `can't read jsx of undefined`. 

This is because babel compiles this into: 

```
import { jsx as ___EmotionJSX } from '@emotion/react'

jest.mock('./components/alert_header_title', () => ({
    > 27 |   AlertHeaderTitle: jest.fn().mockReturnValue(___EmotionJSX.jsx(….)), 
         |                                                                                   ^
      28 | }));
```

And, apparently, due to how jest imports work, __EmotionJSX is not yet
in the scope.

The applied workaround is to rewrite to: 

```
jest.mock('./components/alert_header_title', () => ({
  AlertHeaderTitle: jest.fn(() => <div></div>), 
     }));
```


#### 🟡 euiTheme needs to be available when euiTheme is accessed inside
`css` function

Example: 

```
DashboardGrid removes panel when removed from container
    TypeError: Cannot read properties of undefined (reading 'size')
      42 |     margin: '-2px',
      43 |     position: 'absolute',
    > 44 |     width: euiTheme.size.l,
```

The fix was to wrap failing tests with `<EuiProvider/>` 

### Drawbacks 😢 

Mostly related to Enzyme 

#### 🔴  Enzyme shallow snapshot no longer include `css` prop 

Since `css` prop is compiled away there are bunch of snapshots that
looks like a regression:

Example:

![Screenshot 2025-04-04 at 15 50
16](https://github.com/user-attachments/assets/61c1d027-1e8a-48e6-a242-1fa53f8ec9b7)

This is unfortunate. We've tried `@emotion/jest/enzyme-serializer` but
it didn't work (likely because enzyme ecosystem no longer supported?)
If it is important that the snapshot captures css, we recommend to use
mount or rtl

#### 🔴 Asserting against `css` prop with shallow render also doesn't
work

Possible solution is to use 

```
import { matchers } from '@emotion/jest';
expect.extend(matchers);
```

(We plan to add these matches globally in a follow up)

and 

```
 expect(button).toHaveStyleRule('background-color', '#FFFFFF');
```



#### 🔴 Some shallow Enzyme tests `find()` breaks because of code
transformations of emotion

Example:

```
const component = shallow(
      <MetricVisValue />
)

component.find('button') // fails because instead of <button/> there is <EmotionInternalCss/> element now 

```

Solutions:
- Use full mount or react testing library 
- Or target by data-test-subj

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
2025-04-14 14:29:47 +02:00
Francesco Fagnani
89e385ec96
[Synthetics] Enable KQL filter for TLS rules (#216973)
This PR follows #215110 by enabling the KQL filter for TLS alerting
rules and closes #214346.
2025-04-14 14:24:31 +02:00
Sergi Romeu
429a9db67d
[APM][Cypress] Attempt to fix mobile transactions test (#217648)
## Summary

Closes #207040
2025-04-11 10:28:49 +02:00
Nick Peihl
72d18d8b99
[Dashboards] Replace contentClient with getContentClient on DashboardStart server api (#217586)
## Summary

Changes the DashboardStart server api to provide a getContentClient
function.

In https://github.com/elastic/kibana/pull/214788, we set the
`contentClient` returned from the content management register method
after start lifecycle of all plugins. This means the `contentClient`
returned from the `DashboardStart` contract was undefined. This PR
changes the start contract to provide a getContentClient function
instead.

Only one consumer was using the contentClient from DashboardStart and
this PR also updates that consumer.
2025-04-10 14:52:38 -04:00
Lisa Cawley
e00f013b62
[DOCS] Add minimal synthetic APIs (#214518)
Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com>
2025-04-10 19:26:49 +02:00
Milosz Marcinkowski
23cbaa6d55
[APM][UI] Sort environment dropdown alphabetically (#217710)
Closes #217814

### Summary

Sort environment list alphabetically.

|Before|After|
|-|-|
|<img width="1724" alt="Screenshot 2025-04-10 at 12 01 15"
src="https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263"
/>|<img width="1722" alt="Screenshot 2025-04-10 at 11 58 27"
src="https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8"
/>|
2025-04-10 17:38:20 +02:00
Viduni Wickramarachchi
368d4bf5c5
[Obs AI Assistant] Fix navigating to the search connectors page (#217749)
Closes https://github.com/elastic/kibana/issues/217748

## Summary

### Problem

Clicking on connectors in the Search connectors tab in the AI Assistant
settings navigates the user to a blank page.


https://github.com/user-attachments/assets/e369e539-cf75-4ea4-8cd0-343dbfbf9a33

This happens because `enterprise_search` URLs are deprecated and it's
renamed to `elasticsearch`.
Related to https://github.com/elastic/kibana/pull/202838

List of changed URLs -
https://github.com/elastic/search-team/issues/7961#issuecomment-2433029797

### Solution

Replace the URL path from `enterpriseSearch` to `elasticsearch`

After the fix:


https://github.com/user-attachments/assets/5ebad872-9a87-46b0-ad2f-83a8ff6e017e


### 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)
2025-04-10 10:27:54 -04:00
Viduni Wickramarachchi
c2596a1f61
[Obs AI Assistant] Remove semantic text feature flag (#217750)
Closes https://github.com/elastic/kibana/issues/206827

## Summary

Semantic text was updated to a new format with
https://github.com/elastic/dev/issues/2936 to act like a normal text
field. This was under a feature flag, therefore we had to enforce the
new format by setting the feature flag
`index.mapping.semantic_text.use_legacy_format` to `false`.

With the merge of https://github.com/elastic/elasticsearch/pull/120813
the new semantic format is now the default behaviour. Therefore, this PR
removes the feature flag in our code.

## Querying the KB after removing the feature flag


https://github.com/user-attachments/assets/8f91bd5a-033a-47ec-9bed-3e2bdfe85627


### 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)
2025-04-10 10:00:43 -04:00
Joe Reuter
de059eb516
🌊 Streams: Add experimental badge to nav entry (#217819)
This PR adds the experimental badge to the nav entry for streams (if
enabled)

<img width="343" alt="Screenshot 2025-04-10 at 12 47 22"
src="https://github.com/user-attachments/assets/765e0dd2-6ebd-4516-b024-ec207fcea43f"
/>

We also render a tech preview badge in the classic observability sub
nav:
<img width="224" alt="Screenshot 2025-04-10 at 12 52 04"
src="https://github.com/user-attachments/assets/c51210c0-056e-4ead-97ee-891e3fb6851f"
/>

Important to note: we don't render a badge in the classic main nav since
it's not supported there:
<img width="257" alt="Screenshot 2025-04-10 at 12 52 29"
src="https://github.com/user-attachments/assets/5a1fb3c8-88dd-49c9-bade-82965f367e46"
/>
2025-04-10 15:10:53 +02:00