Skip to content

Commit e6b4ee8

Browse files
authored
Merge branch 'main' into onboarding-tweaks
2 parents 835d5e0 + 01a7841 commit e6b4ee8

48 files changed

Lines changed: 182 additions & 86 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/core/saved-objects/core-saved-objects-server/docs/model_versions.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,11 @@ to the `fields` option **were already present in the prior model version**. Othe
893893
during upgrades, where newly introduced or backfilled fields may not necessarily appear in the documents returned
894894
from the `search` API when the option is used.
895895

896-
### Using `update` with dynamically backfilled fields
896+
### Using `bulkUpdate` with dynamically backfilled fields
897897

898-
The savedObjects `update` API is effectively a partial update (using Elasticsearch's `_update` under the hood),
898+
(Note: this same limitation used to exist for the `update` method but has been [fixed](https://github.com/elastic/kibana/issues/165434). So while they're similar this limitation is only relevant for the `bulkUpdate` method)
899+
900+
The savedObjects `bulkUpdate` API is effectively a partial update (using Elasticsearch's `_update` under the hood),
899901
allowing API consumers to only specify the subset of fields they want to update to new values, without having to
900902
provide the full list of attributes (the unchanged ones). We're also not changing the `version` of the document
901903
during updates, even when the instance performing the operation doesn't know about the current model version
@@ -935,8 +937,14 @@ const newDocAttributes = {
935937
Which could occur either while being still in the cohabitation period, or in case of rollback:
936938

937939
```ts
938-
savedObjectClient.update('type', 'id', {
939-
index: 11,
940+
savedObjectClient.bulkUpdate({
941+
objects: [{
942+
type: 'type',
943+
id: 'id',
944+
attributes: {
945+
index: 11
946+
}
947+
}]
940948
});
941949
```
942950

@@ -949,7 +957,7 @@ We will then be in a situation where our data is **inconsistent**, as the value
949957
}
950958
```
951959

952-
The long term solution for that is implementing [backward-compatible updates](https://github.com/elastic/kibana/issues/152807), however
960+
The long term solution for that is implementing [backward-compatible updates](https://github.com/elastic/kibana/issues/165434), however
953961
this won't be done for the MVP, so the workaround for now is to avoid situations where this edge case can occur.
954962

955963
It can be avoided by either:

test/functional/apps/console/_autocomplete.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ GET _search
217217
for (const keyPress of keyPresses) {
218218
await PageObjects.console.sleepForDebouncePeriod();
219219
log.debug('Key', keyPress);
220+
// @ts-ignore
220221
await PageObjects.console[keyPress]();
221222
expect(await PageObjects.console.isAutocompleteVisible()).to.be.eql(false);
222223
}
@@ -257,7 +258,7 @@ GET _search
257258
for (const char of [method.at(-1), ' ', '_']) {
258259
await PageObjects.console.sleepForDebouncePeriod();
259260
log.debug('Key type "%s"', char);
260-
await PageObjects.console.enterText(char); // e.g. 'Post ' -> 'Post _'
261+
await PageObjects.console.enterText(char ?? ''); // e.g. 'Post ' -> 'Post _'
261262
}
262263

263264
await retry.waitFor('autocomplete to be visible', () =>

test/functional/apps/dashboard_elements/controls/common/replace_controls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
1616
const retry = getService('retry');
1717
const security = getService('security');
1818

19-
const { dashboardControls, timePicker, common, dashboard } = getPageObjects([
19+
const { dashboardControls, timePicker, dashboard } = getPageObjects([
2020
'dashboardControls',
2121
'timePicker',
2222
'dashboard',

test/functional/apps/visualize/group2/_inspector.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
1414
const log = getService('log');
1515
const inspector = getService('inspector');
1616
const filterBar = getService('filterBar');
17-
const monacoEditor = getService('monacoEditor');
1817
const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']);
1918

2019
describe('inspector', function describeIndexTests() {

x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function TemplateWithContext({
9090
const {
9191
path: { serviceName },
9292
query,
93-
query: { rangeFrom, rangeTo },
93+
query: { rangeFrom, rangeTo, environment },
9494
} = useApmParams('/services/{serviceName}/*');
9595
const history = useHistory();
9696
const location = useLocation();
@@ -140,6 +140,7 @@ function TemplateWithContext({
140140
<EuiFlexItem grow={false}>
141141
<ServiceIcons
142142
serviceName={serviceName}
143+
environment={environment}
143144
start={start}
144145
end={end}
145146
/>

x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function TemplateWithContext({
5757
const {
5858
path: { serviceName },
5959
query,
60-
query: { rangeFrom, rangeTo },
60+
query: { rangeFrom, rangeTo, environment },
6161
} = useApmParams('/mobile-services/{serviceName}/*');
6262

6363
const { start, end } = useTimeRange({ rangeFrom, rangeTo });
@@ -116,6 +116,7 @@ function TemplateWithContext({
116116
<EuiFlexItem grow={false}>
117117
<ServiceIcons
118118
serviceName={serviceName}
119+
environment={environment}
119120
start={start}
120121
end={end}
121122
/>

x-pack/plugins/apm/public/components/shared/service_icons/index.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe('ServiceIcons', () => {
6464
<EuiThemeProvider>
6565
<ServiceIcons
6666
serviceName="foo"
67+
environment="dev"
6768
start="2021-08-20T10:00:00.000Z"
6869
end="2021-08-20T10:15:00.000Z"
6970
/>
@@ -87,6 +88,7 @@ describe('ServiceIcons', () => {
8788
<EuiThemeProvider>
8889
<ServiceIcons
8990
serviceName="foo"
91+
environment="dev"
9092
start="2021-08-20T10:00:00.000Z"
9193
end="2021-08-20T10:15:00.000Z"
9294
/>
@@ -112,6 +114,7 @@ describe('ServiceIcons', () => {
112114
<EuiThemeProvider>
113115
<ServiceIcons
114116
serviceName="foo"
117+
environment="dev"
115118
start="2021-08-20T10:00:00.000Z"
116119
end="2021-08-20T10:15:00.000Z"
117120
/>
@@ -138,6 +141,7 @@ describe('ServiceIcons', () => {
138141
<EuiThemeProvider>
139142
<ServiceIcons
140143
serviceName="foo"
144+
environment="dev"
141145
start="2021-08-20T10:00:00.000Z"
142146
end="2021-08-20T10:15:00.000Z"
143147
/>
@@ -165,6 +169,7 @@ describe('ServiceIcons', () => {
165169
<EuiThemeProvider>
166170
<ServiceIcons
167171
serviceName="foo"
172+
environment="dev"
168173
start="2021-08-20T10:00:00.000Z"
169174
end="2021-08-20T10:15:00.000Z"
170175
/>
@@ -212,6 +217,7 @@ describe('ServiceIcons', () => {
212217
<EuiThemeProvider>
213218
<ServiceIcons
214219
serviceName="foo"
220+
environment="dev"
215221
start="2021-08-20T10:00:00.000Z"
216222
end="2021-08-20T10:15:00.000Z"
217223
/>
@@ -256,6 +262,7 @@ describe('ServiceIcons', () => {
256262
<EuiThemeProvider>
257263
<ServiceIcons
258264
serviceName="foo"
265+
environment="dev"
259266
start="2021-08-20T10:00:00.000Z"
260267
end="2021-08-20T10:15:00.000Z"
261268
/>
@@ -308,6 +315,7 @@ describe('ServiceIcons', () => {
308315
<EuiThemeProvider>
309316
<ServiceIcons
310317
serviceName="foo"
318+
environment="dev"
311319
start="2021-08-20T10:00:00.000Z"
312320
end="2021-08-20T10:15:00.000Z"
313321
/>
@@ -366,6 +374,7 @@ describe('ServiceIcons', () => {
366374
<EuiThemeProvider>
367375
<ServiceIcons
368376
serviceName="foo"
377+
environment="dev"
369378
start="2021-08-20T10:00:00.000Z"
370379
end="2021-08-20T10:15:00.000Z"
371380
/>

x-pack/plugins/apm/public/components/shared/service_icons/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import openTelemetryIcon from '../agent_icon/icons/opentelemetry.svg';
2525

2626
interface Props {
2727
serviceName: string;
28+
environment: string;
2829
start: string;
2930
end: string;
3031
}
@@ -92,7 +93,7 @@ export interface PopoverItem {
9293
component: ReactChild;
9394
}
9495

95-
export function ServiceIcons({ start, end, serviceName }: Props) {
96+
export function ServiceIcons({ start, end, serviceName, environment }: Props) {
9697
const [selectedIconPopover, setSelectedIconPopover] =
9798
useState<Icons | null>();
9899

@@ -117,20 +118,20 @@ export function ServiceIcons({ start, end, serviceName }: Props) {
117118

118119
const { data: details, status: detailsFetchStatus } = useFetcher(
119120
(callApmApi) => {
120-
if (selectedIconPopover && serviceName && start && end) {
121+
if (selectedIconPopover && serviceName && start && end && environment) {
121122
return callApmApi(
122123
'GET /internal/apm/services/{serviceName}/metadata/details',
123124
{
124125
isCachable: true,
125126
params: {
126127
path: { serviceName },
127-
query: { start, end },
128+
query: { start, end, environment },
128129
},
129130
}
130131
);
131132
}
132133
},
133-
[selectedIconPopover, serviceName, start, end]
134+
[selectedIconPopover, serviceName, start, end, environment]
134135
);
135136

136137
const isLoading = !icons && iconsFetchStatus === FETCH_STATUS.LOADING;

x-pack/plugins/apm/public/components/shared/service_icons/service_icons.stories.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type ServiceIconsReturnType =
2222

2323
interface Args {
2424
serviceName: string;
25+
environment: string;
2526
start: string;
2627
end: string;
2728
icons: ServiceIconsReturnType;
@@ -64,7 +65,12 @@ const stories: Meta<Args> = {
6465
};
6566
export default stories;
6667

67-
export const Example: Story<Args> = ({ serviceName, start, end }) => {
68+
export const Example: Story<Args> = ({
69+
serviceName,
70+
environment,
71+
start,
72+
end,
73+
}) => {
6874
return (
6975
<EuiFlexGroup>
7076
<EuiFlexItem>
@@ -83,6 +89,7 @@ export const Example: Story<Args> = ({ serviceName, start, end }) => {
8389
<EuiFlexItem grow={false}>
8490
<ServiceIcons
8591
serviceName={serviceName}
92+
environment={environment}
8693
start={start}
8794
end={end}
8895
/>
@@ -98,6 +105,7 @@ export const Example: Story<Args> = ({ serviceName, start, end }) => {
98105
};
99106
Example.args = {
100107
serviceName: 'opbeans-java',
108+
environment: 'dev',
101109
start: '2021-09-10T13:59:00.000Z',
102110
end: '2021-09-10T14:14:04.789Z',
103111
icons: {

x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import { rangeQuery } from '@kbn/observability-plugin/server';
99
import { ProcessorEvent } from '@kbn/observability-plugin/common';
10+
import { environmentQuery } from '../../../common/utils/environment_query';
1011
import {
1112
AGENT,
1213
CONTAINER,
@@ -86,17 +87,20 @@ export interface ServiceMetadataDetails {
8687

8788
export async function getServiceMetadataDetails({
8889
serviceName,
90+
environment,
8991
apmEventClient,
9092
start,
9193
end,
9294
}: {
9395
serviceName: string;
96+
environment: string;
9497
apmEventClient: APMEventClient;
9598
start: number;
9699
end: number;
97100
}): Promise<ServiceMetadataDetails> {
98101
const filter = [
99102
{ term: { [SERVICE_NAME]: serviceName } },
103+
...environmentQuery(environment),
100104
...rangeQuery(start, end),
101105
];
102106

0 commit comments

Comments
 (0)