33CircuitPython_DataDog is a small CircuitPython 9.x library for sending custom
44metrics to the Datadog HTTP API at ` POST /api/v2/series ` .
55
6- The library is designed for ESP32-class CircuitPython boards. It has no runtime
7- dependencies beyond ` time ` and the ` adafruit_requests.Session ` object supplied
8- by your own WiFi setup code.
6+ The library is designed for network-capable CircuitPython boards, including
7+ boards with built-in WiFi, Ethernet, or a supported network coprocessor. It has
8+ no runtime dependencies beyond ` time ` and the ` adafruit_requests.Session ` object
9+ supplied by your own network setup code.
910
1011## Installation
1112
@@ -30,7 +31,7 @@ CircuitPython_DataDog/
3031```
3132
3233You are responsible for installing ` adafruit_requests ` and its required support
33- files on the device, and for connecting WiFi before creating the client.
34+ files on the device, and for connecting the network before creating the client.
3435
3536## Usage
3637
@@ -41,6 +42,8 @@ import wifi
4142import adafruit_requests
4243from datadog import DatadogClient
4344
45+ # This setup is for boards with built-in WiFi. If your board uses Ethernet
46+ # or an external coprocessor, create the session for that network interface.
4447wifi.radio.connect(" ssid" , " password" )
4548pool = socketpool.SocketPool(wifi.radio)
4649session = adafruit_requests.Session(pool, ssl.create_default_context())
@@ -49,7 +52,7 @@ client = DatadogClient(
4952 session,
5053 " DATADOG_API_KEY" ,
5154 site = " datadoghq.com" ,
52- default_tags = [" runtime:circuitpython" , " board:esp32 " ],
55+ default_tags = [" runtime:circuitpython" , " board:my-board " ],
5356)
5457
5558client.gauge(" circuitpython.temperature" , 24.5 , tags = [" room:lab" ])
@@ -121,8 +124,8 @@ The client prepends `api.` when needed, so `us3.datadoghq.com` becomes
121124
122125## Notes
123126
124- - WiFi setup, TLS setup, NTP/RTC time setup, and the requests session are caller
125- responsibilities.
127+ - Network setup, TLS setup, NTP/RTC time setup, and the requests session are
128+ caller responsibilities.
126129- Datadog expects metric timestamps to be close to current Unix time. If your
127130 board does not have correct time after boot, set the RTC before sending
128131 metrics.
0 commit comments