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 metrics version #1248

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add metrics version #1248

wants to merge 4 commits into from

Conversation

withinboredom
Copy link
Collaborator

@withinboredom withinboredom commented Dec 15, 2024

closes #1225

This adds a new global set by -X ld variable, VersionString which is injected during the Docker build. This can be fetched via the frankenphp_version labels, as well as the current php version reported.

Dockerfile Outdated Show resolved Hide resolved
@@ -11,6 +11,7 @@ import (

var metricsNameRegex = regexp.MustCompile(`\W+`)
var metricsNameFixRegex = regexp.MustCompile(`^_+|_+$`)
var VersionString = "dev"
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe could you use https://pkg.go.dev/runtime/debug#ReadBuildInfo instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll take a look!

Copy link
Owner

Choose a reason for hiding this comment

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

Actually, the version of the FrankenPHP module (and of all other installed modules) should already be exposed by Caddy: https://github.com/caddyserver/caddy/blob/v2.8.4/metrics.go#L15

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the string currently output from a production instance:

go_build_info{checksum="",path="github.com/dunglas/frankenphp/caddy",version="(devel)"} 1

It doesn't seem too useful :(

Copy link
Owner

Choose a reason for hiding this comment

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

Hum this looks like an issue in my release script 😅 (because of the replace). Isn't the version of lib (not the Caddy module) displayed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure what you mean, but that is the only thing in the metrics.

Copy link
Owner

@dunglas dunglas Dec 20, 2024

Choose a reason for hiding this comment

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

I mean we should have the version of github.com/dunglas/frankenphp too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are no dependencies listed, just the top-level.

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.

Prometheus metrics to get FrankenPHP and PHP version
2 participants