Skip to content

Commit ab54419

Browse files
committed
cli: add cost estimate to tsdump upload
This commit adds a cost estimate to the tsdump Datadog upload command to help people understand how much a tsdump upload costs (roughly $.20 per single-node upload, $2 per 10-node upload, or $20 per 100-node upload). Release note: None
1 parent 03c6832 commit ab54419

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/cli/tsdump_upload.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,10 @@ func (d *datadogWriter) upload(fileName string) error {
486486
}()
487487
}
488488

489+
seriesUploaded := 0
489490
for {
490491
data, err := decodeOne()
492+
seriesUploaded += len(data)
491493
if err == io.EOF {
492494
if len(data) != 0 {
493495
wg.Add(1)
@@ -513,6 +515,16 @@ func (d *datadogWriter) upload(fileName string) error {
513515
uploadStatus = UploadStatusFailure
514516
}
515517
fmt.Printf("\nUpload status: %s!\n", uploadStatus)
518+
fmt.Printf("Uploaded %d series overall\n", seriesUploaded)
519+
// Estimate cost. The cost of historical metrics ingest is based on how many
520+
// metrics were active during the upload window. Assuming the entire upload
521+
// happens during a given hour, that means the cost will be equal to the count
522+
// of uploaded series times $4.55/100 custom metrics (our rate) divided by
523+
// 730 hours per month.
524+
// For a single node upload that has 6500 unique series, that's about $.40
525+
// per upload.
526+
estimatedCost := float64(seriesUploaded) * 4.55 / 100 / 730
527+
fmt.Printf("Estimated cost of this upload: $%.2f\n", estimatedCost)
516528

517529
if metricsUploadState.isSingleUploadSucceeded {
518530
var isDatadogUploadFailed = false

0 commit comments

Comments
 (0)