add pprof_enabled toggle to the APM integrations UI (#132710)

add pprof_enabled toggle to the APM integrations UI
This commit is contained in:
Younes meliani 2022-05-25 20:27:07 +02:00 committed by GitHub
parent d6c222ceb5
commit 71b88eb2ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 83 additions and 20 deletions

View file

@ -29,6 +29,7 @@ export const INPUT_VAR_NAME_TO_SCHEMA_PATH: Record<string, string> = {
max_connections: 'apm-server.max_connections',
response_headers: 'apm-server.response_headers',
expvar_enabled: 'apm-server.expvar.enabled',
pprof_enabled: 'apm-server.pprof.enabled',
tls_enabled: 'apm-server.ssl.enabled',
tls_certificate: 'apm-server.ssl.certificate',
tls_key: 'apm-server.ssl.key',

View file

@ -135,4 +135,9 @@ describe('when navigating to integration page', () => {
cy.visit('/app/fleet/integrations/apm-8.0.0/add-integration');
cy.contains('Tail-based sampling').should('not.exist');
});
it('should Display Debug section', () => {
cy.visit('/app/fleet/integrations/apm-8.0.0/add-integration');
cy.contains('Debug settings').should('exist');
});
});

View file

@ -210,6 +210,10 @@ const policy = {
value: false,
type: 'bool',
},
pprof_enabled: {
value: false,
type: 'bool',
},
tls_enabled: {
value: false,
type: 'bool',
@ -438,6 +442,10 @@ const newPolicy = {
value: false,
type: 'bool',
},
pprof_enabled: {
value: false,
type: 'bool',
},
tls_enabled: {
value: false,
type: 'bool',

View file

@ -218,6 +218,10 @@ const policy = {
type: 'bool',
value: false,
},
pprof_enabled: {
type: 'bool',
value: false,
},
java_attacher_discovery_rules: {
type: 'yaml',
value: '',

View file

@ -10,6 +10,7 @@ import React, { useMemo } from 'react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { getAgentAuthorizationSettings } from './settings_definition/agent_authorization_settings';
import { getApmSettings } from './settings_definition/apm_settings';
import { getDebugSettings } from './settings_definition/debug_settings';
import {
getRUMSettings,
isRUMFormValid,
@ -41,11 +42,13 @@ export function APMPolicyForm({ vars = {}, updateAPMPolicy }: Props) {
tlsSettings,
agentAuthorizationSettings,
tailSamplingSettings,
debugSettings,
} = useMemo(() => {
return {
apmSettings: getApmSettings(),
rumSettings: getRUMSettings(),
tlsSettings: getTLSSettings(),
debugSettings: getDebugSettings(),
agentAuthorizationSettings: getAgentAuthorizationSettings(),
tailSamplingSettings: getTailSamplingSettings(
tailSamplingPoliciesDocsLink
@ -63,7 +66,8 @@ export function APMPolicyForm({ vars = {}, updateAPMPolicy }: Props) {
isRUMFormValid(newVars, rumSettings) &&
isTLSFormValid(newVars, tlsSettings) &&
isSettingsFormValid(agentAuthorizationSettings, newVars) &&
isTailBasedSamplingValid(newVars, tailSamplingSettings);
isTailBasedSamplingValid(newVars, tailSamplingSettings) &&
isSettingsFormValid(debugSettings, newVars);
updateAPMPolicy(newVars, isFormValid);
}
@ -134,6 +138,18 @@ export function APMPolicyForm({ vars = {}, updateAPMPolicy }: Props) {
},
]
: []),
{
id: 'debug',
title: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.settings.title',
{ defaultMessage: 'Debug settings' }
),
subtitle: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.settings.subtitle',
{ defaultMessage: 'Settings for the APM server debug flags' }
),
settings: debugSettings,
},
];
return (

View file

@ -194,19 +194,6 @@ export function getApmSettings(): SettingsRow[] {
}
),
},
{
key: 'expvar_enabled',
type: 'boolean',
labelAppend: OPTIONAL_LABEL,
rowTitle: i18n.translate(
'xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle',
{ defaultMessage: 'Enable APM Server Golang expvar support' }
),
rowDescription: i18n.translate(
'xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription',
{ defaultMessage: 'Exposed under /debug/vars' }
),
},
],
},
];

View file

@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import { OPTIONAL_LABEL } from '../settings_form/utils';
import { SettingsRow } from '../typings';
export function getDebugSettings(): SettingsRow[] {
return [
{
key: 'expvar_enabled',
type: 'boolean',
labelAppend: OPTIONAL_LABEL,
rowTitle: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.expvarEnabledTitle',
{ defaultMessage: 'Enable APM Server Golang expvar support' }
),
rowDescription: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.expvarEnabledDescription',
{ defaultMessage: 'Exposed under /debug/vars' }
),
},
{
key: 'pprof_enabled',
type: 'boolean',
labelAppend: OPTIONAL_LABEL,
rowTitle: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.pprofEnabledTitle',
{ defaultMessage: 'Enable APM Server pprof support' }
),
rowDescription: i18n.translate(
'xpack.apm.fleet_integration.settings.debug.pprofEnabledDescription',
{
defaultMessage: 'Expose HTTP endpoints to retrieve profiling data',
}
),
},
];
}

