Skip to content

Adds instrumentation to interpolation

Laura Montemayor requested to merge add-interpolations-instrumentation into master

What does this MR do and why?

Adds instrumentation to interpolation: #396722 (closed)

How to set up and validate locally

  1. Observe that the Service Ping payload includes ci_interpolation_users_monthly and ci_interpolation_users_weekly subkeys.

Run the following commands in the console:

service_ping_payload = Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)
service_ping_payload['redis_hll_counters']['pipeline_authoring']
  1. Run the following command and note the outputted value (it should be 0 if you haven't run Step 4 yet).
::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'ci_interpolation_users', start_date: Date.today, end_date: Date.today + 7.days, context: '')
  1. Go to your Project's CI/CD Editor and update the contents with:
#.gitlab-ci.yml
include:
  - local: template.yml
    inputs:
      stage: deploy
      job_prefix: "my-app-"
#template.yml
spec:
  inputs:
    stage:   
      default: test
    job_prefix:
      default: "" 
---    
"$[[ inputs.job_prefix]]deploy":
  stage: $[[ inputs.stage ]]
  script: echo "deploy $[[ inputs.stage ]]"
  1. Commit the changes and wait for the pipeline to complete running. Now observe the counter value again. It should have incremented by 1.
::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'ci_interpolation_users', start_date: Date.today, end_date: Date.today + 7.days, context: '')
  1. If you'd like to see the Service Ping payload counters incremented, then you can track a mocked event set to a week ago and then check the Service Ping payload output.
::Gitlab::UsageDataCounters::HLLRedisCounter.track_event('ci_interpolation_users', values: 1, time: Date.today - 7.days)
service_ping_payload = Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)
service_ping_payload['redis_hll_counters']['pipeline_authoring']

NOTE: Huge shoutout and thank you to @lma-git for providing these steps for testing the instrumentation. 🙇

Once this is merged

you can see the query in: https://metrics.gitlab.com/?q=interpolation, and then use that to add a widget to Sisense.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Laura Montemayor

Merge request reports

Loading