Historical telemetry example
See rendered uplink, acceptance, wait, program-log, and downlink examples for the CLI wrappers used below. Historical API result data remains in the downlinked file.
This finite workload queries one historical battery measurement and Customer
Controller logs from the previous 15 minutes. It writes the unmodified API
responses, query strings, and log time bounds to
/data/results/telemetry-query.json.
Use a Tenant account with DEV access, permission to uplink and downlink files
on default, and permission to submit Workload Runs. The workload identity
also needs read access to historical metrics and logs.
From the repository root, uplink the application. If the CLI shows a device code, open the verification URL and complete the browser sign-in described in Getting started.
omnicloud-cli --dev storage uplink default \
docs/examples/telemetry/query.py examples/telemetry/query.py
For the remaining steps, open an interactive session with omnicloud-cli --dev.
You can also use that session to uplink the application instead of the one-shot
command above.
dphi> storage uplink default docs/examples/telemetry/query.py examples/telemetry/query.py
Submit and observe the workload:
dphi> run create docs/examples/telemetry/workload.yaml --idempotency-key telemetry-query-001
dphi> run wait YOUR_RUN_ID
dphi> run logs YOUR_RUN_ID --component-name telemetry-query
After the run reaches Succeeded, retrieve the result:
dphi> storage downlink default results/telemetry-query.json ./telemetry-query.json
An empty metric or log result is valid. It means no matching historical data was retained for the query time rather than that the workload failed.