Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job runner details #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

apj0nes
Copy link

@apj0nes apj0nes commented Jun 17, 2024

Resolves #125
This change amends the job runner_type label logic as not all self-hosted runners may contain the self-hosted runs-on label. For example users of Warpbuild with have a runs-on label of warp-* but I would consider this self-hosted (non-github hosted runners). In addition to this, the runs-on labels have been added to job metrics as a new label (comma-separated).

This change should provide more insight into which runners are running which job.

Note: Github hosted runners list, this can be defined via config if the list becomes outdated and also allows users who user larger runners to add their runner labels.

@apj0nes apj0nes requested a review from a team as a code owner June 17, 2024 12:26
Copy link
Contributor

@tcarmet tcarmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @apj0nes! It's very much appreciated.

Added a couple of comments check them out and let's make this PR move forward 🚀

Cheers!


Metrics are labelled with the runner type. The logic for determining the runner type is as follows -

If the runner tag is in the [github_hosted_runner_labels](./gh_actions_exporter/config.py) list the runner type will be `github-hosted` else the runner type will be `self-hosted`. Additional `github-hosted` runner tags can be added via config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how the doc was rendered (through mkdocs or github), through github at least couldn't get it to redirect unless I go up a couple of folders.

Also added some note for my future self as I was wondering how we could handle GitHub hosted larger runners with this setting.

Suggested change
If the runner tag is in the [github_hosted_runner_labels](./gh_actions_exporter/config.py) list the runner type will be `github-hosted` else the runner type will be `self-hosted`. Additional `github-hosted` runner tags can be added via config.
- If the runner tag is in the [github_hosted_runner_labels](../../gh_actions_exporter/config.py)
list, the runner type will be `github-hosted` else the runner type will be `self-hosted`.
- Additional `github-hosted` runner tags can be added via the config file,
for example GitHub hosted larger runners as their name is defined
by the owner of the GitHub organization.

@@ -25,6 +25,7 @@ def __init__(self, settings: Settings):
self.job_labelnames = self.common_labelnames.copy() + [
"job_name",
"runner_type",
"runner_labels",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of query or filter were you trying to do when deciding to add the runner_labels and have you tried using the relabel option?

I see no issue in adding it, just wanna make sure you tried all the options available to you.

For example in our org, our self-hosted runners are defined with multiple labels:

  • The os (ubuntu-20.04)
  • The flavor (large)
  • And in some case the cloud provider (aws, azure, etc)

And we use the relabel feature to retrieve those value and create new label like:

  • cloud=aws
  • flavor=large

Which makes it easier for us to query around.

Copy link
Author

@apj0nes apj0nes Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does look promising. Would you have an example yaml config for achieving the example above?

Copy link
Contributor

@tcarmet tcarmet Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do yes, this is an example of what we've been playing with:

job_relabelling:
  - label: cloud
    default: github-hosted
    values:
      - azure
      - aws
    type: name # retrieve the info from the runner name (defaults to labels).
  - label: image
    default: unknown
    values:
      - ubuntu-latest
      - ubuntu-20.04
      - ubuntu-22.04
      - rocky-8
      - redhat-8
      - redhat-9
  - label: flavor
    default: medium # consider github-hosted flavors as medium
    values:
      - small
      - medium
      - large
      - xlarge

And sorry for the lack of documentation on those 😅 , I'll take note on my end and make an effort towards that in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runner details
2 participants