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

Serve behind route prefix #283

Merged
merged 4 commits into from
Jan 17, 2025
Merged

Conversation

kwilt
Copy link
Contributor

@kwilt kwilt commented Jan 10, 2025

This new parameter will allow for serving the landing page when using --web.external-url as an argument with many exporters.

I added this as it is needed for this pull request: prometheus/snmp_exporter#1335

So in practice it will look something like this:

landingConfig := web.LandingConfig{
        // config stuff goes here ...
		}
                                                                      // new parameter
		landingPage, err := web.NewLandingPage(landingConfig, *routePrefix != "")
		if err != nil {
			logger.Error("Error creating landing page", "err", err)
			os.Exit(1)
		}
		http.Handle(*routePrefix, landingPage)

…for --web.external-url to be used with LandingPageHandler

Signed-off-by: kwilt <[email protected]>
web/landing_page.go Outdated Show resolved Hide resolved
@kwilt
Copy link
Contributor Author

kwilt commented Jan 11, 2025

Okay, I think I've made the changes you requested

@kwilt kwilt changed the title routePrefixed override Serve behind route prefix Jan 11, 2025
@SuperQ
Copy link
Member

SuperQ commented Jan 11, 2025

Looking good so far, thanks!

@kwilt
Copy link
Contributor Author

kwilt commented Jan 15, 2025

Anything else you'd like fixed/added to this? 😄

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

Thanks!

@SuperQ SuperQ merged commit 9a0befe into prometheus:master Jan 17, 2025
4 checks passed
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