mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
And disables RUM.
This commit is contained in:
parent
0a949de7c8
commit
db941ae382
4 changed files with 36 additions and 5 deletions
|
@ -72,9 +72,7 @@ export TEST_BROWSER_HEADLESS=1
|
|||
|
||||
export ELASTIC_APM_ENVIRONMENT=ci
|
||||
export ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1
|
||||
export ELASTIC_APM_SERVER_URL=https://kibana-ci-apm.apm.us-central1.gcp.cloud.es.io
|
||||
# Not really a secret, if APM supported public auth we would use it and APM requires that we use this name
|
||||
export ELASTIC_APM_SECRET_TOKEN=7YKhoXsO4MzjhXjx2c
|
||||
export ELASTIC_APM_KIBANA_FRONTEND_ACTIVE=false
|
||||
|
||||
if is_pr; then
|
||||
if is_pr_with_label "ci:collect-apm"; then
|
||||
|
|
|
@ -122,6 +122,12 @@ EOF
|
|||
|
||||
SONAR_LOGIN=$(vault_get sonarqube token)
|
||||
export SONAR_LOGIN
|
||||
|
||||
ELASTIC_APM_SERVER_URL=$(vault_get project-kibana-ci-apm apm_server_url)
|
||||
export ELASTIC_APM_SERVER_URL
|
||||
|
||||
ELASTIC_APM_API_KEY=$(vault_get project-kibana-ci-apm apm_server_api_key)
|
||||
export ELASTIC_APM_API_KEY
|
||||
}
|
||||
|
||||
# Set up GCS Service Account for CDN
|
||||
|
|
|
@ -151,6 +151,7 @@ describe('ApmConfiguration', () => {
|
|||
delete process.env.ELASTIC_APM_ENVIRONMENT;
|
||||
delete process.env.ELASTIC_APM_SECRET_TOKEN;
|
||||
delete process.env.ELASTIC_APM_API_KEY;
|
||||
delete process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE;
|
||||
delete process.env.ELASTIC_APM_SERVER_URL;
|
||||
delete process.env.ELASTIC_APM_GLOBAL_LABELS;
|
||||
delete process.env.NODE_ENV;
|
||||
|
@ -202,6 +203,18 @@ describe('ApmConfiguration', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('ELASTIC_APM_KIBANA_FRONTEND_ACTIVE', () => {
|
||||
process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE = 'false';
|
||||
const config = new ApmConfiguration(mockedRootDir, {}, false);
|
||||
const serverConfig = config.getConfig('servicesOverrides');
|
||||
// @ts-ignore
|
||||
expect(serverConfig.servicesOverrides).toEqual({
|
||||
'kibana-frontend': {
|
||||
active: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('does not override the environment from NODE_ENV if already set in the config file', () => {
|
||||
const kibanaConfig = {
|
||||
elastic: {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { join } from 'path';
|
||||
import deepmerge from 'deepmerge';
|
||||
import { merge } from 'lodash';
|
||||
import { merge, isEmpty } from 'lodash';
|
||||
import { execSync } from 'child_process';
|
||||
import { getDataPath } from '@kbn/utils';
|
||||
import { readFileSync } from 'fs';
|
||||
|
@ -79,7 +79,8 @@ export class ApmConfiguration {
|
|||
}
|
||||
|
||||
public getConfig(serviceName: string): AgentConfigOptions {
|
||||
const { servicesOverrides = {} } = this.getConfigFromKibanaConfig();
|
||||
const kibanaConfig = this.getConfigFromKibanaConfig();
|
||||
const { servicesOverrides = {} } = merge(kibanaConfig, this.getConfigFromEnv(kibanaConfig));
|
||||
|
||||
let baseConfig = {
|
||||
...this.getBaseConfig(),
|
||||
|
@ -139,11 +140,20 @@ export class ApmConfiguration {
|
|||
*/
|
||||
private getConfigFromEnv(configFromKibanaConfig: AgentConfigOptions): AgentConfigOptions {
|
||||
const config: AgentConfigOptions = {};
|
||||
const servicesOverrides: Record<string, AgentConfigOptions> = {};
|
||||
|
||||
if (process.env.ELASTIC_APM_ACTIVE === 'true') {
|
||||
config.active = true;
|
||||
}
|
||||
|
||||
if (process.env.ELASTIC_APM_KIBANA_FRONTEND_ACTIVE === 'false') {
|
||||
merge(servicesOverrides, {
|
||||
'kibana-frontend': {
|
||||
active: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'true') {
|
||||
config.contextPropagationOnly = true;
|
||||
} else if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'false') {
|
||||
|
@ -186,6 +196,10 @@ export class ApmConfiguration {
|
|||
);
|
||||
}
|
||||
|
||||
if (!isEmpty(servicesOverrides)) {
|
||||
merge(config, { servicesOverrides });
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue