actions / actions/actions-runner-controller

Add webhook payload detail to info logs

Open
#2,060 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
6.5k
Forks
1.5k
Avg merge
2d 2h
Merged PRs (30d)
27

Description

Hello 👋 thanks for building this, it has been pretty awesome and helpful!

What would you like added?

I have this configured with the webhook service running and the horizontal autoscaler to run ephemeral runner pods. By default, I ship all service logs to Datadog and filter out the "debug" level, so for the webhook service, I just see logs like this over and over:

2022-11-30T22:50:00Z	INFO	controllers.webhookbasedautoscaler	scaled gha-runner-autoscaler-small by -1

And I would love to see the webhook payload details on this log. I would think that the configuration here: https://github.com/actions-runner-controller/actions-runner-controller/blob/master/controllers/horizontal_runner_autoscaler_webhook.go#L180

...would include those attributes with the log line here: https://github.com/actions-runner-controller/actions-runner-controller/blob/master/controllers/horizontal_runner_autoscaler_webhook.go#L296-L298

...but it doesn't.

I also see log.V(1) and log.V(2) calls above and I've never seen that style of logger before so I'm not sure what those mean.

In any case, this may me a bug, or it may be by design? If it isn't necessarily intentional, I'd be happy to take a stab at a pull request.

Additionally, it would be amazing to apply those same attributes to the pod handling the action somehow, but that seems like a whole other can of worms.

Why is this needed?

I'm finding it really difficult to connect the chain of requests from a triggered Github Action to a pod handling that action, and having these attributes on a successfully routed event would be helpful to connect the dots.

Additional context

In case it may be of any help, I've installed via the Helm chart with the following configuration:

resources:
  requests:
    cpu: "0.5"
    memory: "1Gi"
  limits:
    cpu: "0.5"
    memory: "1Gi"

podLabels:
  tags.datadoghq.com/env: internal
  tags.datadoghq.com/service: actions-runner-controller

logFormat: "json"

githubWebhookServer:
  enabled: true
  secret:
    enabled: true
    create: true
    name: "gha-webhook-secret"
    github_webhook_secret_token: "..."
  service:
    ports:
      - port: 443
        targetPort: http
        protocol: TCP
        name: https
  resources:
    requests:
      cpu: "0.5"
      memory: "1Gi"
    limits:
      cpu: "0.5"
      memory: "1Gi"
  podLabels:
    tags.datadoghq.com/env: internal
    tags.datadoghq.com/service: actions-runner-webhook
  logFormat: "json"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in controllers/horizontal_runner_autoscaler_webhook.go around lines 180 and 296-298, and read the nearby log.V(1)/log.V(2) calls to understand their verbosity. Confirm which webhook attributes should appear at info level, add them to the scaling log, and verify that the resulting structured log includes the details.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, go, kubernetes
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.