Kanject.Insights

View .md

A backend analytics engine you deploy into your own AWS — it ingests your domain events and computes six proven analysis kinds (funnels, cohorts, correlations, and more) with background workers. Define event types in code, run analyses through typed manager services.

You'll learn
  • Let Insights create its tables and queues in your AWS account
  • Register the client surface and the background workers
  • Define event types with IInsightEventManager
  • Know the six built-in analysis kinds and the alerting surface

Provision

Insights creates its own DynamoDB tables, indexes, and SQS work queues in your account when EnableSetup is true on its options; leave it off when those resources already exist.

Register it in your service

Insights has two registration surfaces from Kanject.Insights.Provider.AwsV2.Extensions: AddKanjectInsight wires the client (define events, run analyses), and AddKanjectInsightWorkers wires the background consumers that ingest events and compute snapshots. The workers call AddKanjectInsight themselves, so a host registers one or the other, never both. Both take a typed InsightOption delegate; generic overloads accept your own data context.

csharp
using Kanject.Insights.Provider.AwsV2.Extensions;​var builder = WebApplication.CreateBuilder(args);​// The client surface (define events, run analyses).builder.Services.AddKanjectInsight(options =>{    options.AwsRegionEndpoint = appSettings.AwsRegion;    options.SchemaNamespace   = appSettings.Stage;});​// On the host that runs the background workers (event ingestion, snapshot// computation), call this INSTEAD — it registers the client surface too:// builder.Services.AddKanjectInsightWorkers(options => { /* same options */ });​var app = builder.Build();app.Run();

Define events, run analyses

This is a server-side engine, not a Track() client. You register the event types you want to analyse through IInsightEventManager, and run each analysis through the manager service for its kind:

csharp
// Define the event types you'll analyse through IInsightEventManager.public class AnalyticsSetup(IInsightEventManager events){    public Task DefineCheckoutEventAsync(CreateInsightEventRequest request)        => events.CreateInsightEventAsync(request);}​// Run an analysis through the manager service for its kind.public class Reporting(IFunnelInsightManagerService funnels){    // Build/query a funnel (InsightKind.Funnel) over the ingested events.    // Each InsightKind has its own manager service.}

Six built-in analysis kinds

Every kind is a real InsightKind with its own manager service over the ingested event stream:

  • Standard — deconstruct single events across metrics (IStandardInsightManagerService).
  • Funnel — map a conversion journey and find the friction step.
  • Correlation — relate distinct events and measure significance.
  • Cohort — track a segment's behaviour over time.
  • Comparative — period-over-period trend changes.
  • Event sequence — ordered patterns with temporal constraints.

What you get

  • Backend ingestion — event ingestion + snapshot computation on SQS/EventBridge/SNS workers, in your account.
  • Six analysis kinds — Standard, Funnel, Correlation, Cohort, Comparative, Event Sequence, each a typed manager service.
  • Alert rules — AlertRuleType.Threshold and AlertRuleType.AnomalyDetection with configurable sensitivity.
  • Scheduled evaluation — EventBridge-scheduled alert/snapshot evaluation.
  • Event management — define and toggle event types via IInsightEventManager.
Recap
  • Register AddKanjectInsight, or AddKanjectInsightWorkers on a worker host; EnableSetup has it create its tables and queues.
  • It's a backend engine — define event types via IInsightEventManager, not a client-side Track().
  • Six InsightKind analyses (Standard/Funnel/Correlation/Cohort/Comparative/EventSequence) via manager services.
  • Threshold and anomaly alert rules run on scheduled evaluation.
Was this page helpful?