weaveworks / billing-client

A client library for sending usage data to the billing system.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

billing-client

A client library for sending usage data to the billing system.

Open sourced so it can be imported into our open-source projects.

Usage

import billing "github.com/weaveworks/billing-client"

func init() {
  billing.MustRegisterMetrics()
}

func main() {
  var cfg billing.Config
  cfg.RegisterFlags(flag.CommandLine)
  flag.Parse()

  client, err := billing.NewClient(cfg)
  defer client.Close()

  err = client.AddAmounts(
    uniqueKey, // Unique hash of the data, or a uuid here for deduping
    internalInstanceID,
    timestamp,
    billing.Amounts{
      billing.ContainerSeconds: 1234,
    },
    map[string]string{
      "metadata": "goes here"
    },
  )
}

Getting Help

If you have any questions about, feedback for or problems with billing-client:

Weaveworks follows the CNCF Code of Conduct. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a Weaveworks project maintainer, or Alexis Richardson (alexis@weave.works).

Your feedback is always welcome!

About

A client library for sending usage data to the billing system.

License:Apache License 2.0


Languages

Language:Go 100.0%