From 08f4fc5f572af47c014cabff92c2207b5ea11f64 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Tue, 5 Jul 2022 17:28:35 +0000 Subject: [PATCH 1/2] Add support for content nodes in prometheus scraping --- monitoring/prometheus/generateProm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitoring/prometheus/generateProm.js b/monitoring/prometheus/generateProm.js index 8584f91e305..433b23a6bb9 100644 --- a/monitoring/prometheus/generateProm.js +++ b/monitoring/prometheus/generateProm.js @@ -52,7 +52,9 @@ const generateEnv = async (stream, env) => { preferHigherPatchForSecondaries: true }) await audiusLibs.init() - const serviceProviders = await audiusLibs.ethContracts.ServiceProviderFactoryClient.getServiceProviderList('discovery-node'); + const discoveryNodes = await audiusLibs.ethContracts.ServiceProviderFactoryClient.getServiceProviderList('discovery-node') + const contentNodes = await audiusLibs.ethContracts.ServiceProviderFactoryClient.getServiceProviderList('content-node') + const serviceProviders = [...discoveryNodes, ...contentNodes] // copy from environment-specific stubs readFromFileAndWriteToStream(stream, `${env}.yml`) From 85feb5f9339b9584281f1afd427b8419673e5ab4 Mon Sep 17 00:00:00 2001 From: Dheeraj Manjunath Date: Tue, 5 Jul 2022 17:52:20 +0000 Subject: [PATCH 2/2] Fix generateJobYaml --- monitoring/prometheus/generateProm.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monitoring/prometheus/generateProm.js b/monitoring/prometheus/generateProm.js index 433b23a6bb9..2779778482e 100644 --- a/monitoring/prometheus/generateProm.js +++ b/monitoring/prometheus/generateProm.js @@ -11,7 +11,7 @@ const readFromFileAndWriteToStream = (stream, filename) => { stream.write("\n") } -const generateJobYaml = (url, env, scheme = 'https', component = 'discovery-provider') => { +const generateJobYaml = ({ url, env, scheme = 'https', component = 'discovery-provider' }) => { url = url.replace("https://", "").replace("http://", "") sanitizedUrl = url.split(".").join("-") @@ -67,7 +67,8 @@ const generateEnv = async (stream, env) => { for (const sp of serviceProviders) { const spEndpoint = sp.endpoint; - const yamlString = generateJobYaml(spEndpoint, env) + const serviceType = sp.type + const yamlString = generateJobYaml({ url: spEndpoint, env, component: serviceType }) stream.write(yamlString); stream.write("\n") }