View file

@ -7347,8 +7347,6 @@
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentDescription": "Environnement de service par défaut pour l'enregistrement des événements n'ayant aucun environnement de service défini.",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentLabel": "Environnement de service par défaut",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentTitle": "Configuration de service",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription": "Exposé sous /debug/vars",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle": "Activer la prise en charge d'expvar de Golang pour le serveur APM",
"xpack.apm.fleet_integration.settings.apm.hostDescription": "Hôte définit l'hôte et le port sur lesquels le serveur écoute. URL est l'URL du serveur invariable et accessible au public pour les déploiements sur Elastic Cloud ou ECK.",
"xpack.apm.fleet_integration.settings.apm.hostLabel": "Hôte",
"xpack.apm.fleet_integration.settings.apm.hostTitle": "Configuration du serveur",
@ -7417,6 +7415,8 @@
"xpack.apm.fleet_integration.settings.tls.tlsEnabledTitle": "Activer TLS",
"xpack.apm.fleet_integration.settings.tls.tlsKeyLabel": "Chemin d'accès à la clé de certificat du serveur",
"xpack.apm.fleet_integration.settings.tls.tlsSupportedProtocolsLabel": "Versions de protocoles prises en charge",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledTitle": "Activer la prise en charge d'expvar de Golang pour le serveur APM",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledDescription": "Exposé sous /debug/vars",
"xpack.apm.fleet_integration.settings.yamlCodeEditor": "Éditeur de code YAML",
"xpack.apm.fleetIntegration.apmAgent.discoveryRule.DragHandle": "Faire glisser la poignée",
"xpack.apm.fleetIntegration.apmAgent.editDisacoveryRule.operation": "Opération",

View file

@ -7443,8 +7443,6 @@
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentDescription": "サービス環境が定義されていないイベントで記録するデフォルトのサービス環境。",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentLabel": "デフォルトのサービス環境",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentTitle": "サービス構成",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription": "/debug/varsの下に公開されます",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle": "APM Server Golang expvarサポートを有効にする",
"xpack.apm.fleet_integration.settings.apm.hostDescription": "ホストは、サーバーがリスニングしているホストとポートを定義します。URLは、Elastic CloudまたはECKでデプロイするための変更できない公開アクセス可能なサーバーです。",
"xpack.apm.fleet_integration.settings.apm.hostLabel": "ホスト",
"xpack.apm.fleet_integration.settings.apm.hostTitle": "サーバー構成",
@ -7513,6 +7511,8 @@
"xpack.apm.fleet_integration.settings.tls.tlsEnabledTitle": "TLS を有効にする",
"xpack.apm.fleet_integration.settings.tls.tlsKeyLabel": "サーバー証明書鍵へのファイルパス",
"xpack.apm.fleet_integration.settings.tls.tlsSupportedProtocolsLabel": "サポートされているプロトコルバージョン",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledTitle": "APM Server Golang expvarサポートを有効にする",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledDescription": "/debug/varsの下に公開されます",
"xpack.apm.fleet_integration.settings.yamlCodeEditor": "YAMLコードエディター",
"xpack.apm.fleetIntegration.apmAgent.discoveryRule.DragHandle": "ハンドルをドラッグ",
"xpack.apm.fleetIntegration.apmAgent.editDisacoveryRule.operation": "演算",

View file

@ -7460,8 +7460,6 @@
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentDescription": "未定义服务环境的事件中要记录的默认服务环境。",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentLabel": "默认服务环境",
"xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentTitle": "服务配置",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription": "在 /debug/vars 下公开",
"xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle": "启用 APM Server Golang expvar 支持",
"xpack.apm.fleet_integration.settings.apm.hostDescription": "主机定义服务器要侦听的主机和端口。URL 是不可更改、可公开访问的服务器 URL用于在 Elastic Cloud 或 ECK 上进行部署。",
"xpack.apm.fleet_integration.settings.apm.hostLabel": "主机",
"xpack.apm.fleet_integration.settings.apm.hostTitle": "服务器配置",
@ -7530,6 +7528,8 @@
"xpack.apm.fleet_integration.settings.tls.tlsEnabledTitle": "启用 TLS",
"xpack.apm.fleet_integration.settings.tls.tlsKeyLabel": "服务器证书密钥的文件路径",
"xpack.apm.fleet_integration.settings.tls.tlsSupportedProtocolsLabel": "支持的协议版本",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledTitle": "启用 APM Server Golang expvar 支持",
"xpack.apm.fleet_integration.settings.debug.expvarEnabledDescription": "在 /debug/vars 下公开",
"xpack.apm.fleet_integration.settings.yamlCodeEditor": "YAML 代码编辑器",
"xpack.apm.fleetIntegration.apmAgent.discoveryRule.DragHandle": "拖动手柄",
"xpack.apm.fleetIntegration.apmAgent.editDisacoveryRule.operation": "操作",