-
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.
fixed rds and aws cpu percentages. (#188768)
## Summary This PR fixes incorrect cpu percentage values in AWS and Redis metrics displayed on the Infra inventory page. (#179807) I also added synthtrace for redis based off #179809 <img width="2672" alt="Screenshot 2024-07-19 at 09 32 55" src="https://github.com/user-attachments/assets/23dd4c83-a11c-4ad9-87df-b0bf620b8e31">
- Loading branch information
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