Skip to content

Conversation

@stefan-brus-frequenz
Copy link
Collaborator

Replaces #146

This PR clarifies resampling and streaming semantics of the Reporting API. The primary focus of this change is documentation correctness and consistency. Some breaking API changes are introduced.

Key improvements:

Resampling is now explicitly defined as time-grid materialization over telemetry data, applied to both historical and real-time streams.
sample_time semantics are clarified:
origin time when not resampled,
interval start when resampled.
Resampled streams are time-keyed upsert streams:
metric values may be unset if no data contributed to an interval,
intervals may be re-emitted with updated values when late telemetry arrives.
Examples and field documentation were updated to reflect:
empty values,
interval-based timestamps,
non-append-only behavior.
Some schema or wire-format changes were made.

Signed-off-by: Stefan Brus <stefan.brus@frequenz.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces API version v1alpha11 of the Frequenz Reporting Service, focusing on clarifying and improving the documentation of resampling and streaming semantics. The primary goal is to enhance documentation correctness and consistency while introducing some breaking API changes.

Changes:

  • Clarified resampling semantics: explicitly defined as time-grid materialization with interval-based timestamps and upsert stream behavior
  • Updated sample_time semantics to represent origin time when not resampled, interval start when resampled
  • Changed TimeFilter message to use frequenz.api.common.v1alpha8.types.Interval instead of separate start_time and end_time fields
  • Renamed service from Reporting to ReportingService to align with other Frequenz services
  • Enhanced documentation with examples showing empty values, interval-based timestamps, and non-append-only behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
proto/frequenz/api/reporting/v1alpha11/reporting.proto New API version introducing comprehensive documentation updates for resampling and streaming semantics, service renaming, and TimeFilter restructuring
RELEASE_NOTES.md Added release notes documenting the new v1alpha11 API version and its changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// The formula and metric must have been specified in the corresponding
// request. A single aggregated sample for the metric is returned in the
// sample field. Each message covers a single formula. For multiple
// formulars provided in the request, expect sequential messages in the
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "formulars" should be "formulas".

Suggested change
// formulars provided in the request, expect sequential messages in the
// formulas provided in the request, expect sequential messages in the

Copilot uses AI. Check for mistakes.
//
// !!! caution "Supported metrics"
// Ensure the chosen metric is supported by all relevant microgrid
// electrical components. Failure to meet these conditions might results
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: "might results" should be "might result".

Suggested change
// electrical components. Failure to meet these conditions might results
// electrical components. Failure to meet these conditions might result

Copilot uses AI. Check for mistakes.
// resampled data.
//
// !!! example "Example: Downsampling from 1-second to 15-minute intervals"
// The stored time series has a effective sampling resolution of Δt = 1
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: "has a effective" should be "has an effective".

Suggested change
// The stored time series has a effective sampling resolution of Δt = 1
// The stored time series has an effective sampling resolution of Δt = 1

Copilot uses AI. Check for mistakes.
//
// 2. Dedicated formulas: These support basic math operators while
// concatenating microgrid electrical component IDs.
// Example: `#1 + #2 - #3`, `(#3 * #2) /# 1`
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible typo in formula example: /# 1 appears to have misplaced space. Should likely be / #1.

Suggested change
// Example: `#1 + #2 - #3`, `(#3 * #2) /# 1`
// Example: `#1 + #2 - #3`, `(#3 * #2) / #1`

Copilot uses AI. Check for mistakes.
// microgrids and electrical components.
//
// !!! note
// The filter can specify a list of metrics to be return but also
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: "to be return" should be "to be returned".

Suggested change
// The filter can specify a list of metrics to be return but also
// The filter can specify a list of metrics to be returned but also

Copilot uses AI. Check for mistakes.
Comment on lines +215 to +231
// Semantics:
// - If `end_time` is provided, it MUST be ≤ the current server time. The
// server streams all samples t where start_time ≤ t < end_time and
// then closes the stream.
//
// - If `end_time` is omitted, the server streams all historical samples
// t ≥ start_time (if provided) and then continues streaming new samples
// in real time. The stream remains open indefinitely.
//
// - If `start_time` is omitted:
// – and `end_time` is omitted: the stream produces no historical data
// and begins streaming real-time samples only.
// – and `end_time` is provided: the historical window is empty and
// the stream closes immediately.
//
// Validation rules:
// - end_time > now() → INVALID_ARGUMENT
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation refers to start_time and end_time fields, but the actual field is now interval of type frequenz.api.common.v1alpha8.types.Interval. The documentation should be updated to reference the correct field structure (e.g., interval.start and interval.end or similar, depending on the Interval message definition).

Copilot uses AI. Check for mistakes.
Comment on lines +388 to +389
// This message represents the aggregated - across multiple electrical
// components or sensors- result for one metric and one aggregation
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar/formatting issue: Inconsistent spacing around hyphens/dashes. "aggregated - across multiple electrical components or sensors- result" should be "aggregated—across multiple electrical components or sensors—result" (em dashes without spaces) or "aggregated (across multiple electrical components or sensors) result" (parentheses) for better readability.

Suggested change
// This message represents the aggregated - across multiple electrical
// components or sensors- result for one metric and one aggregation
// This message represents the result of aggregation across multiple electrical
// components or sensors for one metric and one aggregation

Copilot uses AI. Check for mistakes.
// The formula and metric must have been specified in the corresponding
// request. A single aggregated sample for the metric is returned in the
// sample field. Each message covers a single formula. For multiple
// formulars provided in the request, expect sequential
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "formulars" should be "formulas".

Suggested change
// formulars provided in the request, expect sequential
// formulas provided in the request, expect sequential

Copilot uses AI. Check for mistakes.
Comment on lines +440 to +443
// which are included in the data stream. If multiple `MetricConnections`
// messages are specified for different metrics, the filters apply
// separately to each metric. The `connections` specified here correspond
// to the `connections` field in the `MetricSample` message defined in
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete sentence: "which are included in the data stream" appears to be missing a word. Should likely be "which connections are included" or similar.

Suggested change
// which are included in the data stream. If multiple `MetricConnections`
// messages are specified for different metrics, the filters apply
// separately to each metric. The `connections` specified here correspond
// to the `connections` field in the `MetricSample` message defined in
// which connections are included in the data stream. If multiple
// `MetricConnections` messages are specified for different metrics, the
// filters apply separately to each metric. The `connections` specified
// here correspond to the `connections` field in the `MetricSample`

Copilot uses AI. Check for mistakes.
// aggregation_config: {
// microgrid_id: 1,
// metric: "DC_VOLTAGE_V",
// aggregation_formula: "avg(1,2,3)"
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent formula syntax: avg(1,2,3) should use avg(#1,#2,#3) to be consistent with the established pattern for referencing electrical component IDs (see lines 371, 382, 930).

Suggested change
// aggregation_formula: "avg(1,2,3)"
// aggregation_formula: "avg(#1,#2,#3)"

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@cwasicki cwasicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is copied as-is from #146, this LGTM. The copilot comments look reasonable on first glimpse.

Copy link
Contributor

@thomas-nicolai-frequenz thomas-nicolai-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:proto Affects the protocol buffer definition files part:python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants