Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into np-migrate-maps-s…
Browse files Browse the repository at this point in the history
…erver
  • Loading branch information
Aaron Caldwell committed May 21, 2020
2 parents 998aa82 + 484e0a9 commit dfb495d
Show file tree
Hide file tree
Showing 53 changed files with 1,007 additions and 654 deletions.
149 changes: 146 additions & 3 deletions docs/apm/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,45 @@
Some APM app features are provided via a REST API:

* <<agent-config-api>>

TIP: Kibana provides additional <<api,REST APIs>>,
and general information on <<using-api,how to use APIs>>.
* <<apm-annotation-api>>

Here's an example CURL request that adds an annotation to the APM app:

[source,curl]
----
curl -X POST \
http://localhost:5601/api/apm/services/opbeans-java/annotation \
-H 'Content-Type: application/json' \
-H 'kbn-xsrf: true' \
-H 'Authorization: Basic YhUlubWZhM0FDbnlQeE6WRtaW49FQmSGZ4RUWXdX' \
-d '{
"@timestamp": "2020-05-11T10:31:30.452Z",
"service": {
"version": "1.2"
},
"message": "Revert upgrade",
"tags": [
"elastic.co", "customer"
]
}'
----

For more information, the Kibana <<api,REST API reference>> provides information on how to use Kibana APIs,
like required request headers and authentication options.

// AGENT CONFIG API
// GET --> Feature (APM) Read
// CREATE/EDIT/DELETE --> Feature (APM) All

// ANNOTATION API
// Feature (APM) All
// Index: `observability-annotations`. Privileges: `create_index`, `create_doc`, `manage`, and `read`.

////
*******************************************************
////

[role="xpack"]
[[agent-config-api]]
=== Agent Configuration API

Expand Down Expand Up @@ -274,6 +305,118 @@ POST /api/apm/settings/agent-configuration/search
}
--------------------------------------------------

////
*******************************************************
*******************************************************
////

[role="xpack"]
[[apm-annotation-api]]
=== Annotation API

The Annotation API allows you to annotate visualizations in the APM app with significant events, like deployments,
allowing you to easily see how these events are impacting the performance of your existing applications.

The following APIs are available:

* <<apm-annotation-create>> to create an annotation for APM.
// * <<obs-annotation-create>> POST /api/observability/annotation
// * <<obs-annotation-get>> GET /api/observability/annotation/:id
// * <<obs-annotation-delete>> DELETE /api/observability/annotation/:id

By default, annotations are stored in a newly created `observability-annotations` index.
The name of this index can be changed in your `config.yml` by editing `xpack.observability.annotations.index`.

////
*******************************************************
////

[[apm-annotation-create]]
==== Create or update annotation

[[apm-annotation-config-req]]
===== Request

`POST /api/apm/services/:serviceName/annotation`

[role="child_attributes"]
[[apm-annotation-config-req-body]]
===== Request body

`service`::
(required, object) Service identifying the configuration to create or update.
+
.Properties of `service`
[%collapsible%open]
======
`version` :::
(required, string) Name of service.
`environment` :::
(optional, string) Environment of service.
======

`@timestamp`::
(required, string) The date and time of the annotation. Must be in https://www.w3.org/TR/NOTE-datetime[ISO 8601] format.

`message`::
(optional, string) The message displayed in the annotation. Defaults to `service.version`.

`tags`::
(optional, array) Tags are used by the APM app to distinguish APM annotations from other annotations.
Tags may have additional functionality in future releases. Defaults to `[apm]`.
While you can add additional tags, you cannot remove the `apm` tag.

[[apm-annotation-config-example]]
===== Example

The following example creates an annotation for a service named `opbeans-java`.

[source,console]
--------------------------------------------------
POST /api/apm/services/opbeans-java/annotation
{
"@timestamp": "2020-05-08T10:31:30.452Z",
"service": {
"version": "1.2"
},
"message": "Deployment 1.2",
"tags": [
"elastic.co", "customer"
]
}
--------------------------------------------------

[[apm-annotation-config-body]]
===== Response body

[source,js]
--------------------------------------------------
{
"_index": "observability-annotations",
"_id": "Lc9I93EBh6DbmkeV7nFX",
"_version": 1,
"_seq_no": 12,
"_primary_term": 1,
"found": true,
"_source": {
"message": "Deployment 1.2",
"@timestamp": "2020-05-08T10:31:30.452Z",
"service": {
"version": "1.2",
"name": "opbeans-java"
},
"tags": [
"apm",
"elastic.co",
"customer"
],
"annotation": {
"type": "deployment"
},
"event": {
"created": "2020-05-09T02:34:43.937Z"
}
}
}
--------------------------------------------------
8 changes: 6 additions & 2 deletions docs/apm/deployment-annotations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
=== Track deployments with annotations

++++
<titleabbrev>Track deployments</titleabbrev>
<titleabbrev>Track deployments with annotations</titleabbrev>
++++

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

Deployment annotations are automatically enabled, and appear when the `service.version` of your app changes.
Deployment annotations are enabled by default, and can be created with the <<apm-annotation-api,annotation API>>.
If there are no created annotations for the selected time period,
the APM app will automatically annotate your data if the `service.version` of your application changes.

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.

[role="screenshot"]
image::apm/images/apm-transaction-annotation.png[Example view of transactions annotation in the APM app in Kibana]
Binary file modified docs/apm/images/apm-transaction-annotation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Changing these settings may disable features of the APM App.
| `xpack.apm.ui.maxTraceItems` {ess-icon}
| Maximum number of child items displayed when viewing trace details. Defaults to `1000`.

| `xpack.observability.annotations.index`
| Index name where Observability annotations are stored. Defaults to `observability-annotations`.

| `apm_oss.indexPattern` {ess-icon}
| The index pattern used for integrations with Machine Learning and Query Bar.
It must match all apm indices. Defaults to `apm-*`.
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^5.0.1",
"@elastic/static-fs": "1.0.2",
"@kbn/dev-utils": "1.0.0",
"@kbn/es": "1.0.0",
"@kbn/eslint-import-resolver-kibana": "2.0.0",
Expand Down
24 changes: 20 additions & 4 deletions packages/kbn-optimizer/src/run_optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,26 @@ export type OptimizerUpdate = Update<OptimizerEvent, OptimizerState>;
export type OptimizerUpdate$ = Rx.Observable<OptimizerUpdate>;

export function runOptimizer(config: OptimizerConfig) {
return Rx.defer(async () => ({
startTime: Date.now(),
cacheKey: await getOptimizerCacheKey(config),
})).pipe(
return Rx.defer(async () => {
if (process.platform === 'darwin') {
try {
require.resolve('fsevents');
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
throw new Error(
'`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'
);
}

throw error;
}
}

return {
startTime: Date.now(),
cacheKey: await getOptimizerCacheKey(config),
};
}).pipe(
mergeMap(({ startTime, cacheKey }) => {
const bundleCacheEvent$ = getBundleCacheEvent$(config, cacheKey).pipe(
observeOn(Rx.asyncScheduler),
Expand Down
2 changes: 1 addition & 1 deletion scripts/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

require('../src/setup_node_env');
require('../src/apm')(process.env.ELASTIC_APM_PROXY_SERVICE_NAME || 'kibana-proxy');
require('../src/setup_node_env');
require('../src/cli/cli');
2 changes: 1 addition & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

require('../setup_node_env');
require('../apm')();
require('../setup_node_env');
require('./cli');
2 changes: 0 additions & 2 deletions src/dev/build/build_distributables.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
CreatePackageJsonTask,
CreateReadmeTask,
CreateRpmPackageTask,
CreateStaticFsWithNodeModulesTask,
DownloadNodeBuildsTask,
ExtractNodeBuildsTask,
InstallDependenciesTask,
Expand Down Expand Up @@ -127,7 +126,6 @@ export async function buildDistributables(options) {
await run(CleanTypescriptTask);
await run(CleanExtraFilesFromModulesTask);
await run(CleanEmptyFoldersTask);
await run(CreateStaticFsWithNodeModulesTask);

/**
* copy generic build outputs into platform-specific build
Expand Down
64 changes: 0 additions & 64 deletions src/dev/build/tasks/create_static_fs_with_node_modules_task.js

This file was deleted.

1 change: 0 additions & 1 deletion src/dev/build/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export * from './create_archives_task';
export * from './create_empty_dirs_and_files_task';
export * from './create_package_json_task';
export * from './create_readme_task';
export * from './create_static_fs_with_node_modules_task';
export * from './install_dependencies_task';
export * from './license_file_task';
export * from './nodejs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export function validateInterval(bounds, panel, maxBuckets) {
'visTypeTimeseries.validateInterval.notifier.maxBucketsExceededErrorMessage',
{
defaultMessage:
'Max buckets exceeded: {buckets} is greater than {maxBuckets}, try a larger time interval in the panel options.',
values: { buckets, maxBuckets },
'Your query attempted to fetch too much data. Reducing the time range or changing the interval used usually fixes the issue.',
}
)
);
Expand Down
12 changes: 6 additions & 6 deletions test/visual_regression/tests/discover/chart_visualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
await takeSnapshot();
});

it('should show correct data for chart interval Hourly', async function() {
await PageObjects.discover.setChartInterval('Hourly');
it('should show correct data for chart interval Hour', async function() {
await PageObjects.discover.setChartInterval('Hour');
await takeSnapshot();
});

it('should show correct data for chart interval Daily', async function() {
await PageObjects.discover.setChartInterval('Daily');
it('should show correct data for chart interval Day', async function() {
await PageObjects.discover.setChartInterval('Day');
await takeSnapshot();
});

it('should show correct data for chart interval Weekly', async function() {
await PageObjects.discover.setChartInterval('Weekly');
it('should show correct data for chart interval Week', async function() {
await PageObjects.discover.setChartInterval('Week');
await takeSnapshot();
});

Expand Down
1 change: 1 addition & 0 deletions x-pack/dev-tools/jest/create_jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function createJestConfig({ kibanaDirectory, xPackKibanaDirectory }) {
'uiExports/(.*)': fileMockPath,
'^src/core/(.*)': `${kibanaDirectory}/src/core/$1`,
'^src/legacy/(.*)': `${kibanaDirectory}/src/legacy/$1`,
'^src/plugins/(.*)': `${kibanaDirectory}/src/plugins/$1`,
'^plugins/([^/.]*)(.*)': `${kibanaDirectory}/src/legacy/core_plugins/$1/public$2`,
'^legacy/plugins/xpack_main/(.*);': `${xPackKibanaDirectory}/legacy/plugins/xpack_main/public/$1`,
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': fileMockPath,
Expand Down
Loading

0 comments on commit dfb495d

Please sign in to comment.