Git Product home page Git Product logo

workflows-exporter's Introduction

Workflows-Exporter

This exporter hits the Github API to collect workflow billable time for a single org. It is explicitely designed to only focus on workflow billable time for now, in an attempt to tackle cases where the organization has a large amount (~1000) of repositories.

To achieve this, it does the following tradeoffs:

  • It only accounts for repositories being active in the last x days (default is 35 days)
  • It works in best effort mode and tries to refresh the data every x minutes (default is 30 minutes)
  • It serves the last retrieved data

Exported metrics

Billable Time

# HELP github_actions_workflow_billable_time_seconds Billable time for a repo, per workflow and platform
# TYPE github_actions_workflow_billable_time_seconds gauge
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-A",workflow="build",workflow_id="1"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-A",workflow="release",workflow_id="3"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-A",workflow="run",workflow_id="4"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-A",workflow="test",workflow_id="2"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-B",workflow="build",workflow_id="1"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-B",workflow="release",workflow_id="3"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-B",workflow="run",workflow_id="4"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-B",workflow="test",workflow_id="2"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-C",workflow="build",workflow_id="1"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-C",workflow="release",workflow_id="3"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-C",workflow="run",workflow_id="4"} 15
github_actions_workflow_billable_time_seconds{owner="totocorp",platform="UBUNTU",repo="repo-C",workflow="test",workflow_id="2"} 15

Active Repositories

How many repositories under the organization are considered active. Depends on the -max-last-push setting.

# HELP github_actions_workflow_active_repos Last reported total of active repositories in the monitored org
# TYPE github_actions_workflow_active_repos gauge
github_actions_workflow_active_repos 174

Last Refresh Timestamp

Last timestamp in seconds where the exported managed to refresh the data. Usefull for detecting stale data.

# HELP github_actions_workflow_last_refresh_timestamp_seconds Last timestamp in seconds since epoch of the last dataset refresh
# TYPE github_actions_workflow_last_refresh_timestamp_seconds gauge
github_actions_workflow_last_refresh_timestamp_seconds 1.697328e+09

Last Refresh Duration

How much time it took to refresh the whole dataset.

# HELP github_actions_workflow_last_refresh_duration_seconds Last refresh duration in seconds
# TYPE github_actions_workflow_last_refresh_duration_seconds gauge
github_actions_workflow_last_refresh_duration_seconds 1

How to use the exporter?

Run the exporter

 go run ./cmd/exporter -refresh-period=2m -organization=someapp -github-auth-token=$(gh auth token)

All available options can be found using

go run ./cmd/exporter -help

Here's the currently supported options

-github-auth-token string
    GitHub auth token
-listen-address string
    The address to listen on for HTTP requests. (default ":8080")
-max-last-pushed duration
    How many time since the last push to consider a repo inactive (default 840h0m0s)
-organization string
    Organization to monitor
-pprof
    Enable pprof endpoints
-refresh-period duration
    Frequency at which usage data is refreshed (default 30m0s)
-shutdown-delay duration
    Graceful shutdown delay (default 15s)

The exporter reads the auth token either from the -github-auth-token flag or the GITHUB_TOKEN environment variable.

workflows-exporter's People

Contributors

jlevesy avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.