Skip to content

Commit

Permalink
Adds workflow_job_seconds metric (#5)
Browse files Browse the repository at this point in the history
* server to struct

* Intention to support instantiation of server for
integration testing. Side effect is improving readability.
* Extracts root handler into func.
* Error logging handled by main.

* extract server and related out of main package

* Intention is to test against package interface
using server_test package. Couldn't get to work
with main_test.
* Side effect is improved readability due to less
global state.
* ghActionsExporter private to package as created
in Server setup

* adds /metrics integration test

* Intention was to improve coverage of http server
implementation.
* Probably makes more sense to test the handlers
directly for most cases.

* adds tests for webhook event handler

* Backfills tests before behaviour changes.
* CheckRun test only checks for 200 due to
async behaviour.

* upgrade google/go-github/ v33 to v43

* adds test for workflow job queued

* observe queued time from in_progress_event

Assumes job queue time can be calculated from difference
between job start time and start time of first step.

Labels:
* runner_group to identify queues for specific runners
* state queued as durations can also be published for
  completed jobs
* no workflow label as it is not possible to identify
  workflow without additional API calls

* introduces workflowJobObserver to simplify testing

* Simplifies testing by moving observation of workflow job
metrics under interface.
* Leaves other metrics untouched for now, even though
inconsistent.

* adds test observer to remaining exporter tests

* adds integration test for workflow job metrics

* Use custom serve mux to allow for creation of
multiple servers in integration tests.

* updates timeout on test to sensible value

* pulls assertion into observation helper struct

* observes workflow job duration for in_progress

* workflow job queued metric corrected

* go mod vendor

* go mod tidy

* Updates golangci-lint version

* corrects hard coded state

* adds test for negative queue durations

This is possible as it seems step started_at times are
rounded to the closest second whereas job started_at time
has miliseconds included.

* handles skipped jobs without panic

* renames workflow_job__seconds to workflow_job_duration_seconds
  • Loading branch information
janakerman committed Apr 20, 2022
1 parent 89346a2 commit e005195
Show file tree
Hide file tree
Showing 505 changed files with 62,335 additions and 21,224 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ github_actions_exporter

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# VSCode
.vscode/
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_

GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.33.0
GOLANGCI_LINT_VERSION ?= v1.45.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down
120 changes: 0 additions & 120 deletions collector.go

This file was deleted.

5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ go 1.15

require (
github.com/go-kit/kit v0.10.0
github.com/google/go-cmp v0.5.1 // indirect
github.com/google/go-github/v33 v33.0.1-0.20210219143306-5c87615fe927
github.com/google/go-github/v43 v43.0.0
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/common v0.15.0
github.com/stretchr/testify v1.7.1
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit e005195

Please sign in to comment.