Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

581 B
Raw Blame
package app

import (
	"fmt"
	"net/http"
	"time"
)

var (
	// AutoCompleteCacheControlAge is the max-age for the cache-control header
	// for the autocomplete endpoint.
	// The default export interval for the SDK is 60 seconds, and ~10s at collector, so
	// one minute should be a safe value.
	AutoCompleteCacheControlAge = 60 * time.Second
)

func withCacheControl(maxAge time.Duration, h http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%d", int(maxAge.Seconds())))
		h(w, r)
	}
}