Skip to content

Commit f8ba2fd

Browse files
authored
Hide stderr git output during APM agent configuration (#52878)
1 parent 45563b2 commit f8ba2fd

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

config/apm.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,22 @@ const { join } = require('path');
4242
const { execSync } = require('child_process');
4343
const merge = require('lodash.merge');
4444

45-
module.exports = merge({
46-
active: false,
47-
serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443',
48-
// The secretToken below is intended to be hardcoded in this file even though
49-
// it makes it public. This is not a security/privacy issue. Normally we'd
50-
// instead disable the need for a secretToken in the APM Server config where
51-
// the data is transmitted to, but due to how it's being hosted, it's easier,
52-
// for now, to simply leave it in.
53-
secretToken: 'R0Gjg46pE9K9wGestd',
54-
globalLabels: {},
55-
centralConfig: false,
56-
logUncaughtExceptions: true
57-
}, devConfig());
45+
module.exports = merge(
46+
{
47+
active: false,
48+
serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443',
49+
// The secretToken below is intended to be hardcoded in this file even though
50+
// it makes it public. This is not a security/privacy issue. Normally we'd
51+
// instead disable the need for a secretToken in the APM Server config where
52+
// the data is transmitted to, but due to how it's being hosted, it's easier,
53+
// for now, to simply leave it in.
54+
secretToken: 'R0Gjg46pE9K9wGestd',
55+
globalLabels: {},
56+
centralConfig: false,
57+
logUncaughtExceptions: true,
58+
},
59+
devConfig()
60+
);
5861

5962
const rev = gitRev();
6063
if (rev !== null) module.exports.globalLabels.git_rev = rev;
@@ -66,7 +69,10 @@ try {
6669

6770
function gitRev() {
6871
try {
69-
return execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim();
72+
return execSync('git rev-parse --short HEAD', {
73+
encoding: 'utf-8',
74+
stdio: ['ignore', 'pipe', 'ignore'],
75+
}).trim();
7076
} catch (e) {
7177
return null;
7278
}

0 commit comments

Comments
 (0)