Skip to content

Commit a653f43

Browse files
committed
Merge remote-tracking branch 'upstream/master' into testbed/move-to-oss
2 parents e8ca73b + 65370c7 commit a653f43

38 files changed

Lines changed: 892 additions & 620 deletions

File tree

docs/apm/api.asciidoc

Lines changed: 146 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,45 @@
99
Some APM app features are provided via a REST API:
1010

1111
* <<agent-config-api>>
12-
13-
TIP: Kibana provides additional <<api,REST APIs>>,
14-
and general information on <<using-api,how to use APIs>>.
12+
* <<apm-annotation-api>>
13+
14+
Here's an example CURL request that adds an annotation to the APM app:
15+
16+
[source,curl]
17+
----
18+
curl -X POST \
19+
http://localhost:5601/api/apm/services/opbeans-java/annotation \
20+
-H 'Content-Type: application/json' \
21+
-H 'kbn-xsrf: true' \
22+
-H 'Authorization: Basic YhUlubWZhM0FDbnlQeE6WRtaW49FQmSGZ4RUWXdX' \
23+
-d '{
24+
"@timestamp": "2020-05-11T10:31:30.452Z",
25+
"service": {
26+
"version": "1.2"
27+
},
28+
"message": "Revert upgrade",
29+
"tags": [
30+
"elastic.co", "customer"
31+
]
32+
}'
33+
----
34+
35+
For more information, the Kibana <<api,REST API reference>> provides information on how to use Kibana APIs,
36+
like required request headers and authentication options.
37+
38+
// AGENT CONFIG API
39+
// GET --> Feature (APM) Read
40+
// CREATE/EDIT/DELETE --> Feature (APM) All
41+
42+
// ANNOTATION API
43+
// Feature (APM) All
44+
// Index: `observability-annotations`. Privileges: `create_index`, `create_doc`, `manage`, and `read`.
1545

1646
////
1747
*******************************************************
1848
////
1949

50+
[role="xpack"]
2051
[[agent-config-api]]
2152
=== Agent Configuration API
2253

@@ -274,6 +305,118 @@ POST /api/apm/settings/agent-configuration/search
274305
}
275306
--------------------------------------------------
276307

308+
////
309+
*******************************************************
310+
*******************************************************
311+
////
312+
313+
[role="xpack"]
314+
[[apm-annotation-api]]
315+
=== Annotation API
316+
317+
The Annotation API allows you to annotate visualizations in the APM app with significant events, like deployments,
318+
allowing you to easily see how these events are impacting the performance of your existing applications.
319+
320+
The following APIs are available:
321+
322+
* <<apm-annotation-create>> to create an annotation for APM.
323+
// * <<obs-annotation-create>> POST /api/observability/annotation
324+
// * <<obs-annotation-get>> GET /api/observability/annotation/:id
325+
// * <<obs-annotation-delete>> DELETE /api/observability/annotation/:id
326+
327+
By default, annotations are stored in a newly created `observability-annotations` index.
328+
The name of this index can be changed in your `config.yml` by editing `xpack.observability.annotations.index`.
329+
277330
////
278331
*******************************************************
279332
////
333+
334+
[[apm-annotation-create]]
335+
==== Create or update annotation
336+
337+
[[apm-annotation-config-req]]
338+
===== Request
339+
340+
`POST /api/apm/services/:serviceName/annotation`
341+
342+
[role="child_attributes"]
343+
[[apm-annotation-config-req-body]]
344+
===== Request body
345+
346+
`service`::
347+
(required, object) Service identifying the configuration to create or update.
348+
+
349+
.Properties of `service`
350+
[%collapsible%open]
351+
======
352+
`version` :::
353+
(required, string) Name of service.
354+
355+
`environment` :::
356+
(optional, string) Environment of service.
357+
======
358+
359+
`@timestamp`::
360+
(required, string) The date and time of the annotation. Must be in https://www.w3.org/TR/NOTE-datetime[ISO 8601] format.
361+
362+
`message`::
363+
(optional, string) The message displayed in the annotation. Defaults to `service.version`.
364+
365+
`tags`::
366+
(optional, array) Tags are used by the APM app to distinguish APM annotations from other annotations.
367+
Tags may have additional functionality in future releases. Defaults to `[apm]`.
368+
While you can add additional tags, you cannot remove the `apm` tag.
369+
370+
[[apm-annotation-config-example]]
371+
===== Example
372+
373+
The following example creates an annotation for a service named `opbeans-java`.
374+
375+
[source,console]
376+
--------------------------------------------------
377+
POST /api/apm/services/opbeans-java/annotation
378+
{
379+
"@timestamp": "2020-05-08T10:31:30.452Z",
380+
"service": {
381+
"version": "1.2"
382+
},
383+
"message": "Deployment 1.2",
384+
"tags": [
385+
"elastic.co", "customer"
386+
]
387+
}
388+
--------------------------------------------------
389+
390+
[[apm-annotation-config-body]]
391+
===== Response body
392+
393+
[source,js]
394+
--------------------------------------------------
395+
{
396+
"_index": "observability-annotations",
397+
"_id": "Lc9I93EBh6DbmkeV7nFX",
398+
"_version": 1,
399+
"_seq_no": 12,
400+
"_primary_term": 1,
401+
"found": true,
402+
"_source": {
403+
"message": "Deployment 1.2",
404+
"@timestamp": "2020-05-08T10:31:30.452Z",
405+
"service": {
406+
"version": "1.2",
407+
"name": "opbeans-java"
408+
},
409+
"tags": [
410+
"apm",
411+
"elastic.co",
412+
"customer"
413+
],
414+
"annotation": {
415+
"type": "deployment"
416+
},
417+
"event": {
418+
"created": "2020-05-09T02:34:43.937Z"
419+
}
420+
}
421+
}
422+
--------------------------------------------------

docs/apm/deployment-annotations.asciidoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
=== Track deployments with annotations
44

55
++++
6-
<titleabbrev>Track deployments</titleabbrev>
6+
<titleabbrev>Track deployments with annotations</titleabbrev>
77
++++
88

99
For enhanced visibility into your deployments, we offer deployment annotations on all transaction charts.
1010
This feature automatically tags new deployments, so you can easily see if your deploy has increased response times
1111
for an end-user, or if the memory/CPU footprint of your application has changed.
1212
Being able to identify bad deployments quickly enables you to rollback and fix issues without causing costly outages.
1313

14-
Deployment annotations are automatically enabled, and appear when the `service.version` of your app changes.
14+
Deployment annotations are enabled by default, and can be created with the <<apm-annotation-api,annotation API>>.
15+
If there are no created annotations for the selected time period,
16+
the APM app will automatically annotate your data if the `service.version` of your application changes.
17+
18+
NOTE: If custom annotations have been created for the selected time period, any derived annotations, i.e., those created automatically when `service.version` changes, will not be shown.
1519

1620
[role="screenshot"]
1721
image::apm/images/apm-transaction-annotation.png[Example view of transactions annotation in the APM app in Kibana]
356 KB
Loading

docs/settings/apm-settings.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Changing these settings may disable features of the APM App.
5252
| `xpack.apm.ui.maxTraceItems` {ess-icon}
5353
| Maximum number of child items displayed when viewing trace details. Defaults to `1000`.
5454

55+
| `xpack.observability.annotations.index`
56+
| Index name where Observability annotations are stored. Defaults to `observability-annotations`.
57+
5558
| `apm_oss.indexPattern` {ess-icon}
5659
| The index pattern used for integrations with Machine Learning and Query Bar.
5760
It must match all apm indices. Defaults to `apm-*`.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@
298298
"@elastic/eslint-plugin-eui": "0.0.2",
299299
"@elastic/github-checks-reporter": "0.0.20b3",
300300
"@elastic/makelogs": "^5.0.1",
301-
"@elastic/static-fs": "1.0.2",
302301
"@kbn/dev-utils": "1.0.0",
303302
"@kbn/es": "1.0.0",
304303
"@kbn/eslint-import-resolver-kibana": "2.0.0",

packages/kbn-optimizer/src/run_optimizer.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,26 @@ export type OptimizerUpdate = Update<OptimizerEvent, OptimizerState>;
3939
export type OptimizerUpdate$ = Rx.Observable<OptimizerUpdate>;
4040

4141
export function runOptimizer(config: OptimizerConfig) {
42-
return Rx.defer(async () => ({
43-
startTime: Date.now(),
44-
cacheKey: await getOptimizerCacheKey(config),
45-
})).pipe(
42+
return Rx.defer(async () => {
43+
if (process.platform === 'darwin') {
44+
try {
45+
require.resolve('fsevents');
46+
} catch (error) {
47+
if (error.code === 'MODULE_NOT_FOUND') {
48+
throw new Error(
49+
'`fsevents` module is not installed, most likely because you need to follow the instructions at https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md and re-bootstrap Kibana'
50+
);
51+
}
52+
53+
throw error;
54+
}
55+
}
56+
57+
return {
58+
startTime: Date.now(),
59+
cacheKey: await getOptimizerCacheKey(config),
60+
};
61+
}).pipe(
4662
mergeMap(({ startTime, cacheKey }) => {
4763
const bundleCacheEvent$ = getBundleCacheEvent$(config, cacheKey).pipe(
4864
observeOn(Rx.asyncScheduler),

scripts/kibana.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
require('../src/setup_node_env');
2120
require('../src/apm')(process.env.ELASTIC_APM_PROXY_SERVICE_NAME || 'kibana-proxy');
21+
require('../src/setup_node_env');
2222
require('../src/cli/cli');

src/cli/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
require('../setup_node_env');
2120
require('../apm')();
21+
require('../setup_node_env');
2222
require('./cli');

src/dev/build/build_distributables.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
CreatePackageJsonTask,
4141
CreateReadmeTask,
4242
CreateRpmPackageTask,
43-
CreateStaticFsWithNodeModulesTask,
4443
DownloadNodeBuildsTask,
4544
ExtractNodeBuildsTask,
4645
InstallDependenciesTask,
@@ -127,7 +126,6 @@ export async function buildDistributables(options) {
127126
await run(CleanTypescriptTask);
128127
await run(CleanExtraFilesFromModulesTask);
129128
await run(CleanEmptyFoldersTask);
130-
await run(CreateStaticFsWithNodeModulesTask);
131129

132130
/**
133131
* copy generic build outputs into platform-specific build

src/dev/build/tasks/create_static_fs_with_node_modules_task.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)