Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyticsHandler ¶ added in v1.35.0
type AnalyticsHandler struct {
// contains filtered or unexported fields
}
AnalyticsHandler handles POST /api/analytics and GET /api/analytics/summary.
func NewAnalyticsHandler ¶ added in v1.35.0
func NewAnalyticsHandler(provider analytics.AnalyticsProvider) *AnalyticsHandler
NewAnalyticsHandler creates a new AnalyticsHandler with a 1000/min rate limiter.
func NewAnalyticsHandlerWithClient ¶ added in v1.35.0
func NewAnalyticsHandlerWithClient(provider analytics.AnalyticsProvider, client *ent.Client) *AnalyticsHandler
NewAnalyticsHandlerWithClient creates a new AnalyticsHandler that can also serve summary queries from the ent client. Use this in production wiring.
func (*AnalyticsHandler) HandlePost ¶ added in v1.35.0
func (h *AnalyticsHandler) HandlePost(w http.ResponseWriter, r *http.Request)
HandlePost handles POST /api/analytics.
func (*AnalyticsHandler) HandleSummary ¶ added in v1.35.0
func (h *AnalyticsHandler) HandleSummary(w http.ResponseWriter, r *http.Request)
HandleSummary handles GET /api/analytics/summary.
func (*AnalyticsHandler) RegisterRoutes ¶ added in v1.35.0
func (h *AnalyticsHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers the analytics routes on mux.
type OtelProxyHandler ¶ added in v1.52.0
type OtelProxyHandler struct {
// contains filtered or unexported fields
}
OtelProxyHandler relays browser-originated OTLP/HTTP export requests (traces, metrics) to the same collector endpoint the Go server itself exports to (telemetry.Config.OTLPHTTPEndpoint), so frontend spans land in the same observability backend as backend spans without exposing the collector to the browser directly — no CORS, no separate TLS/auth surface, and it inherits this server's existing auth middleware since it's just another route on srv.mux.
func NewOtelProxyHandler ¶ added in v1.52.0
func NewOtelProxyHandler(endpoint string) *OtelProxyHandler
NewOtelProxyHandler builds a handler that forwards to endpoint (e.g. "http://localhost:4318"), matching telemetry.Config.OTLPHTTPEndpoint.
func (*OtelProxyHandler) HandleMetrics ¶ added in v1.52.0
func (h *OtelProxyHandler) HandleMetrics(w http.ResponseWriter, r *http.Request)
HandleMetrics forwards POST /api/otel/v1/metrics to <endpoint>/v1/metrics.
func (*OtelProxyHandler) HandleTraces ¶ added in v1.52.0
func (h *OtelProxyHandler) HandleTraces(w http.ResponseWriter, r *http.Request)
HandleTraces forwards POST /api/otel/v1/traces to <endpoint>/v1/traces.
type TelemetryHandler ¶
type TelemetryHandler struct {
// contains filtered or unexported fields
}
TelemetryHandler handles frontend performance telemetry events.
func NewTelemetryHandler ¶
func NewTelemetryHandler(provider analytics.AnalyticsProvider) *TelemetryHandler
NewTelemetryHandler creates a new TelemetryHandler. The provider receives a forwarded analytics.Event for each valid telemetry request. Pass analytics.NewLogAnalyticsProvider() in tests or when no DB is available.
func (*TelemetryHandler) HandleTelemetry ¶
func (h *TelemetryHandler) HandleTelemetry(w http.ResponseWriter, r *http.Request)
HandleTelemetry handles POST /api/telemetry.