For the complete documentation index, see llms.txt. This page is also available as Markdown.
Continuous DeliveryContinuous VerificationDynatrace

Validate releases with Dynatrace Site Reliability Guardian

Use Dynatrace SRG alongside Harness Continuous Verification to gate canary deployments based on reliability metrics

If your organization already uses Dynatrace Site Reliability Guardian (SRG) to evaluate release quality, you can integrate it into your Harness Continuous Delivery pipelines. Combine Dynatrace metric-driven validation with Harness deployment orchestration and the Continuous Verification (CV) AI Verify (v1) step for two independent layers of release verification.

Harness handles the deployment and the final promotion decision. Dynatrace performs the reliability evaluation. Together they form a release gate that catches regressions before they reach production traffic.

The integration uses standard Harness pipeline primitives (HTTP steps, shell scripts, and a reusable step group template) to call the Dynatrace SRG API. No custom plugins or feature flags are required.


What you will learn from this topic


Before you begin

Gather the following before you add the SRG Validation template to a pipeline:

  • Harness Continuous Delivery pipeline: A Deploy stage with any deployment strategy (canary, rolling, blue-green, and similar). Go to Continuous Delivery overview to review deployment concepts.

  • Dynatrace Site Reliability Guardian: A Dynatrace environment with Site Reliability Guardian configured, and a workflow that runs the SRG validation.

  • Dynatrace API token: A platform token with automation:workflows:run and automation:workflows:read scopes, stored in Harness Secret Manager (for example, as dyna-pf-token). Go to Harness Secret Manager to store the token.

  • Dynatrace connection values: The Dynatrace Platform URL (for example, https://abc123.apps.dynatrace.com) and the Workflow ID for your SRG guardian.


SRG Validation step group template

The SRG integration is packaged as a reusable step group template that you can reference from any pipeline. The template waits for the canary to warm up, triggers the Dynatrace SRG workflow, and polls for the result.

Template inputs

The template accepts a single input variable:

  • podName: The name of the canary pod deployed by Harness. This value is passed to Dynatrace so SRG evaluates metrics scoped to the canary instance only.

What each step does

The step group contains three steps that execute sequentially:

  1. Wait (3 minutes): A bake period that gives the canary pod time to receive traffic and generate meaningful metrics before SRG evaluation begins.

  2. Trigger SRG: An HTTP POST step that calls the Dynatrace Automation API to start the SRG workflow. It passes the canary pod name and a 10-minute evaluation window (now-10m to now) as input parameters. The step captures the executionId from the response for use in the next step.

  3. Poll SRG Result: An HTTP GET step that polls the workflow execution endpoint until SRG finishes. It uses a retry strategy (up to 10 retries at 5-second intervals) to wait for the guardian to complete evaluation. After the guardian finishes, it captures four output variables:

    • VALIDATION_STATUS: The SRG verdict (pass or fail).

    • TASK_STATE: The execution state of the guardian task.

    • GUARDIAN_NAME: The name of the guardian that ran the evaluation.

    • POLL_RESPONSE: The full response body for debugging.

The following screenshot shows the SRG Validation step group template in the Harness Pipeline Studio:

SRG Validation step group template

Template YAML

Create this as an Account-level step group template so it can be reused across projects.

SRG Validation step group template YAML

Set up the pipeline

The following pipeline demonstrates a complete canary deployment with both Dynatrace SRG and Harness Continuous Verification running in parallel. It uses the SRG Validation template from above and adds an AI Verify (v1) step alongside it.

Pipeline variables

Define these variables at the pipeline level:

  • dynaUrl: Your Dynatrace platform URL (for example, https://abc123.apps.dynatrace.com).

  • workflowId: The ID of the Dynatrace Automation workflow that runs your SRG guardian.

Execution flow

The pipeline execution follows this sequence:

  1. K8sCanaryDeploy: Deploys a single canary pod.

  2. Parallel verification: The SRG Validation step group and the Continuous Verification AI Verify (v1) step run simultaneously. The step group template receives the canary pod name dynamically using the deployment info outcome expression.

  3. Release Verification Summary: A shell script logs the verdicts from both SRG and Continuous Verification for visibility. This step runs regardless of the previous step outcomes (configured with stageStatus: All).

  4. K8sCanaryDelete: Cleans up the canary pod.

  5. K8sRollingDeploy: Promotes the deployment to all pods, but only if SRG returned pass. This is controlled by a conditional execution expression on the step.

If any step fails, the pipeline triggers a stage rollback using K8sRollingRollback.

The following screenshot shows the full pipeline execution flow in the Harness Pipeline Studio, with the SRG Validation step group and the Continuous Verification AI Verify (v1) step running in parallel:

Pipeline execution flow with SRG and Continuous Verification in parallel

Pipeline YAML

Replace the service, environment, infrastructure, and connector references with your own.

Complete pipeline YAML

Key expressions explained

A few expressions in this pipeline reference deployment outputs dynamically:

  • Canary pod name passed to SRG: The podName variable uses a chained expression to get the last deployed pod from the canary step's output:

    This ensures SRG always evaluates metrics for the correct canary pod, even if the pod name changes between runs.

  • Promotion condition: The rolling deploy step uses a conditional execution to check the SRG verdict:

    The deployment only promotes if the SRG validation returned pass.


How it works

Once the pipeline is set up, the execution follows this flow:

  1. Deploy: Harness deploys the new version using your chosen deployment strategy (canary, rolling, blue-green, and similar).

  2. Run verification in parallel: Two verification paths execute simultaneously:

    • Dynatrace SRG validation: The step group triggers a Dynatrace SRG workflow, waits for it to complete, and captures the verdict.

    • Harness Continuous Verification AI Verify (v1) step: The standard AI Verify (v1) step evaluates health source metrics using Harness ML-based analysis.

  3. Gate the release: A shell script inspects the SRG verdict. If SRG returns pass and the Continuous Verification step succeeds, Harness promotes the deployment. If either check fails, the pipeline stops and rolls back.

This parallel approach means SRG and Continuous Verification validate the deployment independently. A failure from either source blocks the release.

Successful execution

When both SRG and Continuous Verification pass, the pipeline promotes the deployment and all steps complete successfully:

Successful pipeline execution with SRG and Continuous Verification passing

Failed execution

When Continuous Verification detects anomalies or SRG returns a failing verdict, the pipeline stops the promotion. In this example, the AI Verify (v1) step failed while SRG passed: the downstream steps are skipped and the deployment is not promoted:

Failed pipeline execution where Continuous Verification detected issues

Verification outcomes

Running SRG and Continuous Verification in parallel produces three possible outcomes:

SRG Verdict
Continuous Verification Verdict
Result

pass

Success

Deployment promoted to all pods

fail

Success

Deployment stopped: SRG blocked the release

pass

Failure

Deployment stopped: Continuous Verification detected anomalies

When both checks fail, the pipeline triggers a rollback automatically through the stage failure strategy.


Troubleshooting

Use the following entries when SRG and Continuous Verification disagree or a poll step fails:

SRG returned pass but Continuous Verification failed (or the reverse)

SRG and Continuous Verification are independent. Either failure blocks promotion in the example pipeline. Review the Continuous Verification health source configuration and the Dynatrace guardian rules for the metric that failed.

Poll SRG Result keeps retrying or marks the step as failed

Confirm the Dynatrace token scopes, Platform URL, Workflow ID, and that the JSON selector for site_reliability_guardian_1 matches your Dynatrace workflow task name. The poll step expects HTTP 200 and a task state other than RUNNING.

Rolling deploy does not run after verification

The rolling deploy step runs only when VALIDATION_STATUS equals pass. Check the Poll SRG Result output variables and the conditional execution expression on K8sRollingDeploy.


Next steps

Last updated

Was this helpful?