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

Add a version metric #423

Merged
merged 3 commits into from
Feb 14, 2025
Merged

Add a version metric #423

merged 3 commits into from
Feb 14, 2025

Conversation

mjh1
Copy link
Contributor

@mjh1 mjh1 commented Feb 13, 2025

Add a prometheus metric to record the version of the code running, so that we can track this in our dashboards.

@mjh1 mjh1 requested review from victorges and varshith15 February 13, 2025 16:04

config_logging()
logger = logging.getLogger(__name__)

VERSION = Counter('version', 'Runner version', ['app', 'version'])
Copy link
Member

Choose a reason for hiding this comment

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

the other version metrics are Gauge type. i don't know if it'd conflict with Counter or not. https://github.com/livepeer/studio/blob/2bb3b0ab4bd015e3e561266072580192af25cca3/packages/api/src/index.ts#L129-L142

when querying, we simply use the promql expression:

sum by (app, version) version{}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm strange I saw go-livepeer and catalyst using counters, never mind i'll switch to gauge

@@ -153,6 +153,7 @@ jobs:
file: docker/Dockerfile.live-app__PIPELINE__
build-args: |
PIPELINE=${{ matrix.pipeline }}
GIT_SHA=$(git rev-parse HEAD)
Copy link
Member

Choose a reason for hiding this comment

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

need to use github expression here, as it doesn't run bash commands here:

GIT_SHA=${{ (github.ref_type == 'tag' && github.ref_name) || (github.event.pull_request.head.sha || github.sha) }}

@mjh1 mjh1 merged commit a283969 into main Feb 14, 2025
10 checks passed
@mjh1 mjh1 deleted the mh/prometheus branch February 14, 2025 11:54
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.

2 participants