Skip to content

Commit 1e99149

Browse files
authored
Make the API URLs relative (#72)
* Removed unused code detected by staticcheck. * Make the default URL relative This is so that any paths in the API prefix URL are preserved. E.g. `url.Parse("http://127.0.0.1:9090/foo").Parse("bar")` gives `"http://127.0.0.1:9090/foo/bar"` * Made the metadata API url relative This is so that any paths in the API prefix URL are preserved. E.g. `url.Parse("http://127.0.0.1:9090/foo").Parse("bar")` gives `"http://127.0.0.1:9090/foo/bar"`
1 parent bfe3938 commit 1e99149

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

metadata/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Cache struct {
4444

4545
// DefaultEndpointPath is the default HTTP path on which Prometheus serves
4646
// the target metadata endpoint.
47-
const DefaultEndpointPath = "/api/v1/targets/metadata"
47+
const DefaultEndpointPath = "api/v1/targets/metadata"
4848

4949
// The old metric type value for textparse.MetricTypeUnknown that is used in
5050
// Prometheus 2.4 and earlier.

targets/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/prometheus/prometheus/pkg/labels"
2828
)
2929

30-
const DefaultAPIEndpoint = "/api/v1/targets"
30+
const DefaultAPIEndpoint = "api/v1/targets"
3131

3232
func cacheKey(job, instance string) string {
3333
return job + "\xff" + instance

0 commit comments

Comments
 (0)