Time Series: Working with Time Series in Production
Today, June 18, 2026, the volume of generated data continues to grow exponentially. A special place is occupied by time series—sequences of measurements ordered in time. From server monitoring to financial flow analysis, the ability to work with time series has become critical for any production solution.
In this article, we will break down how to organize the full cycle of time series processing: collection, storage, analysis, and forecasting. You will learn which tools (InfluxDB, Prometheus, Prophet) can help turn raw data into valuable insights.
Data Collection: First Steps
The key stage is correct metric collection. Time series can come from IoT devices, application logs, or monitoring systems. For this, use:
- Prometheus — a metric collection system with a pull model, ideal for microservice architecture.
- Telegraf — an agent for collection, supporting hundreds of sources (CPU, Docker, Kafka).
- Custom agents — for specific business metrics, such as the number of active users.
Important: at the collection stage, establish a unified time format (Unix timestamp) and polling frequency (e.g., every 15 seconds). This will simplify subsequent analytics.
Storage: InfluxDB vs. Prometheus
The choice of a database for time series determines query speed and storage cost. Let's look at two leaders:
| Criteria | InfluxDB | Prometheus |
|---|---|---|
| Data model | Tags + fields, flex schema | Labels + values |
| Storage | TSM engine, 10:1 compression | Local storage, retention policies |
| Query language | Flux (or InfluxQL) | PromQL |
| Clustering | InfluxDB Enterprise (paid) | Built-in, via Thanos |
| Ideal use case | Long-term analytics, complex aggregations | Real-time monitoring, alerting |
Recommendation: for production with a volume > 1 million points per second, use InfluxDB with the TSM engine. If you need fast alerting, use Prometheus.
Analytics: From Raw Data to Insights
Once data is collected, the most interesting part begins—time series analytics. Main tasks:
- Anomaly detection — finding outliers (e.g., a sharp spike in CPU load).
- Seasonality — identifying recurring patterns (daily traffic peaks).
- Trends — long-term changes (20% monthly growth in requests).
Example in InfluxQL:
SELECT MEAN("cpu_usage") FROM "system"
WHERE time > now() - 1h
GROUP BY time(5m)
For visualization, use Grafana—it connects to both InfluxDB and Prometheus, allowing you to build real-time dashboards.
Forecasting: Prophet and Machine Learning
The final stage is time series forecasting. Here, the Prophet library from Facebook (Meta) comes to the rescue. It is designed for business metrics and handles well:
- Automatic consideration of holidays and weekends.
- Handling missing data.
- Modeling seasonality (weekly, yearly).
Example in Python:
from prophet import Prophet
import pandas as pd
df = pd.read_csv('metrics.csv')
df.columns = ['ds', 'y'] # ds — date, y — value
model = Prophet()
model.fit(df)
future = model.make_future_dataframe(periods=30)
forecast = model.predict(future)
Important: Prophet provides uncertainty intervals—this helps assess risks. For more accurate forecasts, combine Prophet with LSTM networks (if you have a lot of data).
Conclusion
Working with time series in production is not just about choosing a tool (InfluxDB, Prometheus), but also understanding the full cycle: from metric collection to forecasting. Start small: set up metric collection via Telegraf into InfluxDB, build a dashboard in Grafana, and then implement Prophet to predict peak loads.
Want to dive deeper into time series analytics? Subscribe to our blog—in upcoming articles, we will cover anomaly detection cases with machine learning.
Comments