Skip to content

Commit

Permalink
Merge branch 'master' into logs-alerting
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Apr 23, 2020
2 parents 7942328 + 46901f5 commit 4a3380b
Show file tree
Hide file tree
Showing 23 changed files with 232 additions and 157 deletions.
4 changes: 0 additions & 4 deletions docs/visualize/color-picker.asciidoc

This file was deleted.

14 changes: 0 additions & 14 deletions docs/visualize/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ beta[]

* Save your visualization for use in a dashboard.

[float]
[[lens-aggregation]]
=== Supported aggregations

Lens supports the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

* <<visualize-bucket-aggregations,Bucket>>

[float]
[[drag-drop]]
=== Drag and drop
Expand Down
14 changes: 0 additions & 14 deletions docs/visualize/most-frequent.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ The most frequently used visualizations include:

[[metric-chart]]

[float]
[[frequently-used-viz-aggregation]]
=== Supported aggregations

The most frequently used visualizations support the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

* <<visualize-bucket-aggregations,Bucket>>

[float]
=== Configure your visualization

Expand Down
13 changes: 0 additions & 13 deletions docs/visualize/tilemap.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ Display graphical representations of data where the individual values are repres
[role="screenshot"]
image::images/visualize_heat_map_example.png[]

[float]
[[build-heat-map]]
=== Build a heat map

To display your data on the heat map, use the supported aggregations.

Heat maps support the following aggregations:

* <<visualize-metric-aggregations,Metric>>
* <<visualize-parent-pipeline-aggregations,Parent pipeline>>
* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>
* <<visualize-bucket-aggregations,Bucket>>

[float]
[[navigate-heatmap]]
=== Change the color ranges
Expand Down
12 changes: 0 additions & 12 deletions docs/visualize/tsvb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ Table:: Display data from multiple time series by defining the field group to sh
[role="screenshot"]
image:images/tsvb-table.png["Table visualization"]

[float]
[[tsvb-aggregation]]
=== Supported aggregations

TSVB supports the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

[float]
[[create-tsvb-visualization]]
=== Create TSVB visualizations
Expand Down
43 changes: 0 additions & 43 deletions docs/visualize/visualize_rollup_data.asciidoc

This file was deleted.

