feat: Add OpenTelemetry OTLP HTTP receiver
- Add POST /v1/traces endpoint for OTLP JSON trace ingestion - Convert OTLP spans to internal format and save to PostgreSQL - Manual JSON parsing (no Go 1.24 dependencies) - Add Node.js instrumentation example with Express - Add Python instrumentation example with Flask - Auto-instrumentation support for both languages
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/bigtux/ophion/internal/auth"
|
||||
"github.com/bigtux/ophion/internal/otel"
|
||||
"github.com/bigtux/ophion/internal/security"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
@@ -271,6 +272,19 @@ func (s *Server) setupRoutes() {
|
||||
// Security headers
|
||||
s.app.Use(security.SecurityHeaders())
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 🔭 OTLP HTTP Receiver (OpenTelemetry Protocol)
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Standard OTLP endpoint - can be public or protected based on config
|
||||
otlpReceiver := otel.NewOTLPReceiver(s.db)
|
||||
|
||||
// OTLP routes (public by default for easy integration)
|
||||
// For production, consider adding auth middleware
|
||||
s.app.Post("/v1/traces", otlpReceiver.HandleTraces)
|
||||
|
||||
// Also support the full path that some SDKs use
|
||||
s.app.Post("/v1/traces/", otlpReceiver.HandleTraces)
|
||||
|
||||
// API v1
|
||||
api := s.app.Group("/api/v1")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user