Skip to main content

core-analytics-service

Tracks usage events for billing and analytics. Stores event records scoped to organizations with event type classification and optional metadata.

Worker name: crow-core-analytics-service Domain (prod): internal.analytics.crowai.dev Domain (dev): dev.internal.analytics.crowai.dev

Schema

analytics_event

ColumnTypeNotes
idtext PK
organization_idtext
event_typetexte.g. interaction.created, pattern.generated
sourcetextnullable, originating service
metadatatextnullable, JSON
created_atintegerepoch ms

Routes

MethodPathDescription
POST/api/v1/analytics/eventsCreate an analytics event
GET/api/v1/analytics/eventsList events for org (paginated)
GET/api/v1/analytics/summaryAggregated event summary
GET/healthHealth check

Environment Variables

VariableExample
ENVIRONMENTdev

Secrets

SecretPurpose
INTERNAL_GATEWAY_KEYGateway trust validation

Bindings

BindingTypeName
DBD1crow-core-analytics-service-db
R2_BUCKETR2crow-core-analytics-service-store

Dependencies

  • Inbound: gateway (dashboard analytics queries), other services (event creation)

Key Behaviors

  • INTERNAL_GATEWAY_KEY guard: All routes require the shared internal key
  • BOLA: Events are scoped to organization_id, checked against X-Organization-Id
  • ZodError sanitization: Validation errors return generic messages