1 change: 1 addition & 0 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {

resolve: {
extensions: ['.js', '.ts', '.tsx', '.json'],
mainFields: ['browser', 'main'],
alias: {
tinymath: require.resolve('tinymath/lib/tinymath.es5.js'),
},
Expand Down
17 changes: 13 additions & 4 deletions x-pack/plugins/apm/server/routes/settings/agent_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ export const agentConfigurationSearchRoute = createRoute(core => ({
params: {
body: t.intersection([
t.type({ service: serviceRt }),
t.partial({ etag: t.string })
t.partial({ etag: t.string, mark_as_applied_by_agent: t.boolean })
])
},
handler: async ({ context, request }) => {
const { service, etag } = context.params.body;
const {
service,
etag,
mark_as_applied_by_agent: markAsAppliedByAgent
} = context.params.body;

const setup = await setupRequest(context, request);
const config = await searchConfigurations({
Expand All @@ -166,9 +170,14 @@ export const agentConfigurationSearchRoute = createRoute(core => ({
`Config was found for ${service.name}/${service.environment}`
);

// update `applied_by_agent` field if etags match
// update `applied_by_agent` field
// when `markAsAppliedByAgent` is true (Jaeger agent doesn't have etags)
// or if etags match.
// this happens in the background and doesn't block the response
if (etag === config._source.etag && !config._source.applied_by_agent) {
if (
(markAsAppliedByAgent || etag === config._source.etag) &&
!config._source.applied_by_agent
) {
markAppliedByAgent({ id: config._id, body: config._source, setup });
}

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/ingest_manager/common/constants/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export const DEFAULT_OUTPUT = {
is_default: true,
type: OutputType.Elasticsearch,
hosts: [''],
api_key: '',
};
10 changes: 7 additions & 3 deletions x-pack/plugins/ingest_manager/common/types/models/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ export interface NewAgentAction {
sent_at?: string;
}

export type AgentAction = NewAgentAction & {
export interface AgentAction extends NewAgentAction {
id: string;
agent_id: string;
created_at: string;
} & SavedObjectAttributes;
}

export interface AgentActionSOAttributes extends NewAgentAction, SavedObjectAttributes {
export interface AgentActionSOAttributes extends SavedObjectAttributes {
type: 'CONFIG_CHANGE' | 'DATA_DUMP' | 'RESUME' | 'PAUSE';
sent_at?: string;
created_at: string;
agent_id: string;
data?: string;
}

export interface AgentEvent {
Expand Down Expand Up @@ -64,6 +67,7 @@ interface AgentBase {
shared_id?: string;
access_api_key_id?: string;
default_api_key?: string;
default_api_key_id?: string;
config_id?: string;
config_revision?: number | null;
config_newest_revision?: number;
Expand Down
10 changes: 8 additions & 2 deletions x-pack/plugins/ingest_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
SavedObjectsServiceStart,
} from 'kibana/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { EncryptedSavedObjectsPluginStart } from '../../encrypted_saved_objects/server';
import {
EncryptedSavedObjectsPluginStart,
EncryptedSavedObjectsPluginSetup,
} from '../../encrypted_saved_objects/server';
import { SecurityPluginSetup } from '../../security/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
import {
Expand All @@ -26,7 +29,7 @@ import {
AGENT_EVENT_SAVED_OBJECT_TYPE,
ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
} from './constants';

import { registerEncryptedSavedObjects } from './saved_objects';
import {
registerEPMRoutes,
registerDatasourceRoutes,
Expand All @@ -46,6 +49,7 @@ export interface IngestManagerSetupDeps {
licensing: LicensingPluginSetup;
security?: SecurityPluginSetup;
features?: FeaturesPluginSetup;
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
}

export type IngestManagerStartDeps = object;
Expand Down Expand Up @@ -97,6 +101,8 @@ export class IngestManagerPlugin
this.security = deps.security;
}

registerEncryptedSavedObjects(deps.encryptedSavedObjects);

// Register feature
// TODO: Flesh out privileges
if (deps.features) {
Expand Down
67 changes: 61 additions & 6 deletions x-pack/plugins/ingest_manager/server/saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AGENT_ACTION_SAVED_OBJECT_TYPE,
ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
} from './constants';
import { EncryptedSavedObjectsPluginSetup } from '../../encrypted_saved_objects/server';

/*
* Saved object mappings
Expand All @@ -35,7 +36,7 @@ export const savedObjectMappings = {
last_checkin: { type: 'date' },
config_revision: { type: 'integer' },
config_newest_revision: { type: 'integer' },
// FIXME_INGEST https://github.com/elastic/kibana/issues/56554
default_api_key_id: { type: 'keyword' },
default_api_key: { type: 'keyword' },
updated_at: { type: 'date' },
current_error_events: { type: 'text' },
Expand All @@ -45,8 +46,7 @@ export const savedObjectMappings = {
properties: {
agent_id: { type: 'keyword' },
type: { type: 'keyword' },
// FIXME_INGEST https://github.com/elastic/kibana/issues/56554
data: { type: 'flattened' },
data: { type: 'binary' },
sent_at: { type: 'date' },
created_at: { type: 'date' },
},
Expand Down Expand Up @@ -83,7 +83,6 @@ export const savedObjectMappings = {
properties: {
name: { type: 'keyword' },
type: { type: 'keyword' },
// FIXME_INGEST https://github.com/elastic/kibana/issues/56554
api_key: { type: 'binary' },
api_key_id: { type: 'keyword' },
config_id: { type: 'keyword' },
Expand All @@ -100,8 +99,6 @@ export const savedObjectMappings = {
is_default: { type: 'boolean' },
hosts: { type: 'keyword' },
ca_sha256: { type: 'keyword' },
// FIXME_INGEST https://github.com/elastic/kibana/issues/56554
api_key: { type: 'keyword' },
fleet_enroll_username: { type: 'binary' },
fleet_enroll_password: { type: 'binary' },
config: { type: 'flattened' },
Expand Down Expand Up @@ -165,3 +162,61 @@ export const savedObjectMappings = {
},
},
};

export function registerEncryptedSavedObjects(
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup
) {
// Encrypted saved objects
encryptedSavedObjects.registerType({
type: ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
attributesToEncrypt: new Set(['api_key']),
attributesToExcludeFromAAD: new Set([
'name',
'type',
'api_key_id',
'config_id',
'created_at',
'updated_at',
'expire_at',
'active',
]),
});
encryptedSavedObjects.registerType({
type: OUTPUT_SAVED_OBJECT_TYPE,
attributesToEncrypt: new Set(['fleet_enroll_username', 'fleet_enroll_password']),
attributesToExcludeFromAAD: new Set([
'name',
'type',
'is_default',
'hosts',
'ca_sha256',
'config',
]),
});
encryptedSavedObjects.registerType({
type: AGENT_SAVED_OBJECT_TYPE,
attributesToEncrypt: new Set(['default_api_key']),
attributesToExcludeFromAAD: new Set([
'shared_id',
'type',
'active',
'enrolled_at',
'access_api_key_id',
'version',
'user_provided_metadata',
'local_metadata',
'config_id',
'last_updated',
'last_checkin',
'config_revision',
'config_newest_revision',
'updated_at',
'current_error_events',
]),
});
encryptedSavedObjects.registerType({
type: AGENT_ACTION_SAVED_OBJECT_TYPE,
attributesToEncrypt: new Set(['data']),
attributesToExcludeFromAAD: new Set(['agent_id', 'type', 'sent_at', 'created_at']),
});
}
23 changes: 23 additions & 0 deletions x-pack/plugins/ingest_manager/server/services/agents/acks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import Boom from 'boom';
import { SavedObjectsBulkResponse } from 'kibana/server';
import { savedObjectsClientMock } from '../../../../../../src/core/server/saved_objects/service/saved_objects_client.mock';
import { encryptedSavedObjectsMock } from '../../../../../plugins/encrypted_saved_objects/server/mocks';

import {
Agent,
AgentAction,
Expand All @@ -14,10 +16,31 @@ import {
} from '../../../common/types/models';
import { AGENT_TYPE_PERMANENT } from '../../../common/constants';
import { acknowledgeAgentActions } from './acks';
import { appContextService } from '../app_context';
import { IngestManagerAppContext } from '../../plugin';

describe('test agent acks services', () => {
it('should succeed on valid and matched actions', async () => {
const mockSavedObjectsClient = savedObjectsClientMock.create();
const mockStartEncryptedSOClient = encryptedSavedObjectsMock.createStart();
appContextService.start(({
encryptedSavedObjects: mockStartEncryptedSOClient,
} as unknown) as IngestManagerAppContext);

mockStartEncryptedSOClient.getDecryptedAsInternalUser.mockReturnValue(
Promise.resolve({
id: 'action1',
references: [],
type: 'agent_actions',
attributes: {
type: 'CONFIG_CHANGE',
agent_id: 'id',
sent_at: '2020-03-14T19:45:02.620Z',
timestamp: '2019-01-04T14:32:03.36764-05:00',
created_at: '2020-03-14T19:45:02.620Z',
},
})
);

mockSavedObjectsClient.bulkGet.mockReturnValue(
Promise.resolve({
Expand Down
Loading

0 comments on commit 4a3380b

Please sign in to comment.