Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Jan 12, 2024
1 parent bbecbdf commit a6b9413
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

export const randomNames = [
export const randomGreekishNames = [
'Adonis',
'Agamemnon',
'Ajax',
Expand Down Expand Up @@ -135,5 +135,5 @@ export const randomNames = [
];

export function getRandomNameForIndex(index: number) {
return randomNames[index % randomNames.length];
return randomGreekishNames[index % randomGreekishNames.length];
}
5 changes: 2 additions & 3 deletions packages/kbn-apm-synthtrace/src/scenarios/many_instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import { random, times } from 'lodash';
import { Scenario } from '../cli/scenario';
import { getSynthtraceEnvironment } from '../lib/utils/get_synthtrace_environment';
import { withClient } from '../lib/utils/with_client';
import { randomNames } from './helpers/random_names';
import { getRandomNameForIndex } from './helpers/random_names';

const ENVIRONMENT = getSynthtraceEnvironment(__filename);

const scenario: Scenario<ApmFields> = async ({ logger, scenarioOpts = { instances: 2000 } }) => {
const numInstances = scenarioOpts.instances;
const serviceNames = randomNames;
const agentVersions = ['2.1.0', '2.0.0', '1.15.0', '1.14.0', '1.13.1'];
const language = 'go';
const serviceName = 'synth-many-instances';
Expand All @@ -27,7 +26,7 @@ const scenario: Scenario<ApmFields> = async ({ logger, scenarioOpts = { instance
generate: ({ range, clients: { apmEsClient } }) => {
const instances = times(numInstances).map((index) => {
const agentVersion = agentVersions[index % agentVersions.length];
const randomName = serviceNames[index % serviceNames.length];
const randomName = getRandomNameForIndex(index);
return apm
.service({
name: serviceName,
Expand Down
5 changes: 2 additions & 3 deletions packages/kbn-apm-synthtrace/src/scenarios/many_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import { flatten, random, times } from 'lodash';
import { Scenario } from '../cli/scenario';
import { getSynthtraceEnvironment } from '../lib/utils/get_synthtrace_environment';
import { withClient } from '../lib/utils/with_client';
import { randomNames } from './helpers/random_names';
import { getRandomNameForIndex } from './helpers/random_names';

const ENVIRONMENT = getSynthtraceEnvironment(__filename);

const scenario: Scenario<ApmFields> = async ({ logger, scenarioOpts = { services: 2000 } }) => {
const numServices = scenarioOpts.services;
const transactionName = 'GET /order/{id}';
const languages = ['go', 'dotnet', 'java', 'python'];
const serviceNames = randomNames;
const agentVersions: Record<string, string[]> = {
go: ['2.1.0', '2.0.0', '1.15.0', '1.14.0', '1.13.1'],
dotnet: ['1.18.0', '1.17.0', '1.16.1', '1.16.0', '1.15.0'],
Expand All @@ -39,7 +38,7 @@ const scenario: Scenario<ApmFields> = async ({ logger, scenarioOpts = { services
return times(numOfInstances).map((instanceIndex) =>
apm
.service({
name: `${serviceNames[index % serviceNames.length]}-${language}-${index}`,
name: `${getRandomNameForIndex(index)}-${language}-${index}`,
environment: ENVIRONMENT,
agentName: language,
})
Expand Down

0 comments on commit a6b9413

Please sign in to comment.