Import events for the DORA metrics via a custom integration

In this tutorial you will learn how to the send events required for the DORA metrics integration of VSM.

Prerequisites

  • Open Administration > Integrations and activate the DORA integration
  • The contributor whose e-mail will be used for the Change events is subscribed to at least one Team in the workspace
  • That team owns the Software Artifact for which the Change, Release and Incidentevents are sent for
  • For this Software Artifact, the vsmEventId is set

Once everything is ready, changes, releases and incidents can be sent to the events API for DORA metrics to be calculated.

Setup for DORA integration

We will assume to set up on a VSM Trial workspace so it will be easier to talk about the same data or state. Lets have a closer look into Team Hook which should be available under https://demo-de.leanix.net/TrialXYZLeanIx/factsheet/Team/06e347d6-7d88-4df2-b269-a6da81f4464b

Please subscribe yourself as responsible on this Team.

Team Hook should be responsible for CRM Process API https://demo-de.leanix.net/TrialXYZLeanIx/factsheet/Microservice/5a032515-461e-4e4c-a974-e461fbbc6c52

Please add the example vsmEventID over here: CRMProcessAPIvsmEventID

TECHNICAL_USER_API_TOKEN: See here how to obtain this token

Afterwards the following script can be executed (with adjusted variables) to send some example DORA metrics into your workspace

#!/bin/bash
TECHNICAL_USER_API_TOKEN="<*your_technical_user_api_token*>"
USER_EMAIL="[email protected]"
DATE="2022-02-28"
VSM_EVENT_ID="CRMProcessAPIvsmEventID"

AUTHTOKEN=$(curl --request POST \
    --url https://demo-de.leanix.net/services/mtm/v1/oauth2/token \
    -u apitoken:$TECHNICAL_USER_API_TOKEN \
    --data grant_type=client_credentials | jq '.access_token' -r)

curl -X POST --location "https://demo-de.leanix.net/services/valuestreams/v1/api/events" \
    -H "Authorization: Bearer ${AUTHTOKEN}" \
    -H "Ce-Specversion: 1.0" \
    -H "Ce-Type: net.leanix.valuestreams.change" \
    -H "Ce-Id: changeid_e_g_gitcommitid#${DATE}" \
    -H "Ce-Source: ${VSM_EVENT_ID}" \
    -H "Ce-Time: ${DATE}T09:00:00.4589254Z" \
    -H "Ce-Datacontenttype: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"author\": \"${USER_EMAIL}\"}"

curl -X POST --location "https://demo-de.leanix.net/services/valuestreams/v1/api/events" \
    -H "Authorization: Bearer ${AUTHTOKEN}" \
    -H "Ce-Specversion: 1.0" \
    -H "Ce-Type: net.leanix.valuestreams.release" \
    -H "Ce-Id: releaseid_e_g_gitcommitid#${DATE}" \
    -H "Ce-Source: ${VSM_EVENT_ID}" \
    -H "Ce-Time: ${DATE}T11:00:00.4589254Z" \
    -H "Ce-Datacontenttype: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"changeIds\": [\"changeid_e_g_gitcommitid#${DATE}\"]}"

curl -X POST --location "https://demo-de.leanix.net/services/valuestreams/v1/api/events" \
    -H "Authorization: Bearer ${AUTHTOKEN}" \
    -H "Ce-Specversion: 1.0" \
    -H "Ce-Type: net.leanix.valuestreams.incident" \
    -H "Ce-Id: incidentid_e_g_gitcommitid#${DATE}" \
    -H "Ce-Source: ${VSM_EVENT_ID}" \
    -H "Ce-Time: ${DATE}T13:00:00.4589254Z" \
    -H "Ce-Datacontenttype: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"resolvedDate\": \"${DATE}T12:30:00.4589254Z\", \"createdDate\": \"${DATE}T11:50:00.4589254Z\"}"

Resulting DORA Metrics

Finally the first DORA metric example data shall be visible for Team Hook when following the link to the DORA UI:

Link to the DORA UILink to the DORA UI

Link to the DORA UI

There, simply search for "Team Hook":

Resulting sample DORA metricsResulting sample DORA metrics

Resulting sample DORA metrics


Did this page help you?