SDV Telemetry supports multiple types of data sources. This page provides an overview of these types and what features Telemetry supports per data source type.
Sample code for data source implementations is available in the
system/software_defined_vehicle/samples/telemetry directory.
Data source definition in metrics configurations
Metrics configurations define one or more data sources to collect metrics
from. Each data source is identified by its source_identifier. The
source_identifier format depends on the data source:
| Data source | Format | Description | Examples |
|---|---|---|---|
| SDV service | Protobuf message name |
The fully qualified protobuf message name. If the service has multiple
instances, append the service unit name separated by a pipe (|).
|
"com.sdv.google.example.TellTale|com-sdv-google-example-tell-tale-status-hibeam"
|
| Fully Qualified Instance Name (FQIN) with Service Unit Name |
The FQIN and service unit name separated by a pipe (|).
|
"vm-cdc:com.google.android.sdv.pubsub.SomeService/instance1|tire-pressure"
|
|
| Configurable Publisher Registry-based publisher | Publisher name | The exact serviceName used to register the publisher at the Configurable Publisher Registry. |
Any string is valid. |
For each data source, you can use the following options to parameterize the message retrieval. You can define the same data source multiple times with different options in the same metrics configuration. For example, you can have some part of your edge processing use a different sub-sampling interval than other parts of your edge processing.
| Option | Type | Description |
|---|---|---|
connection_type |
SUBSCRIPTION or ON_DEMAND |
If set to SUBSCRIPTION, the Telemetry service subscribes to the data source. If set to ON_DEMAND, the Telemetry service fetches messages from the data source only on demand. |
configuration |
google.protobuf.Any |
If set, the Telemetry service passes through the configuration object to the data source when communicating with it. |
sub_sampling_interval |
google.protobuf.Duration |
If set, messages are sub-sampled, so that the Telemetry service processes a message at most every sub_sampling_interval duration. |
fetch_last_message |
bool |
If set, the Telemetry service retrieves the last published message when subscribing to the data source, even if that message was published in the past. |
Depending on the type of data source (see the following sections), only a subset of parameters is supported by the Telemetry service. The following table provides an overview.
| Option | RPC SDV service | Publish-subscribe (pub/sub) SDV service | Configurable Publisher Registry-based publishers |
|---|---|---|---|
connection_type: SUBSCRIPTION |
Supported 1 | Supported | Supported |
connection_type: ON_DEMAND |
Supported 2 | Supported | Supported 3 |
configuration |
Supported | Not applicable | Supported |
sub_sampling_interval |
Not supported | Supported 4 | Not supported |
fetch_last_message |
Not supported | Supported 5 | Not supported |
CreateSubscription method.
GetLatestMessage method.
PublisherInfo.supportsGet is true.
connection_type: SUBSCRIPTION, not applicable for connection_type: ON_DEMAND.
connection_type: SUBSCRIPTION, not applicable for connection_type: ON_DEMAND.
SDV services (through SDV comms stack)
The Telemetry service can collect data from other SDV services. Both RPC and pub/sub SDV services are supported. Since the Telemetry service doesn't know the list of services it will subscribe to at build time, it relies on Protobuf reflection to decode messages received from SDV services.
SDV services don't provide reflection metadata by default. To make an SDV service usable as a telemetry data source, you must enable runtime config generation of the service's VSIDL catalog. For more information, see VSIDL Provider Guide for Service Bundle Developers.
For testing and evaluation purposes only, you can instead set the
register_reflection_metadata option to true in the service bundle
definition. For more information, see Service bundle.
RPC SDV services
Telemetry has limited support for RPC SDV services. For more information, see Define RPC services. To collect data from an RPC SDV service, the service must expose one or both of the following RPC methods:
CreateSubscriptionreturns a stream of user-defined responses:rpc CreateSubscription(<configuration>) returns (stream <response>)GetLatestMessagereturns a user-defined response:rpc GetLatestMessage(<configuration>) returns (<response>)
You can use the configuration argument to parameterize the behavior of your data source, for example, to request a different publishing frequency or to select the entity you want to subscribe to (for example, which tire to read tire pressure from).
When defining an RPC SDV service as a data source in a metrics configuration,
you can specify a configuration value in the data source definition, which is
used as the argument for this RPC. The Telemetry service handles the
configuration object transparently and passes through whatever you define.
The type of the configuration argument for both methods can be either
google.protobuf.Any or a user-defined type. If you provide both methods,
the argument types must be identical. If you don't need a configuration argument
for these RPC methods, use google.protobuf.Empty.
Depending on the connection_type specified in the data source definition of
the metrics configuration, the Telemetry service calls either
CreateSubscription (for connection_type: SUBSCRIPTION) or GetLatestMessage
(for connection_type: ON_DEMAND).
Pub/sub SDV services
Telemetry has full support for monitoring pub/sub channels defined in VSIDL exposed by SDV services without any additional configuration required. For more information, see Add a publisher to a service bundle.
In addition to subscribing to pub/sub channels, Telemetry also supports on-demand retrieval of the latest message published to a channel.
Configurable Publisher Registry
In addition to collecting data from SDV services using the SDV comms stack, Telemetry supports collecting data from applications and services that register publishers in the Telemetry service's Configurable Publisher Registry. This capability is most useful on IVI, where the SDV comms stack isn't available.
The Configurable Publisher Registry can also be useful for debugging and prototyping without having to write SDV service bundles. For more information, see Configurable Publisher Registry.