https://github.com/mitch000001/fitbit-exporter
An exporter for fitbit data
https://github.com/mitch000001/fitbit-exporter
fitbit
Last synced: 21 days ago
JSON representation
An exporter for fitbit data
- Host: GitHub
- URL: https://github.com/mitch000001/fitbit-exporter
- Owner: mitch000001
- Created: 2021-05-29T13:42:54.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-30T17:29:51.000Z (over 3 years ago)
- Last Synced: 2025-04-05T05:54:19.667Z (23 days ago)
- Topics: fitbit
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fitbit-exporter
## Basic usage
This exporter uses some env vars to initialize the oauth client:```bash
export OAUTH2_CLIENT_ID=client-id
export OAUTH2_CLIENT_SECRET=client-secret
export OAUTH2_REDIRECT_URL=http://localhost:3000/oauth-redirect
export OAUTH2_TOKEN_FILE=token.json # this enables you to persist the token to reuse it even after program exits
```If there isn't already a token you need to go to `http://localhost:3000/auth` or just directly to `/` which will redirect you if not yet authorized.
### Dev setup
In order to use hot reloading this project uses https://github.com/markbates/refresh. Just run `go get github.com/markbates/refresh` and afterwards you can run this project by just typing `refresh` with hot reloading.
## Metrics
Currently this tool uses the prometheus client library to expose basic metrics. In addition the HTTP client and the rate limiter used to query fitbit data are instrumented and will expose metrics prefixed with `fitbit_`.
## Rate limiting
Fitbit has a rate limit on its API. The implementation leverages a rate limiter within the HTTP transport to make sure it is never exhausted. The client returned from the oauth package will use this limiter if it is set within the `Config` struct.