Adding Unique Health Sources for the same monitored service and environment in different steps of a pipeline

This article will take you through the steps where you can Add Unique Health Sources(with different metrics) for the same monitored service and environment in different steps of a pipeline.

As Monitored Service is directly tied to the services hence when you try to create a add health source in a pipeline verify step in the pipeline and add a health source they will be common and shared whichever step you use the monitored service.

To solve this use case as a user might want to have different metrics health sources and uniquely add them to the pipeline verify step.

We will need to create and use Monitored Service Template for this.

Step1 :

Click on Service Reliability Module , then go to project → Templates

Step 2 :

Now click on New Template and select Monitored Service.

Step 3 :

Here enter details about the template like Template Name, version(ex: v1) as we can version the templates. We can save this template to either Project/Organisation or Account Level. Click Start.

Step 4 :

A window will appear with the details for the template such as Type, Service and Environment.
Select the same and then below you will click add the health source like we do in Verify step in a pipeline.

Step 5 :

In this step we will define and select our health source say prometheus in this example and define the metrics in the next step. Save this and you will see the template.

Step 6 :

We will repeat the steps from 2 - 5 and create another template for the same service , env and add the health source with different metrics than the one we added before.

Step 7 :

Now let’s go to our pipeline with different deploy steps for the same service / environment.
Let’s add the verify step.

Step 8 :

We will need to change the Monitored Service Type from Default to Template, then click on Use Template and select the template. Ex : Prometheustest1

Step 9 :

We will see the verify step added and we will add and repeat the same steps for the 2nd deploy stage and add another verify step with the 2nd template. Ex : Prometheustest2

Now we have 2 different metrics Health Sources in different deploy stages for the verify step.

Reference : Monitored Health Service Quickstart | Harness Developer Hub

1 Like