-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Backport This will backport the following commits from `main` to `8.15`: - [fixed rds and aws cpu percentages. (#188768)](#188768) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Bryce Buchanan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-29T16:31:23Z","message":"fixed rds and aws cpu percentages. (#188768)\n\n## Summary\r\n\r\nThis PR fixes incorrect cpu percentage values in AWS and Redis metrics\r\ndisplayed on the Infra inventory page. (#179807)\r\nI also added synthtrace for redis based off #179809\r\n<img width=\"2672\" alt=\"Screenshot 2024-07-19 at 09 32 55\"\r\nsrc=\"https://github.com/user-attachments/assets/23dd4c83-a11c-4ad9-87df-b0bf620b8e31\">","sha":"80cd581ee80ee4baa932c6fd9c68658ece006e07","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.16.0"],"title":"fixed rds and aws cpu percentages.","number":188768,"url":"https://github.com/elastic/kibana/pull/188768","mergeCommit":{"message":"fixed rds and aws cpu percentages. (#188768)\n\n## Summary\r\n\r\nThis PR fixes incorrect cpu percentage values in AWS and Redis metrics\r\ndisplayed on the Infra inventory page. (#179807)\r\nI also added synthtrace for redis based off #179809\r\n<img width=\"2672\" alt=\"Screenshot 2024-07-19 at 09 32 55\"\r\nsrc=\"https://github.com/user-attachments/assets/23dd4c83-a11c-4ad9-87df-b0bf620b8e31\">","sha":"80cd581ee80ee4baa932c6fd9c68658ece006e07"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/188768","number":188768,"mergeCommit":{"message":"fixed rds and aws cpu percentages. (#188768)\n\n## Summary\r\n\r\nThis PR fixes incorrect cpu percentage values in AWS and Redis metrics\r\ndisplayed on the Infra inventory page. (#179807)\r\nI also added synthtrace for redis based off #179809\r\n<img width=\"2672\" alt=\"Screenshot 2024-07-19 at 09 32 55\"\r\nsrc=\"https://github.com/user-attachments/assets/23dd4c83-a11c-4ad9-87df-b0bf620b8e31\">","sha":"80cd581ee80ee4baa932c6fd9c68658ece006e07"}}]}] BACKPORT--> Co-authored-by: Bryce Buchanan <[email protected]>
- Loading branch information
1 parent
2a85ce1
commit 6bbb3b4
Showing
10 changed files
with
117 additions
and
6 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
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
49 changes: 49 additions & 0 deletions
49
packages/kbn-apm-synthtrace-client/src/lib/infra/aws/rds.ts
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,49 @@ | ||
/* | ||
* 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'; | ||
|
||
export interface AWSRdsDocument extends Fields { | ||
'aws.rds.db_instance.arn': string; | ||
'aws.rds.db_instance.identifier': string; | ||
'metricset.name'?: string; | ||
'event.dataset'?: string; | ||
} | ||
|
||
export interface AWSRdsMetricsDocument extends AWSRdsDocument { | ||
'aws.rds.cpu.total.pct'?: number; | ||
'aws.rds.database_connections'?: number; | ||
'aws.rds.latency.dml'?: number; | ||
'aws.rds.latency.read'?: number; | ||
'aws.rds.latency.write'?: number; | ||
'aws.rds.latency.insert'?: number; | ||
'aws.rds.latency.update'?: number; | ||
'aws.rds.latency.commit'?: number; | ||
'aws.rds.queries'?: number; | ||
} | ||
|
||
class AWSRdsMetrics extends Serializable<AWSRdsMetricsDocument> {} | ||
|
||
export class AWSRds extends Entity<AWSRdsDocument> { | ||
metrics(metricsFields: AWSRdsMetricsDocument) { | ||
return new AWSRdsMetrics({ | ||
...this.fields, | ||
...metricsFields, | ||
}); | ||
} | ||
} | ||
|
||
export function awsRds(arn: string, name: string): AWSRds { | ||
return new AWSRds({ | ||
'aws.rds.db_instance.arn': arn, | ||
'aws.rds.db_instance.identifier': name, | ||
'event.dataset': 'aws.rds', | ||
}); | ||
} |
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
56 changes: 56 additions & 0 deletions
56
packages/kbn-apm-synthtrace/src/scenarios/infra_aws_rds.ts
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,56 @@ | ||
/* | ||
* 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, ApmFields, infra } from '@kbn/apm-synthtrace-client'; | ||
import { Scenario } from '../cli/scenario'; | ||
import { withClient } from '../lib/utils/with_client'; | ||
|
||
const numRds = 50; | ||
const scenario: Scenario<InfraDocument | ApmFields> = async (runOptions) => { | ||
return { | ||
generate: ({ range, clients: { infraEsClient } }) => { | ||
const { logger } = runOptions; | ||
|
||
// Infra hosts Data logic | ||
|
||
const RDS = Array(numRds) | ||
.fill(0) | ||
.map((_, idx) => infra.awsRds(`redis-${idx}`, `redis-${idx}`)); | ||
|
||
const rds = range | ||
.interval('30s') | ||
.rate(1) | ||
.generator((timestamp) => | ||
RDS.flatMap((item) => [ | ||
item | ||
.metrics({ | ||
...item.fields, | ||
'aws.rds.cpu.total.pct': 0.4, | ||
'aws.rds.database_connections': 5, | ||
'aws.rds.latency.read': 500 * 1000, | ||
'aws.rds.latency.write': 500 * 1000, | ||
'aws.rds.latency.insert': 500 * 1000, | ||
'aws.rds.latency.update': 500 * 1000, | ||
'aws.rds.latency.commit': 500 * 1000, | ||
'aws.rds.latency.dml': 500 * 1000, | ||
'aws.rds.queries': 100, | ||
}) | ||
.timestamp(timestamp), | ||
]) | ||
); | ||
|
||
return [ | ||
withClient( | ||
infraEsClient, | ||
logger.perf('generating_infra_aws_rds', () => rds) | ||
), | ||
]; | ||
}, | ||
}; | ||
}; | ||
|
||
export default scenario; |
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