kibana/config/apm.js

88 lines
2.9 KiB
JavaScript

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* DO NOT EDIT THIS FILE!
*
* This file contains the configuration for the Elastic APM instrumentaion of
* Kibana itself and is only intented to be used during development of Kibana.
*
* Instrumentation is turned off by default. Once activated it will send APM
* data to an Elasticsearch cluster accessible by Elastic employees.
*
* To modify the configuration, either use environment variables, or create a
* file named `config/apm.dev.js`, which exports a config object as described
* in the docs.
*
* For an overview over the available configuration files, see:
* https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html
*
* For general information about Elastic APM, see:
* https://www.elastic.co/guide/en/apm/get-started/current/index.html
*/
const { readFileSync } = require('fs');
const { join } = require('path');
const { execSync } = require('child_process');
const merge = require('lodash.merge');
module.exports = merge(
{
active: false,
serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443',
// 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: 'R0Gjg46pE9K9wGestd',
globalLabels: {},
centralConfig: false,
logUncaughtExceptions: true,
},
devConfig()
);
const rev = gitRev();
if (rev !== null) module.exports.globalLabels.git_rev = rev;
try {
const filename = join(__dirname, '..', 'data', 'uuid');
module.exports.globalLabels.kibana_uuid = readFileSync(filename, 'utf-8');
} catch (e) {} // eslint-disable-line no-empty
function gitRev() {
try {
return execSync('git rev-parse --short HEAD', {
encoding: 'utf-8',
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
} catch (e) {
return null;
}
}
function devConfig() {
try {
return require('./apm.dev'); // eslint-disable-line import/no-unresolved
} catch (e) {
return {};
}
}