Command-line tool for managing usage metrics in DynamoDB.
- Go 1.23+
- AWS credentials configured
- DynamoDB table
usage-metrics
in us-east-1
go install github.com/gkwa/easilydig@latest
Add new usage metric(s) from JSON file(s):
# Single file
easilydig append data.json
# Single file with absolute path
easilydig append /path/to/data.json
# Multiple files using glob pattern
easilydig append ./data/*.json
# Multiple glob patterns
easilydig append ./data/*.json ./archive/*.json
Expected JSON format:
{
"date": "2024-11-10",
"amount": 61.25,
"amountUnits": "GB",
"total": 400,
"totalUnits": "GB",
"overage": 0,
"overageUnits": "GB",
"scrapedAt": "2024-11-10T05:56:21.800Z"
}
Get all metrics from DynamoDB:
easilydig fetch
Increase logging verbosity:
easilydig -v append data.json
easilydig -vv append data.json
Output logs in JSON format:
easilydig --log-format=json append data.json
Build from source:
git clone https://github.com/gkwa/easilydig
cd easilydig
go build
Run Tests:
go test ./... -v
Run Linter:
golangci-lint run
# Build
go build
# Run with local file
./easilydig append testdata/sample.json
# Run tests
go test -v ./...
# Enable debug logging
./easilydig -v append data.json
# Show version
./easilydig version
# Output help
./easilydig --help