wlf f051014ac2 提交正常运行的所有代码 1 year ago
..
LICENSE f051014ac2 提交正常运行的所有代码 1 year ago
README.md f051014ac2 提交正常运行的所有代码 1 year ago
client.go f051014ac2 提交正常运行的所有代码 1 year ago
config.go f051014ac2 提交正常运行的所有代码 1 year ago
event.go f051014ac2 提交正常运行的所有代码 1 year ago
go.mod f051014ac2 提交正常运行的所有代码 1 year ago
go.sum f051014ac2 提交正常运行的所有代码 1 year ago

README.md

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:

Your feedback is always welcome!