From 98f402e92c45d56976709b735723ddd16b32b519 Mon Sep 17 00:00:00 2001 From: mornyx Date: Wed, 7 Jun 2023 13:44:38 +0800 Subject: [PATCH] conprof: disable profiling tiflash Signed-off-by: mornyx --- component/conprof/http/api.go | 3 ++- component/conprof/scrape/manager.go | 4 ++++ component/conprof/scrape/manager_test.go | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/component/conprof/http/api.go b/component/conprof/http/api.go index 4c01a4c..74966fd 100644 --- a/component/conprof/http/api.go +++ b/component/conprof/http/api.go @@ -117,7 +117,8 @@ func getProfileEstimateSize(component topology.Component) int { case topology.ComponentTiKV: return 200 * 1024 // profile size case topology.ComponentTiFlash: - return 200 * 1024 // profile size + // TODO: remove this after TiFlash fix the profile bug. + return 0 } return defaultProfileSize } diff --git a/component/conprof/scrape/manager.go b/component/conprof/scrape/manager.go index 1f8027b..648f555 100644 --- a/component/conprof/scrape/manager.go +++ b/component/conprof/scrape/manager.go @@ -187,6 +187,10 @@ func (m *Manager) startScrape(ctx context.Context, component topology.Component, if !continueProfilingCfg.Enable { return nil } + // TODO: remove this after TiFlash fix the profile bug. + if component.Name == topology.ComponentTiFlash { + return nil + } profilingConfig := m.getProfilingConfig(component) httpCfg := m.config.Security.GetHTTPClientConfig() addr := fmt.Sprintf("%v:%v", component.IP, component.Port) diff --git a/component/conprof/scrape/manager_test.go b/component/conprof/scrape/manager_test.go index ad7866d..b57a384 100644 --- a/component/conprof/scrape/manager_test.go +++ b/component/conprof/scrape/manager_test.go @@ -89,6 +89,8 @@ func TestManager(t *testing.T) { break } } + // TODO: remove this after support tiflash + require.True(t, list.Target.Component != topology.ComponentTiFlash) require.True(t, found, fmt.Sprintf("%#v", list)) for _, ts := range list.TsList { require.True(t, ts >= param.Begin && ts <= param.End) @@ -129,7 +131,8 @@ func TestManager(t *testing.T) { // test for GetCurrentScrapeComponents comp := manager.GetCurrentScrapeComponents() - require.Equal(t, len(comp), len(components)) + // TODO: update this after support tiflash + require.Equal(t, len(comp), len(components)-1) // test for topology changed. mockServer2 := testutil.CreateMockProfileServer(t)