MCPcopy
hub / github.com/prometheus/pushgateway / Static

Function Static

handler/misc.go:65–78  ·  view source on GitHub ↗

Static serves the static files from the provided http.FileSystem. The returned handler is already instrumented for Prometheus.

(root http.FileSystem, prefix string)

Source from the content-addressed store, hash-verified

63//
64// The returned handler is already instrumented for Prometheus.
65func Static(root http.FileSystem, prefix string) http.Handler {
66 if prefix == "/" {
67 prefix = ""
68 }
69
70 handler := server.StaticFileServer(root)
71 return InstrumentWithCounter(
72 "static",
73 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
74 r.URL.Path = r.URL.Path[len(prefix):]
75 handler.ServeHTTP(w, r)
76 }),
77 )
78}

Callers 2

mainFunction · 0.92
TestRoutePrefixForStaticFunction · 0.85

Calls 1

InstrumentWithCounterFunction · 0.85

Tested by 1

TestRoutePrefixForStaticFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…