> For the complete documentation index, see [llms.txt](https://docs.flexbase.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flexbase.in/data-and-providers/data-stores/time-series-store.md).

# Time Series Store

## Description

Time-series providers register through `IFlexTimeSeriesStore`. Your application code stays provider-agnostic while the selected provider handles ingestion, querying, and retention.

## Infrastructure arrangement

When you add a time-series provider through **Flex Studio**, Flex generates the provider infrastructure and configuration:

1. Provider files under `Infrastructure/Providers/{YourApplication}.DataStoreProviders/TimeSeries/{Provider}/`
2. Default configuration under `Application/EndPoints/{YourApplication}.EndPoint.CommonConfigs/AppSettings/DataStores/TimeSeries/{Provider}.json`

Flex auto-wires generated Queries/Handlers/Plugins that use `IFlexTimeSeriesStore`—you only register the provider.

## Configuration in DI

Register only the provider time-series store you need.

```csharp
// Pick ONE provider.
services.AddFlexAzureDataExplorerTimeSeriesStore(configuration);
// services.AddFlexInfluxDBTimeSeriesStore(configuration);
// services.AddFlexTimescaleDBTimeSeriesStore(configuration);
```

## appsettings.json

Time-series configuration is read from `FlexBase:DataStores:TimeSeries:<Provider>`.

```json
{
  "FlexBase": {
    "DataStores": {
      "TimeSeries": {
        "InfluxDB": {
          "Url": "http://localhost:8086",
          "Token": "<store-in-secrets>",
          "Organization": "your-org",
          "Bucket": "your-bucket"
        }
      }
    }
  }
}
```

## Sample usage ({YourApplication})

```csharp
public class MetricReporter
{
	private readonly IFlexTimeSeriesStore _timeSeries;

	public MetricReporter(IFlexTimeSeriesStore timeSeries)
		=> _timeSeries = timeSeries;

	public Task RecordAsync(MetricPoint point)
		=> _timeSeries.WriteAsync<MetricPoint>(point);
}

public class MetricPoint
{
	public string SeriesId { get; set; }
	public DateTime Timestamp { get; set; }
}
```

## Provider pages

* Azure Data Explorer (Kusto): `time-series-store/azure-data-explorer.md`
* InfluxDB: `time-series-store/influx-db.md`
* TimescaleDB: `time-series-store/timescale-db.md`

## Provider considerations

* Keep secrets (tokens/credentials/connection strings) out of source control.
* Configure retention and batching in the provider section to match your telemetry volume.
