[8.x] Set useEcs to true in SLO burn rate rule (#194322) (#194578)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Set useEcs to true in SLO burn rate rule
(#194322)](https://github.com/elastic/kibana/pull/194322)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Maryam
Saeidi","email":"maryam.saeidi@elastic.co"},"sourceCommit":{"committedDate":"2024-10-01T13:32:03Z","message":"Set
useEcs to true in SLO burn rate rule (#194322)\n\n## Summary\r\n\r\nThis
PR sets useEcs to true in the SLO burn rate rule. (more
info\r\n[here](https://docs.google.com/document/d/1mhWcMR3aIp3z4SmPywpW89RG4hHiBAjYCQIQBDUYNj0/edit?usp=sharing))","sha":"67f30433fdf1dea1793af3da8519a66a9dc4bd34","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management"],"title":"Set
useEcs to true in SLO burn rate
rule","number":194322,"url":"https://github.com/elastic/kibana/pull/194322","mergeCommit":{"message":"Set
useEcs to true in SLO burn rate rule (#194322)\n\n## Summary\r\n\r\nThis
PR sets useEcs to true in the SLO burn rate rule. (more
info\r\n[here](https://docs.google.com/document/d/1mhWcMR3aIp3z4SmPywpW89RG4hHiBAjYCQIQBDUYNj0/edit?usp=sharing))","sha":"67f30433fdf1dea1793af3da8519a66a9dc4bd34"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194322","number":194322,"mergeCommit":{"message":"Set
useEcs to true in SLO burn rate rule (#194322)\n\n## Summary\r\n\r\nThis
PR sets useEcs to true in the SLO burn rate rule. (more
info\r\n[here](https://docs.google.com/document/d/1mhWcMR3aIp3z4SmPywpW89RG4hHiBAjYCQIQBDUYNj0/edit?usp=sharing))","sha":"67f30433fdf1dea1793af3da8519a66a9dc4bd34"}}]}]
BACKPORT-->

Co-authored-by: Maryam Saeidi <maryam.saeidi@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-02 01:05:13 +10:00 committed by GitHub
parent 4a1a04b29a
commit f4260f11d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View file

@ -12,6 +12,7 @@
import * as rt from 'io-ts';
import { Either } from 'fp-ts/lib/Either';
import { AlertSchema } from './alert_schema';
import { EcsSchema } from './ecs_schema';
import { LegacyAlertSchema } from './legacy_alert_schema';
const ISO_DATE_PATTERN = /^d{4}-d{2}-d{2}Td{2}:d{2}:d{2}.d{3}Z$/;
export const IsoDateString = new rt.Type<string, string, unknown>(
@ -88,6 +89,6 @@ const ObservabilitySloAlertOptional = rt.partial({
});
// prettier-ignore
export const ObservabilitySloAlertSchema = rt.intersection([ObservabilitySloAlertRequired, ObservabilitySloAlertOptional, AlertSchema, LegacyAlertSchema]);
export const ObservabilitySloAlertSchema = rt.intersection([ObservabilitySloAlertRequired, ObservabilitySloAlertOptional, AlertSchema, EcsSchema, LegacyAlertSchema]);
// prettier-ignore
export type ObservabilitySloAlert = rt.TypeOf<typeof ObservabilitySloAlertSchema>;

View file

@ -115,7 +115,7 @@ export function sloBurnRateRuleType(
alerts: {
context: SLO_RULE_REGISTRATION_CONTEXT,
mappings: { fieldMap: { ...legacyExperimentalFieldMap, ...sloRuleFieldMap } },
useEcs: false,
useEcs: true,
useLegacyAlerts: true,
shouldWrite: true,
},

View file

@ -36,8 +36,8 @@ export default function ({ getService }: FtrProviderContext) {
return fieldStat.name === 'geo_point';
}
);
expect(geoPointFieldStats.count).to.be(47);
expect(geoPointFieldStats.index_count).to.be(11);
expect(geoPointFieldStats.count).to.be(55);
expect(geoPointFieldStats.index_count).to.be(12);
const geoShapeFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find(
(fieldStat: estypes.ClusterStatsFieldTypes) => {