Class: ActiveAgent::Dashboard::Api::TracesController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- ActiveAgent::Dashboard::Api::TracesController
- Defined in:
- lib/active_agent/dashboard/app/controllers/active_agent/dashboard/api/traces_controller.rb
Overview
Telemetry ingestion endpoint.
Receives traces from ActiveAgent::Telemetry::Reporter and stores them for analysis and visualization in the dashboard.
Supports two modes:
-
Local mode: No authentication, synchronous processing
-
Multi-tenant mode: Bearer token auth, async processing via job
Instance Method Summary collapse
-
#create ⇒ Object
POST /active_agent/api/traces.
Instance Method Details
#create ⇒ Object
POST /active_agent/api/traces
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/active_agent/dashboard/app/controllers/active_agent/dashboard/api/traces_controller.rb', line 38 def create traces = params[:traces] || [] sdk_info = params[:sdk] || {} return head :accepted if traces.empty? if ActiveAgent::Dashboard.multi_tenant? # Multi-tenant mode: process in background ActiveAgent::ProcessTelemetryTracesJob.perform_later( account_id: @account&.id, traces: traces.as_json, sdk_info: sdk_info.as_json, received_at: Time.current.iso8601(6) ) else # Local mode: process synchronously process_traces_synchronously(traces, sdk_info) end head :accepted rescue ActionController::ParameterMissing => e render json: { error: e. }, status: :bad_request rescue StandardError => e Rails.logger.error("[ActiveAgent::Dashboard] Trace ingestion error: #{e.}") render json: { error: "Internal server error" }, status: :internal_server_error end |