Using the Cloud SDK
Querying using the Cloud SDK
The primary programmatic way data scientists query for telemetry data is via the Cloud SDK, a lightweight Python module which can interact with the query API. It can be installed with pip3 install formant
.
See the section on querying for telemetry data from our full guide to the Cloud SDK
Example script
Here's an example of how telemetry data can be queried with the Cloud SDK. Check out the full guide for more examples and explanation.
from formant.sdk.cloud.v1 import Client as FormantClient
if __name__ == "__main__":
# to authenticate set FORMANT_EMAIL and FORMANT_PASSWORD
# environment variables for an existing service account
fclient = FormantClient()
result = fclient.query(
{
"start": "2021-02-22T23:59:00.000Z",
"end": "2021-02-23T00:00:00.000Z",
"deviceIds": ["2c18bc8b-c5e4-4ea0-8886-a8363d185597"],
"names": ["$.host.network", "$.host.cpu"],
}
)
print(result)
Updated 12 months ago