Skip to content

Commit

Permalink
chore(investigate): Add investigate-app plugin from poc (#188122)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme authored Jul 23, 2024
1 parent 3c97fba commit aa67c80
Show file tree
Hide file tree
Showing 97 changed files with 6,100 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ x-pack/plugins/integration_assistant @elastic/security-solution
src/plugins/interactive_setup @elastic/kibana-security
test/interactive_setup_api_integration/plugins/test_endpoints @elastic/kibana-security
packages/kbn-interpreter @elastic/kibana-visualizations
x-pack/plugins/observability_solution/investigate_app @elastic/obs-ai-assistant
x-pack/plugins/observability_solution/investigate @elastic/obs-ux-management-team
packages/kbn-io-ts-utils @elastic/obs-knowledge-team
packages/kbn-ipynb @elastic/search-kibana
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ the infrastructure monitoring use-case within Kibana.
|undefined
|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/investigate_app/README.md[investigateApp]
|undefined
|{kib-repo}blob/{branch}/x-pack/plugins/kubernetes_security/README.md[kubernetesSecurity]
|This plugin provides interactive visualizations of your Kubernetes workload and session data.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@
"@kbn/interactive-setup-plugin": "link:src/plugins/interactive_setup",
"@kbn/interactive-setup-test-endpoints-plugin": "link:test/interactive_setup_api_integration/plugins/test_endpoints",
"@kbn/interpreter": "link:packages/kbn-interpreter",
"@kbn/investigate-app-plugin": "link:x-pack/plugins/observability_solution/investigate_app",
"@kbn/investigate-plugin": "link:x-pack/plugins/observability_solution/investigate",
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",
"@kbn/ipynb": "link:packages/kbn-ipynb",
Expand Down Expand Up @@ -1058,6 +1059,7 @@
"he": "^1.2.0",
"history": "^4.9.0",
"hjson": "3.2.1",
"html2canvas": "^1.4.1",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"i18n-iso-countries": "^4.3.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/deeplinks/observability/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const SLO_APP_ID = 'slo';

export const AI_ASSISTANT_APP_ID = 'observabilityAIAssistant';

export const INVESTIGATE_APP_ID = 'investigate';

export const OBLT_UX_APP_ID = 'ux';

export const OBLT_PROFILING_APP_ID = 'profiling';
28 changes: 28 additions & 0 deletions packages/kbn-io-ts-utils/src/strict_keys_rt/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { strictKeysRt } from '.';
import { jsonRt } from '../json_rt';
import { PathReporter } from 'io-ts/lib/PathReporter';
import { isoToEpochRt } from '../iso_to_epoch_rt';
import { toBooleanRt } from '../to_boolean_rt';

describe('strictKeysRt', () => {
it('correctly and deeply validates object keys', () => {
Expand Down Expand Up @@ -238,6 +239,33 @@ describe('strictKeysRt', () => {
});
});

it('deals with union types', () => {
const type = t.intersection([
t.type({
required: t.string,
}),
t.partial({
disable: t.union([
toBooleanRt,
t.type({
except: t.array(t.string),
}),
]),
}),
]);

const value = {
required: 'required',
disable: {
except: ['foo'],
},
};

const asStrictType = strictKeysRt(type);

expect(isRight(asStrictType.decode(value))).toBe(true);
});

it('does not support piped types', () => {
const typeA = t.type({
query: t.type({ filterNames: jsonRt.pipe(t.array(t.string)) }),
Expand Down
15 changes: 14 additions & 1 deletion packages/kbn-io-ts-utils/src/to_boolean_rt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,23 @@

import * as t from 'io-ts';

export function isPrimitive(value: unknown): value is string | number | boolean | null | undefined {
return (
typeof value === 'string' ||
typeof value === 'number' ||
typeof value === 'boolean' ||
value === null ||
value === undefined
);
}

export const toBooleanRt = new t.Type<boolean, boolean, unknown>(
'ToBoolean',
t.boolean.is,
(input) => {
(input, context) => {
if (!isPrimitive(input)) {
return t.failure(input, context);
}
let value: boolean;
if (typeof input === 'string') {
value = input === 'true';
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pageLoadAssetSize:
integrationAssistant: 19524
interactiveSetup: 80000
investigate: 17970
investigateApp: 91898
kibanaOverview: 56279
kibanaReact: 74422
kibanaUsageCollection: 16463
Expand Down
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const storybookAliases = {
grouping: 'packages/kbn-grouping/.storybook',
home: 'src/plugins/home/.storybook',
infra: 'x-pack/plugins/observability_solution/infra/.storybook',
investigate: 'x-pack/plugins/observability_solution/investigate_app/.storybook',
kibana_react: 'src/plugins/kibana_react/.storybook',
lists: 'x-pack/plugins/lists/.storybook',
logs_explorer: 'x-pack/plugins/observability_solution/logs_explorer/.storybook',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export const applicationUsageSchema = {
fleet: commonSchema,
integrations: commonSchema,
ingestManager: commonSchema,
investigate: commonSchema,
lens: commonSchema,
maps: commonSchema,
ml: commonSchema,
Expand Down
131 changes: 131 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4325,6 +4325,137 @@
}
}
},
"investigate": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "Always `main`"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 90 days"
}
},
"views": {
"type": "array",
"items": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "The application view being tracked"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application sub view since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application sub view is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
}
}
}
}
}
}
},
"lens": {
"properties": {
"appId": {
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,8 @@
"@kbn/interactive-setup-test-endpoints-plugin/*": ["test/interactive_setup_api_integration/plugins/test_endpoints/*"],
"@kbn/interpreter": ["packages/kbn-interpreter"],
"@kbn/interpreter/*": ["packages/kbn-interpreter/*"],
"@kbn/investigate-app-plugin": ["x-pack/plugins/observability_solution/investigate_app"],
"@kbn/investigate-app-plugin/*": ["x-pack/plugins/observability_solution/investigate_app/*"],
"@kbn/investigate-plugin": ["x-pack/plugins/observability_solution/investigate"],
"@kbn/investigate-plugin/*": ["x-pack/plugins/observability_solution/investigate/*"],
"@kbn/io-ts-utils": ["packages/kbn-io-ts-utils"],
Expand Down
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"xpack.ingestPipelines": "plugins/ingest_pipelines",
"xpack.integrationAssistant": "plugins/integration_assistant",
"xpack.investigate": "plugins/observability_solution/investigate",
"xpack.investigateApp": "plugins/observability_solution/investigate_app",
"xpack.kubernetesSecurity": "plugins/kubernetes_security",
"xpack.lens": "plugins/lens",
"xpack.licenseApiGuard": "plugins/license_api_guard",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { isPlainObject, mergeWith } from 'lodash';

type DeepOverwrite<T, U> = T extends Record<string, any>
? Omit<T, keyof U> & {
[TKey in keyof U]: T extends Record<TKey, any> ? DeepOverwrite<T[TKey], U[TKey]> : U[TKey];
}
: U;

type DeepPartialPlainObjects<T> = T extends Record<string, any>
? Partial<{
[TKey in keyof T]: DeepPartialPlainObjects<T[TKey]>;
}>
: T;

function mergePlainObjectsOnly<T, U>(val: T, src: U): DeepOverwrite<T, U> {
if (isPlainObject(src)) {
return mergeWith({}, val, src, mergePlainObjectsOnly) as DeepOverwrite<T, U>;
}
return src as DeepOverwrite<T, U>;
}

export function extendProps<
T extends Record<string, any> | undefined,
U extends DeepPartialPlainObjects<T>
>(props: T, extension: U): DeepOverwrite<T, U> {
return mergePlainObjectsOnly(props, extension);
}
Loading

0 comments on commit aa67c80

Please sign in to comment.