ddcost

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 11 Imported by: 0

README

ddcost

test GitHub tag (latest by date)

A tool that shows a breakdown of Datadog costs in a table.

Usage

Usage: ddcost --api-key=STRING --app-key=STRING

Flags:
  -h, --help                Show context-sensitive help.
      --api-key=STRING      Datadog API key ($DD_API_KEY).
      --app-key=STRING      Datadog APP key ($DD_APP_KEY).
  -v, --view="summary"      Cost breakdown view (summary, sub-org).
  -o, --output="table"      Formatting style for output (table, tsv, json).
  -s, --start-month=TIME    Cost beginning this month (default: half a year ago).
  -e, --end-month=TIME      Cost ending this month (default: this month).
      --version
$ export DD_API_KEY=...
$ export DD_APP_KEY=...
$ ddcost -v sub-org
       ORG       |       PRODUCT       | CHARGE TYPE | 2022-12 | 2023-01 | 2023-02 | 2023-03 | 2023-04
-----------------+---------------------+-------------+---------+---------+---------+---------+----------
  organization1  | fargate_container   | committed   |    1.00 |    1.00 |    1.00 |    1.00 |    1.00
                 |                     | on_demand   |    2.00 |    2.00 |    2.00 |    2.00 |    2.00
                 |                     | total       |    3.00 |    3.00 |    3.00 |    3.00 |    3.00
                 | logs_indexed_15day  | committed   |    0.00 |    0.00 |    0.00 |    0.00 |    0.00
                 |                     | on_demand   |    0.50 |    0.50 |    0.50 |    0.50 |    0.50
                 |                     | total       |    0.50 |    0.50 |    0.50 |    0.50 |    0.50
                 |                     |             |         |         |         |         |
  organization2  | infra_host          | committed   |   10.00 |   10.00 |   10.00 |   10.00 |   10.00
                 |                     | on_demand   |   20.00 |   20.00 |   20.00 |   20.00 |   20.00
                 |                     | total       |   30.00 |   30.00 |   30.00 |   30.00 |   30.00
                 | logs_indexed_15day  | committed   |    1.00 |    1.00 |    1.00 |    1.00 |    1.00
                 |                     | on_demand   |    1.50 |    1.50 |    1.50 |    1.50 |    1.50
                 |                     | total       |    2.50 |    2.50 |    2.50 |    2.50 |    2.50

Installation

brew install winebarrel/ddcost/ddcost

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options *Options) *Client

func (*Client) PrintHistoricalCostByOrg

func (client *Client) PrintHistoricalCostByOrg(out io.Writer)

type Cost added in v1.0.1

type Cost float64

func (Cost) String added in v1.0.1

func (c Cost) String() string

type CostBreakdown

type CostBreakdown map[string]CostByProduct

org_name/product_name/charge_type/month/cost

type CostByChargeType

type CostByChargeType map[string]CostByMonth

charge_type/month/cost

type CostByMonth

type CostByMonth map[string]Cost

charge_type/month/cost

type CostByProduct

type CostByProduct map[string]CostByChargeType

product_name/charge_type/month/cost

type Options

type Options struct {
	APIKey     string    `env:"DD_API_KEY" required:"" help:"Datadog API key."`
	APPKey     string    `env:"DD_APP_KEY" required:"" help:"Datadog APP key."`
	View       string    `short:"v" enum:"summary,sub-org" default:"summary" help:"Cost breakdown view (summary, sub-org)."`
	Output     string    `short:"o" enum:"table,tsv,json" default:"table" help:"Formatting style for output (table, tsv, json)."`
	StartMonth time.Time `short:"s" help:"Cost beginning this month (default: half a year ago)."`
	EndMonth   time.Time `short:"e" help:"Cost ending this month (default: this month)."`
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL