The Metrics Configuration Generator (MCG) is a service that simplifies authoring
SDV telemetry configurations. MCG converts human-readable JSON configurations
into the binary MetricsConfiguration protocol buffer (protobuf) file format
required by on-vehicle telemetry campaigns.
MCG is a web service that you interact with using standard HTTP requests. This
API-based approach lets you use command-line tools like curl for manual
generation and debugging, or integrate MCG as a backend for more sophisticated
tooling, such as a graphical interface for building configurations.
Features
The Telemetry service on the vehicle requires a MetricsConfiguration binary
protobuf message. While this message can be represented as textproto format for
debugging, authoring this format directly requires detailed knowledge of its
low-level structure and can be tedious and prone to error. MCG streamlines this
process by shifting configuration authoring to a user-friendly JSON format.
MCG includes the following features:
- JSON-based configuration: Metrics configurations, including data sources, processing logic, and reporting rules, can be defined in a human-readable JSON format, which MCG compiles into the required binary protobuf format.
- Built-in validation: The generation process automatically validates configurations against signal definitions and schema rules to detect errors before deployment.
- Automatic message-type generation: Aggregators and reports produce results that must be defined using protobuf message descriptors in the final binary configuration. MCG infers the structure of these results based on input signal types and aggregation logic, and automatically generates the required message descriptors. This frees you from needing to manually define schemas for intermediate or report-specific data structures.
- Easier expression authoring: A custom human-readable grammar for defining expressions avoids manually constructing expression trees.
Workflow
Using MCG to generate metrics configurations involves two main phases: a one-time upload of each Vehicle Signal Catalog version you intend to use, followed by writing and generating individual metrics configurations.
Upload signal definitions: This step needs to be performed only once per Vehicle Signal Catalog version. To enable validation and type inference, MCG must have access to the vehicle signal definitions you intend to reference in your configurations. These definitions should already exist as protobuf files in your project as part of the VSIDL catalog (or you can use sample definitions to experiment). To make them available to MCG, package them into a Vehicle Signal Catalog and upload it using the API:
- To package your protobuf files into a FileDescriptorSet, see Create a FileDescriptorSet.
- To base64-encode and upload the catalog, see Add or update a catalog version.
Write configuration: After a catalog version is uploaded to MCG, you can write any number of metrics configurations that reference it. In the JSON configuration, you define which data sources to use, how to perform calculations or aggregations on that data, and the triggers that determine when results are generated.
Generate: Submit your JSON configuration to the MCG API. The API validates the configuration and compiles it into the
MetricsConfigurationformat. This can be requested as binary protobuf (application/x-protobuf) for on-vehicle use, or as textproto (text/x-protobuf) for review or debugging.- To generate, use POST /api/v1/generate_metrics_config.
For comprehensive details on all endpoints, request and response formats, and usage examples, see the MCG API reference.
Deployment
As a cloud-native service, MCG is designed to be deployed to a cloud environment (such as Google Cloud Run), providing a central point for configuration generation and validation across your teams. For deployment instructions, see Deploy to Google Cloud.
For local development and testing, MCG can also be run as a standalone service on a developer machine. For setup instructions, see Run locally.