Influx Db
Description
InfluxDB can be used as the backing implementation for Flex time-series operations. Your application code should depend on IFlexTimeSeriesStore, while Flex provides the provider bridge and wiring.
Important concepts
IFlexTimeSeriesStoreis the contract: app code writes and queries time-series data via a shared interface.Bucket-based storage: InfluxDB typically stores points into a bucket (configured in appsettings).
Provider bridge: the InfluxDB implementation is exposed via an
IFlexTimeSeriesStoreBridgeinternally, but most consumers only needIFlexTimeSeriesStore.
Configuration in DI
Add the provider in your DI composition root (commonly in EndPoints/...CommonConfigs/OtherApplicationServicesConfig.cs or wherever you centralize registrations).
// using Sumeru.Flex; // IFlexTimeSeriesStore
public static class OtherApplicationServicesConfig
{
public static IServiceCollection AddOtherApplicationServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Registers InfluxDB as the IFlexTimeSeriesStore bridge.
// Flex auto-wires generated Queries/Handlers that *use* IFlexTimeSeriesStore.
services.AddFlexInfluxDBTimeSeriesStore(configuration);
return services;
}
}appsettings.json
Configuration is read from FlexBase:DataStores:TimeSeries:InfluxDB.
Examples (template-based)
These examples mirror the generated Query and PostBusHandler templates. You do not register these types manually—Flex discovers and wires generated Queries/Handlers automatically.
Get points in a time range (Query)
InfluxDB considerations
Keep
Tokenin a secrets provider (don’t commit it to source control).Ensure
Bucketexists and the token has access to read/write it.
Last updated