mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
## Summary Reverting #179048 because it creates a false expectation that environment vars and config will be merged. This is true for the RUM agent. However, the NodeJS agent reads the environment vars and discards any provided config, leading to inconsistent behavior between both agents. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
759e1a5466
commit
2ad38df5cd
2 changed files with 3 additions and 23 deletions
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
import type { AgentConfigOptions, Labels } from 'elastic-apm-node';
|
||||
import {
|
||||
gitRevExecMock,
|
||||
mockedRootDir,
|
||||
packageMock,
|
||||
mockedRootDir,
|
||||
gitRevExecMock,
|
||||
readUuidFileMock,
|
||||
resetAllMocks,
|
||||
} from './config.test.mocks';
|
||||
|
@ -153,7 +153,6 @@ describe('ApmConfiguration', () => {
|
|||
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;
|
||||
});
|
||||
|
||||
|
@ -186,21 +185,6 @@ describe('ApmConfiguration', () => {
|
|||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('ELASTIC_APM_GLOBAL_LABELS', () => {
|
||||
process.env.ELASTIC_APM_GLOBAL_LABELS = 'test1=1,test2=2';
|
||||
const config = new ApmConfiguration(mockedRootDir, {}, true);
|
||||
|
||||
expect(config.getConfig('serviceName')).toEqual(
|
||||
expect.objectContaining({
|
||||
globalLabels: {
|
||||
git_rev: 'sha',
|
||||
test1: '1',
|
||||
test2: '2',
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('ELASTIC_APM_KIBANA_FRONTEND_ACTIVE', () => {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import { join } from 'path';
|
||||
import deepmerge from 'deepmerge';
|
||||
import { merge, isEmpty } from 'lodash';
|
||||
import { execSync } from 'child_process';
|
||||
import { getDataPath } from '@kbn/utils';
|
||||
|
@ -310,10 +309,7 @@ export class ApmConfiguration {
|
|||
const { servicesOverrides, redactUsers, ...configFromKibanaConfig } =
|
||||
this.getConfigFromKibanaConfig();
|
||||
const configFromEnv = this.getConfigFromEnv(configFromKibanaConfig);
|
||||
const config = [configFromKibanaConfig, configFromEnv].reduce<AgentConfigOptions>(
|
||||
(acc, conf) => deepmerge(acc, conf),
|
||||
{}
|
||||
);
|
||||
const config = merge({}, configFromKibanaConfig, configFromEnv);
|
||||
|
||||
if (config.active === false && config.contextPropagationOnly !== false) {
|
||||
throw new Error(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue