-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '7.x' of github.com:elastic/kibana into backport/7.x/pr-…
…56587 # Conflicts: # x-pack/legacy/plugins/siem/public/pages/hosts/hosts_tabs.tsx # x-pack/legacy/plugins/siem/public/pages/network/navigation/network_routes.tsx
- Loading branch information
Showing
711 changed files
with
7,195 additions
and
4,490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,260 @@ | ||
[role="xpack"] | ||
[[apm-api]] | ||
== API | ||
|
||
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>>. | ||
|
||
//// | ||
******************************************************* | ||
//// | ||
|
||
[[agent-config-api]] | ||
=== Agent Configuration API | ||
|
||
The Agent configuration API allows you to fine-tune your APM agent configuration, | ||
without needing to redeploy your application. | ||
|
||
The following Agent configuration APIs are available: | ||
|
||
* <<apm-update-config>> to create or update an Agent configuration | ||
* <<apm-delete-config>> to delete an Agent configuration. | ||
* <<apm-list-config>> to list all Agent configurations. | ||
* <<apm-search-config>> to search for an Agent configuration. | ||
|
||
//// | ||
******************************************************* | ||
//// | ||
|
||
[[apm-update-config]] | ||
==== Create or update configuration | ||
|
||
[[apm-update-config-req]] | ||
===== Request | ||
|
||
`PUT /api/apm/settings/agent-configuration` | ||
|
||
[[apm-update-config-req-body]] | ||
===== Request body | ||
|
||
`service`:: | ||
(required, object) Service identifying the configuration to create or update. | ||
|
||
`name` ::: | ||
(required, string) Name of service | ||
|
||
`environment` ::: | ||
(optional, string) Environment of service | ||
|
||
`settings`:: | ||
(required) Key/value object with settings and their corresponding value. | ||
|
||
`agent_name`:: | ||
(optional) The agent name is used by the UI to determine which settings to display. | ||
|
||
|
||
[[apm-update-config-example]] | ||
===== Example | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
PUT /api/apm/settings/agent-configuration | ||
{ | ||
"service" : { | ||
"name" : "frontend", | ||
"environment" : "production" | ||
}, | ||
"settings" : { | ||
"transaction_sample_rate" : 0.4, | ||
"capture_body" : "off", | ||
"transaction_max_spans" : 500 | ||
}, | ||
"agent_name": "nodejs" | ||
} | ||
-------------------------------------------------- | ||
|
||
//// | ||
******************************************************* | ||
//// | ||
|
||
|
||
[[apm-delete-config]] | ||
==== Delete configuration | ||
|
||
[[apm-delete-config-req]] | ||
===== Request | ||
|
||
`DELETE /api/apm/settings/agent-configuration` | ||
|
||
[[apm-delete-config-req-body]] | ||
===== Request body | ||
`service`:: | ||
(required, object) Service identifying the configuration to delete | ||
|
||
`name` ::: | ||
(required, string) Name of service | ||
|
||
`environment` ::: | ||
(optional, string) Environment of service | ||
|
||
|
||
[[apm-delete-config-example]] | ||
===== Example | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
DELETE /api/apm/settings/agent-configuration | ||
{ | ||
"service" : { | ||
"name" : "frontend", | ||
"environment": "production" | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
//// | ||
******************************************************* | ||
//// | ||
|
||
|
||
[[apm-list-config]] | ||
==== List configuration | ||
|
||
|
||
[[apm-list-config-req]] | ||
===== Request | ||
|
||
`GET /api/apm/settings/agent-configuration` | ||
|
||
[[apm-list-config-body]] | ||
===== Response body | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
[ | ||
{ | ||
"agent_name": "go", | ||
"service": { | ||
"name": "opbeans-go", | ||
"environment": "production" | ||
}, | ||
"settings": { | ||
"transaction_sample_rate": 1, | ||
"capture_body": "off", | ||
"transaction_max_spans": 200 | ||
}, | ||
"@timestamp": 1581934104843, | ||
"applied_by_agent": false, | ||
"etag": "1e58c178efeebae15c25c539da740d21dee422fc" | ||
}, | ||
{ | ||
"agent_name": "go", | ||
"service": { | ||
"name": "opbeans-go" | ||
}, | ||
"settings": { | ||
"transaction_sample_rate": 1, | ||
"capture_body": "off", | ||
"transaction_max_spans": 300 | ||
}, | ||
"@timestamp": 1581934111727, | ||
"applied_by_agent": false, | ||
"etag": "3eed916d3db434d9fb7f039daa681c7a04539a64" | ||
}, | ||
{ | ||
"agent_name": "nodejs", | ||
"service": { | ||
"name": "frontend" | ||
}, | ||
"settings": { | ||
"transaction_sample_rate": 1, | ||
}, | ||
"@timestamp": 1582031336265, | ||
"applied_by_agent": false, | ||
"etag": "5080ed25785b7b19f32713681e79f46996801a5b" | ||
} | ||
] | ||
-------------------------------------------------- | ||
|
||
[[apm-list-config-example]] | ||
===== Example | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /api/apm/settings/agent-configuration | ||
-------------------------------------------------- | ||
|
||
//// | ||
******************************************************* | ||
//// | ||
|
||
|
||
[[apm-search-config]] | ||
==== Search configuration | ||
|
||
[[apm-search-config-req]] | ||
===== Request | ||
|
||
`POST /api/apm/settings/agent-configuration/search` | ||
|
||
[[apm-search-config-req-body]] | ||
===== Request body | ||
|
||
`service`:: | ||
(required, object) Service identifying the configuration. | ||
|
||
`name` ::: | ||
(required, string) Name of service | ||
|
||
`environment` ::: | ||
(optional, string) Environment of service | ||
|
||
`etag`:: | ||
(required) etag is sent by the agent to indicate the etag of the last successfully applied configuration. If the etag matches an existing configuration its `applied_by_agent` property will be set to `true`. Every time a configuration is edited `applied_by_agent` is reset to `false`. | ||
|
||
[[apm-search-config-body]] | ||
===== Response body | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
{ | ||
"_index": ".apm-agent-configuration", | ||
"_id": "CIaqXXABmQCdPphWj8EJ", | ||
"_score": 2, | ||
"_source": { | ||
"agent_name": "nodejs", | ||
"service": { | ||
"name": "frontend" | ||
}, | ||
"settings": { | ||
"transaction_sample_rate": 1, | ||
}, | ||
"@timestamp": 1582031336265, | ||
"applied_by_agent": false, | ||
"etag": "5080ed25785b7b19f32713681e79f46996801a5b" | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
[[apm-search-config-example]] | ||
===== Example | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
POST /api/apm/settings/agent-configuration/search | ||
{ | ||
"etag" : "1e58c178efeebae15c25c539da740d21dee422fc", | ||
"service" : { | ||
"name" : "frontend", | ||
"environment": "production" | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
//// | ||
******************************************************* | ||
//// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Observable } from 'rxjs'; | ||
import { | ||
ISearchContext, | ||
TSearchStrategyProvider, | ||
ISearchStrategy, | ||
} from '../../../src/plugins/data/public'; | ||
|
||
import { ASYNC_DEMO_SEARCH_STRATEGY, IAsyncDemoResponse } from '../common'; | ||
import { ASYNC_SEARCH_STRATEGY } from '../../../x-pack/plugins/data_enhanced/public'; | ||
|
||
/** | ||
* This demo search strategy provider simply provides a shortcut for calling the DEMO_ASYNC_SEARCH_STRATEGY | ||
* on the server side, without users having to pass it in explicitly, and it takes advantage of the | ||
* already registered ASYNC_SEARCH_STRATEGY that exists on the client. | ||
* | ||
* so instead of callers having to do: | ||
* | ||
* ``` | ||
* search( | ||
* { ...request, serverStrategy: DEMO_ASYNC_SEARCH_STRATEGY }, | ||
* options, | ||
* ASYNC_SEARCH_STRATEGY | ||
* ) as Observable<IDemoResponse>, | ||
*``` | ||
* They can instead just do | ||
* | ||
* ``` | ||
* search(request, options, DEMO_ASYNC_SEARCH_STRATEGY); | ||
* ``` | ||
* | ||
* and are ensured type safety in regard to the request and response objects. | ||
* | ||
* @param context - context supplied by other plugins. | ||
* @param search - a search function to access other strategies that have already been registered. | ||
*/ | ||
export const asyncDemoClientSearchStrategyProvider: TSearchStrategyProvider<typeof ASYNC_DEMO_SEARCH_STRATEGY> = ( | ||
context: ISearchContext | ||
): ISearchStrategy<typeof ASYNC_DEMO_SEARCH_STRATEGY> => { | ||
const asyncStrategyProvider = context.getSearchStrategy(ASYNC_SEARCH_STRATEGY); | ||
const { search } = asyncStrategyProvider(context); | ||
return { | ||
search: (request, options) => { | ||
return search( | ||
{ ...request, serverStrategy: ASYNC_DEMO_SEARCH_STRATEGY }, | ||
options | ||
) as Observable<IAsyncDemoResponse>; | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.