Skip to content

Commit

Permalink
[CI] Enables APM collection (#81731) (#84929)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley authored Dec 3, 2020
1 parent 4d19cab commit 9a8351c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 10 additions & 4 deletions packages/kbn-apm-config-loader/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,27 @@ import { ApmAgentConfig } from './types';

const getDefaultConfig = (isDistributable: boolean): ApmAgentConfig => {
// https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html

return {
active: process.env.ELASTIC_APM_ACTIVE || false,
active: process.env.ELASTIC_APM_ACTIVE === 'true' || false,
environment: process.env.ELASTIC_APM_ENVIRONMENT || process.env.NODE_ENV || 'development',

serverUrl: 'https://b1e3b4b4233e44cdad468c127d0af8d8.apm.europe-west1.gcp.cloud.es.io:443',
serverUrl: 'https://38b80fbd79fb4c91bae06b4642d4d093.apm.us-east-1.aws.cloud.es.io',

// The secretToken below is intended to be hardcoded in this file even though
// it makes it public. This is not a security/privacy issue. Normally we'd
// instead disable the need for a secretToken in the APM Server config where
// the data is transmitted to, but due to how it's being hosted, it's easier,
// for now, to simply leave it in.
secretToken: '2OyjjaI6RVkzx2O5CV',
secretToken: 'ZQHYvrmXEx04ozge8F',

logUncaughtExceptions: true,
globalLabels: {},
centralConfig: false,
metricsInterval: isDistributable ? '120s' : '30s',
transactionSampleRate: process.env.ELASTIC_APM_TRANSACTION_SAMPLE_RATE
? parseFloat(process.env.ELASTIC_APM_TRANSACTION_SAMPLE_RATE)
: 1.0,

// Can be performance intensive, disabling by default
breakdownMetrics: isDistributable ? false : true,
Expand Down Expand Up @@ -150,8 +155,9 @@ export class ApmConfiguration {
globalLabels: {
branch: process.env.ghprbSourceBranch || '',
targetBranch: process.env.ghprbTargetBranch || '',
ciJobName: process.env.JOB_NAME || '',
ciBuildNumber: process.env.BUILD_NUMBER || '',
isPr: process.env.GITHUB_PR_NUMBER ? true : false,
prId: process.env.GITHUB_PR_NUMBER || '',
},
};
}
Expand Down
5 changes: 4 additions & 1 deletion vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def withFunctionalTestEnv(List additionalEnvs = [], Closure closure) {
def esTransportPort = "61${parallelId}3"
def fleetPackageRegistryPort = "61${parallelId}4"
def alertingProxyPort = "61${parallelId}5"
def apmActive = githubPr.isPr() ? "false" : "true"

withEnv([
"CI_GROUP=${parallelId}",
Expand All @@ -101,7 +102,9 @@ def withFunctionalTestEnv(List additionalEnvs = [], Closure closure) {
"TEST_ES_TRANSPORT_PORT=${esTransportPort}",
"KBN_NP_PLUGINS_BUILT=true",
"FLEET_PACKAGE_REGISTRY_PORT=${fleetPackageRegistryPort}",
"ALERTING_PROXY_PORT=${alertingProxyPort}"
"ALERTING_PROXY_PORT=${alertingProxyPort}",
"ELASTIC_APM_ACTIVE=${apmActive}",
"ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1",
] + additionalEnvs) {
closure()
}
Expand Down

0 comments on commit 9a8351c

Please sign in to comment.