Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ObsUx] [Infra] Change container details view with asset details view #180436

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
75be34e
use asset details for container details view, set tabs for container …
MiriamAparicio Apr 10, 2024
0b07216
add formulas and charts for container metrics
MiriamAparicio Apr 10, 2024
a0c7310
add synthtrace scenario for containers and use asset.id instead of as…
MiriamAparicio Apr 12, 2024
0a25326
add formulas and charts for container k8s
MiriamAparicio Apr 22, 2024
e5ef7b7
fix conflicts, wip
MiriamAparicio Apr 24, 2024
723c573
added cpu, memory sections, improvements
MiriamAparicio Apr 30, 2024
0af4da1
Merge remote-tracking branch 'upstream/main' into 179844-container-as…
MiriamAparicio Apr 30, 2024
a8b87c6
added KPI in container overview tab
MiriamAparicio Apr 30, 2024
612ed5d
delete comment, link is working now
MiriamAparicio May 2, 2024
da0639f
Merge remote-tracking branch 'upstream/main' into 179844-container-as…
MiriamAparicio May 2, 2024
6f1973f
fix conflicts after metric_data_access has been moved to observabilit…
MiriamAparicio May 2, 2024
1c1b1dd
Merge remote-tracking branch 'upstream/main' into 179844-container-as…
MiriamAparicio May 2, 2024
07eadf0
fix i18n duplicate
MiriamAparicio May 2, 2024
ab3359c
fix tests
MiriamAparicio May 6, 2024
c60d2da
fix type
MiriamAparicio May 6, 2024
ce49d33
Merge remote-tracking branch 'upstream/main' into 179844-container-as…
MiriamAparicio May 6, 2024
1be34de
fix metrics tab missing
MiriamAparicio May 6, 2024
d736646
pr review comments
MiriamAparicio May 8, 2024
5bb1fff
fix conflicts
MiriamAparicio May 8, 2024
92cbd48
fix type
MiriamAparicio May 8, 2024
fb8d378
renaming for consistency
MiriamAparicio May 8, 2024
5c664a4
split ContainerCharts
MiriamAparicio May 9, 2024
b1b75fa
rename function
MiriamAparicio May 9, 2024
3b5f01e
fix type
MiriamAparicio May 9, 2024
7753742
fix missing renaming
MiriamAparicio May 10, 2024
a69a97b
added some e2e test for container details view
MiriamAparicio May 13, 2024
8c12e90
remove load of not used archiver
MiriamAparicio May 15, 2024
f657e3e
added FF for container asset view and e2e tests
MiriamAparicio May 16, 2024
8fc3332
Merge remote-tracking branch 'upstream/main' into 179844-container-as…
MiriamAparicio May 16, 2024
3ca0f23
Merge branch 'main' into 179844-container-asset-details-view
MiriamAparicio May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable max-classes-per-file */
import { Entity, Fields } from '../entity';
import { Serializable } from '../serializable';

interface DockerContainerDocument extends Fields {
'container.id': string;
'metricset.name'?: string;
}

export class DockerContainer extends Entity<DockerContainerDocument> {
metrics() {
return new DockerContainerMetrics({
...this.fields,
'docker.cpu.total.pct': 25,
'docker.memory.usage.pct': 20,
});
}
}

export interface DockerContainerMetricsDocument extends DockerContainerDocument {
'docker.cpu.total.pct': number;
'docker.memory.usage.pct': number;
}

class DockerContainerMetrics extends Serializable<DockerContainerMetricsDocument> {}

export function dockerContainer(id: string): DockerContainer {
return new DockerContainer({
'container.id': id,
});
}
12 changes: 9 additions & 3 deletions packages/kbn-apm-synthtrace-client/src/lib/infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
* Side Public License, v 1.
*/

import { container, ContainerMetricsDocument } from './container';
import { dockerContainer, DockerContainerMetricsDocument } from './docker_container';
import { host, HostMetricsDocument } from './host';
import { k8sContainer, K8sContainerMetricsDocument } from './k8s_container';
import { pod, PodMetricsDocument } from './pod';

export type InfraDocument = HostMetricsDocument | PodMetricsDocument | ContainerMetricsDocument;
export type InfraDocument =
| HostMetricsDocument
| PodMetricsDocument
| DockerContainerMetricsDocument
| K8sContainerMetricsDocument;

