);
+
+ // only color by span type if there are only events for one service
+ const colorBy =
+ serviceLegends.length > 1
+ ? WaterfallLegendType.ServiceName
+ : WaterfallLegendType.SpanType;
+
+ const displayedLegends = legends.filter((legend) => legend.type === colorBy);
+
+ const legendsByValue = keyBy(displayedLegends, 'value');
+
+ // mutate items rather than rebuilding both items and childrenByParentId
+ items.forEach((item) => {
+ let color = '';
+ if ('legendValues' in item) {
+ color = legendsByValue[item.legendValues[colorBy]].color;
+ }
+
+ if (!color) {
+ // fall back to service color if there's no span.type, e.g. for transactions
+ color = serviceColors[item.doc.service.name];
+ }
+
+ item.color = color;
+ });
+
+ // default to serviceName if value is empty, e.g. for transactions (which don't
+ // have span.type or span.subtype)
+ const legendsWithFallbackLabel = displayedLegends.map((legend) => {
+ return { ...legend, value: !legend.value ? serviceName : legend.value };
+ });
+
return (
-
+
{
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610182,
+ "suricata.eve.alert.signature_id": "2610182",
},
},
],
@@ -1040,7 +1040,7 @@ describe('get_filter', () => {
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610183,
+ "suricata.eve.alert.signature_id": "2610183",
},
},
],
@@ -1052,7 +1052,7 @@ describe('get_filter', () => {
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610184,
+ "suricata.eve.alert.signature_id": "2610184",
},
},
],
@@ -1064,7 +1064,7 @@ describe('get_filter', () => {
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610185,
+ "suricata.eve.alert.signature_id": "2610185",
},
},
],
@@ -1076,7 +1076,7 @@ describe('get_filter', () => {
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610186,
+ "suricata.eve.alert.signature_id": "2610186",
},
},
],
@@ -1088,7 +1088,7 @@ describe('get_filter', () => {
"should": Array [
Object {
"match": Object {
- "suricata.eve.alert.signature_id": 2610187,
+ "suricata.eve.alert.signature_id": "2610187",
},
},
],
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx
index 8e03a56c1aa9b..0438acdfe44d4 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx
@@ -332,8 +332,8 @@ describe('Combined Queries', () => {
kqlQuery: { query: '', language: 'kuery' },
kqlMode: 'search',
})!;
- expect(filterQuery).toEqual(
- '{"bool":{"must":[],"filter":[{"bool":{"should":[{"range":{"@timestamp":{"gte":1521848183232,"lte":1521848183232}}}],"minimum_should_match":1}}],"should":[],"must_not":[]}}'
+ expect(filterQuery).toMatchInlineSnapshot(
+ `"{\\"bool\\":{\\"must\\":[],\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"range\\":{\\"@timestamp\\":{\\"gte\\":\\"1521848183232\\",\\"lte\\":\\"1521848183232\\"}}}],\\"minimum_should_match\\":1}}],\\"should\\":[],\\"must_not\\":[]}}"`
);
});
@@ -350,8 +350,8 @@ describe('Combined Queries', () => {
kqlQuery: { query: '', language: 'kuery' },
kqlMode: 'search',
})!;
- expect(filterQuery).toEqual(
- '{"bool":{"must":[],"filter":[{"bool":{"should":[{"range":{"@timestamp":{"gte":1521848183232,"lte":1521848183232}}}],"minimum_should_match":1}}],"should":[],"must_not":[]}}'
+ expect(filterQuery).toMatchInlineSnapshot(
+ `"{\\"bool\\":{\\"must\\":[],\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"range\\":{\\"@timestamp\\":{\\"gte\\":\\"1521848183232\\",\\"lte\\":\\"1521848183232\\"}}}],\\"minimum_should_match\\":1}}],\\"should\\":[],\\"must_not\\":[]}}"`
);
});
@@ -368,8 +368,8 @@ describe('Combined Queries', () => {
kqlQuery: { query: '', language: 'kuery' },
kqlMode: 'search',
})!;
- expect(filterQuery).toEqual(
- '{"bool":{"must":[],"filter":[{"bool":{"should":[{"match":{"event.end":1521848183232}}],"minimum_should_match":1}}],"should":[],"must_not":[]}}'
+ expect(filterQuery).toMatchInlineSnapshot(
+ `"{\\"bool\\":{\\"must\\":[],\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"event.end\\":\\"1521848183232\\"}}],\\"minimum_should_match\\":1}}],\\"should\\":[],\\"must_not\\":[]}}"`
);
});
@@ -386,8 +386,8 @@ describe('Combined Queries', () => {
kqlQuery: { query: '', language: 'kuery' },
kqlMode: 'search',
})!;
- expect(filterQuery).toEqual(
- '{"bool":{"must":[],"filter":[{"bool":{"should":[{"match":{"event.end":1521848183232}}],"minimum_should_match":1}}],"should":[],"must_not":[]}}'
+ expect(filterQuery).toMatchInlineSnapshot(
+ `"{\\"bool\\":{\\"must\\":[],\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"event.end\\":\\"1521848183232\\"}}],\\"minimum_should_match\\":1}}],\\"should\\":[],\\"must_not\\":[]}}"`
);
});
diff --git a/x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts b/x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts
index 4fac71a53a1dc..12db6eeff8fcf 100644
--- a/x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts
+++ b/x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts
@@ -354,7 +354,7 @@ describe('status check alert', () => {
"should": Array [
Object {
"match": Object {
- "url.port": 12349,
+ "url.port": "12349",
},
},
],
@@ -366,7 +366,7 @@ describe('status check alert', () => {
"should": Array [
Object {
"match": Object {
- "url.port": 5601,
+ "url.port": "5601",
},
},
],
@@ -378,7 +378,7 @@ describe('status check alert', () => {
"should": Array [
Object {
"match": Object {
- "url.port": 443,
+ "url.port": "443",
},
},
],
@@ -735,7 +735,7 @@ describe('status check alert', () => {
expect(mockAvailability.mock.calls[0]).toMatchInlineSnapshot(`
Array [
Object {
- "filters": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":12349}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":5601}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":443}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"observer.geo.name\\":\\"harrisburg\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"monitor.type\\":\\"http\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"tags\\":\\"unsecured\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"tags\\":\\"containers\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match_phrase\\":{\\"tags\\":\\"org:google\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
+ "filters": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":\\"12349\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":\\"5601\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"url.port\\":\\"443\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"observer.geo.name\\":\\"harrisburg\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"monitor.type\\":\\"http\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"tags\\":\\"unsecured\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match\\":{\\"tags\\":\\"containers\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"match_phrase\\":{\\"tags\\":\\"org:google\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
"range": 35,
"rangeUnit": "d",
"threshold": "99.34",