2021-04-30 13:29:21 +00:00
# Telemetry
2020-10-24 13:06:04 +00:00
2021-04-30 13:29:21 +00:00
This package provides useful classes and abstractions for implementing telemetry
in individual components.
2020-10-24 13:06:04 +00:00
2021-04-30 13:29:21 +00:00
The telemetry service is used by other packages in order to implement telemetry reporting. It may be configured via the `appsettings.json` file or environment variables.
2020-10-24 13:06:04 +00:00
2021-04-30 13:29:21 +00:00
# Configuration
The following configurations is available for the Telemetry service:
- Publisher: (string) The telemetry publisher. i.e: `Azure` , `Disk` , `Firestore` , `Console` .
- ServiceEnabled: (bool) Enables or disables the telemetry collection service.
- PublishInterval: (int) The interval in which to publish the telemetry data.
- ConnectionString: (string) Connection string for the telemetry publisher.
# Telemetry Publishers
Telemetry publishers are used by the telemetry service in order to publish data.
## Azure Telemetry
### Publisher
2020-10-24 13:06:04 +00:00
You can use cloud telemetry for free via Azure-IoT-Hub.
You still need a backend application that will process the messages.
You will need to create a:
- IoT Hub
- IoT Device
Then navigate to your device and grab the primary key, you will need it to create
a connection string of the form:
`HostName=YOUR_IOT_HUB_NAME.azure-devices.net;DeviceId=YOUR_DEVICE_NAME;SharedAccessKey=PRIMARY_OR_SECONDARY_KEY`
The connection string can be passed to the application via `appsettings.json` or command line arguments or environment variables:
```
dotnet run --Telemetry:ConnectionString=CONNECTION_STRING
export Telemetry:ConnectionString=CONNECTION_STRING
```
2021-04-30 13:29:21 +00:00
The `Telemetry:Publisher` must be set to: Azure
2020-10-24 13:06:04 +00:00
You may also use the format from above to override any settings in appsettings.json.
### Reader
A telemetry reader can be found in NucuCar.TestClient. You'll need a connection string that can be found in
Azure's IoT Hub Build-In Endpoints setting.
---
2021-04-30 13:29:21 +00:00
## Disk Telemetry
2020-10-24 13:06:04 +00:00
2021-04-30 13:29:21 +00:00
### Publisher
2020-10-24 13:06:04 +00:00
Publishes telemetry on the disk.
Example connection string:
`Filename=telemetry;FileExtension=csv;Separator=,;BufferSize=4096`
2021-04-30 13:29:21 +00:00
The `Telemetry:Publisher` must be set to: Disk
2020-10-24 13:06:04 +00:00
See the source code for comments on the ConnectionString.
### Reader
You will need to parse the file by yourself.
---