export const infra = {
host,
pod,
container,
dockerContainer,
k8sContainer,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,32 @@
import { Entity, Fields } from '../entity';
import { Serializable } from '../serializable';

interface ContainerDocument extends Fields {
interface K8sContainerDocument extends Fields {
'container.id': string;
'kubernetes.pod.uid': string;
'kubernetes.node.name': string;
'metricset.name'?: string;
}

export class Container extends Entity<ContainerDocument> {
export class K8sContainer extends Entity<K8sContainerDocument> {
metrics() {
return new ContainerMetrics({
return new K8sContainerMetrics({
...this.fields,
'kubernetes.container.cpu.usage.limit.pct': 46,
'kubernetes.container.memory.usage.limit.pct': 30,
});
}
}

export interface ContainerMetricsDocument extends ContainerDocument {
export interface K8sContainerMetricsDocument extends K8sContainerDocument {
'kubernetes.container.cpu.usage.limit.pct': number;
'kubernetes.container.memory.usage.limit.pct': number;
}

class ContainerMetrics extends Serializable<ContainerMetricsDocument> {}
class K8sContainerMetrics extends Serializable<K8sContainerMetricsDocument> {}

export function container(id: string, uid: string, nodeName: string) {
return new Container({
export function k8sContainer(id: string, uid: string, nodeName: string): K8sContainer {
return new K8sContainer({
'container.id': id,
'kubernetes.pod.uid': uid,
'kubernetes.node.name': nodeName,
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-apm-synthtrace-client/src/lib/infra/pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* eslint-disable max-classes-per-file */
import { Entity, Fields } from '../entity';
import { Serializable } from '../serializable';
import { container } from './container';
import { k8sContainer } from './k8s_container';

interface PodDocument extends Fields {
'kubernetes.pod.uid': string;
Expand All @@ -26,7 +26,7 @@ export class Pod extends Entity<PodDocument> {
}

container(id: string) {
return container(id, this.fields['kubernetes.pod.uid'], this.fields['kubernetes.node.name']);
return k8sContainer(id, this.fields['kubernetes.pod.uid'], this.fields['kubernetes.node.name']);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { InfraDocument, infra } from '@kbn/apm-synthtrace-client';

import { Scenario } from '../cli/scenario';
import { withClient } from '../lib/utils/with_client';

const scenario: Scenario<InfraDocument> = async (runOptions) => {
return {
generate: ({ range, clients: { infraEsClient } }) => {
const { numContainers = 5 } = runOptions.scenarioOpts || {};
const { logger } = runOptions;

const CONTAINERS = Array(numContainers)
.fill(0)
.map((_, idx) => infra.dockerContainer(`container-${idx}`));

const containers = range
.interval('30s')
.rate(1)
.generator((timestamp) =>
CONTAINERS.flatMap((container) => [container.metrics().timestamp(timestamp)])
);

return [
withClient(
infraEsClient,
logger.perf('generating_infra_docker_containers', () => containers)
),
];
},
};
};

export default scenario;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { InfraDocument, infra } from '@kbn/apm-synthtrace-client';

import { Scenario } from '../cli/scenario';
import { withClient } from '../lib/utils/with_client';

const scenario: Scenario<InfraDocument> = async (runOptions) => {
return {
generate: ({ range, clients: { infraEsClient } }) => {
const { numContainers = 5 } = runOptions.scenarioOpts || {};
const { logger } = runOptions;

const CONTAINERS = Array(numContainers)
.fill(0)
.map((_, idx) => infra.k8sContainer(`container-${idx}`, `pod-${idx}`, `node-${idx}`));

const containers = range
.interval('30s')
.rate(1)
.generator((timestamp) =>
CONTAINERS.flatMap((container) => [container.metrics().timestamp(timestamp)])
);

return [
withClient(
infraEsClient,
logger.perf('generating_infra_containers', () => containers)
),
];
},
};
};

export default scenario;
2 changes: 2 additions & 0 deletions packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export const OBSERVABILITY_ENABLE_COMPARISON_BY_DEFAULT_ID =
'observability:enableComparisonByDefault';
export const OBSERVABILITY_ENABLE_INFRASTRUCTURE_HOSTS_VIEW_ID =
'observability:enableInfrastructureHostsView';
export const OBSERVABILITY_ENABLE_CONTAINER_ASSET_VIEW_ID =
'observability:enableContainerAssetView';
export const OBSERVABILITY_ENABLE_INFRASTRUCTURE_ASSET_CUSTOM_DASHBOARDS_ID =
'observability:enableInfrastructureAssetCustomDashboards';
export const OBSERVABILITY_ENABLE_INSPECT_ES_QUERIES_ID = 'observability:enableInspectEsQueries';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureContainerAssetView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureProfilingIntegration': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface UsageStats {
'observability:apmAWSLambdaPriceFactor': string;
'observability:apmAWSLambdaRequestCostPerMillion': number;
'observability:enableInfrastructureHostsView': boolean;
'observability:enableInfrastructureContainerAssetView': boolean;
'observability:enableInfrastructureProfilingIntegration': boolean;
'observability:enableInfrastructureAssetCustomDashboards': boolean;
'observability:apmAgentExplorerView': boolean;
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10404,6 +10404,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureContainerAssetView":{
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureProfilingIntegration": {
"type": "boolean",
"_meta": {
Expand Down
Loading