Situation
A new production line had been assembled from machines by six vendors plus vision cameras, and every vendor exposed its own counters, alarm logic and field names. Nobody had a common view of how many units each station handled per hour or per shift, or where product was lost between the first station and the pallet. The plant's quality team worked from a SharePoint site and Excel, never from a cloud console, so reports had to arrive there. And high-frequency machine messages had to be kept both for live status and for long-term analysis, without anyone running servers.
What we built
Machine data leaves the plant through an edge runtime that publishes one flat JSON message per machine over MQTT on three topics. In the cloud, rules fan each message out twice: a real-time path into a live time-series store within seconds, and a lake path through a batching delivery stream into a Parquet data lake, partitioned by machine, year, month, day and hour. One JSON schema file per machine describes its fields, and the infrastructure code generates one catalogue table per file. Adding a machine or a field is a file change and a redeploy.
Queries over the lake count product per station per hour over 14 days and per day, and compute each station's absolute and percentage difference against the input at the head of the line, which is the loss along the line. A dashboard on the shop floor shows a tile per station in line order with its count and its delta against input, in German, for whatever time window the user picks. Every night at 02:30 UTC two jobs run the saved queries, convert the result to Excel and overwrite fixed files in the plant's quality SharePoint. The quality team opens the same file every morning and finds yesterday's data in it.
The whole cloud side is four infrastructure-as-code stacks. Schemas, queries and jobs are files discovered from the repository, so the stacks grow by adding files.
The hard part
Thirteen record shapes on one stream. The machines do not share a schema, and a universal one would have thrown away what makes each station's data useful: eleven reject reasons from the cartoners, eight robot pairs with their own counters and deactivated flags from the dough-spreading cell, set-point against actual speed from the sheeting line, recipe changes, OK and not-good counts by size axis from the cameras. The batching function groups each batch by machine before it writes Parquet, so one delivery stream carries thirteen different record shapes without a universal schema, and every file is read back as a self-check before it is returned.
The second hard part was replacing the ingestion path under load. The first version wrote one Parquet file per message from a function, which filled the lake from go-live and cost more with every message. The replacement, a batching delivery stream with dynamic partitioning, was built side by side against a test bucket and a test catalogue while the old path kept serving the dashboards. The storage layout was kept identical, so the catalogue, the views, the dashboard and the reports needed no change, and the cutover was a four-step checklist written in the code.
Outcome
- 13 production machines by six vendors plus one prototype quality device on one line, 14 schema files, 260 catalogued columns, 3 topics, one catalogue table per machine (code, 2023).
- Live data within seconds in the time-series store. The lake within 15 minutes, queryable within a further 2 hours (code).
- Adding a machine is one schema file and a redeploy.
- The ingestion path replaced without downtime, built against a test bucket while the old path served the dashboards, cut over with the storage layout unchanged.
- Line-yield analytics per station per hour and per day, with absolute and percentage loss against input.
- Nightly reports in the quality team's SharePoint at 02:30 UTC.
- Serverless throughout, as four infrastructure stacks in Frankfurt.
What changed: six vendors' counters became one line-wide view of yield and loss, on the shop floor and in the quality team's morning report, with onboarding of a machine reduced to a file.
Fact sheet
| Client | a German food manufacturer, for a plant opened in September 2022. |
|---|---|
| Engagement | build of a serverless machine-data platform for a newly opened plant, delivered as infrastructure as code. Live data from January 2023, dashboards at their 64th saved revision by April 2023, the ingestion migration built in July 2023. |
| Platform | an edge runtime at the plant, a cloud MQTT broker and rules engine with 3 topics and 6 rules, serverless functions in Python, a batching delivery stream with a conversion function and dynamic partitioning, a Parquet data lake with Hive-style partitions, a data catalogue with a crawler every 2 hours, SQL queries and views over the lake, a time-series store with 48 hours of hot data, scheduled report jobs, a secrets store for the SharePoint credentials, logging and tracing on every function, dashboards in Grafana 8.4 with the lake as the data source, four infrastructure stacks in one cloud region. |
| Numbers, with their dates | 13 machines, 6 vendors, 14 schemas, 260 columns, 3 topics (May to July 2023). Lake within 15 minutes, catalogue within 2 hours, live store within seconds. Reports at 02:30 UTC. |