ali_jiankong

package module
v0.0.0-...-468a63b Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2015 License: Apache-2.0 Imports: 7 Imported by: 1

README

ali_jiankong

Usage
package main

import (
	"fmt"

	"github.com/gogap/ali_jiankong"
)

func main() {

	cli := ali_jiankong.NewAliJianKong("191000000000000", ali_jiankong.REPORT_TIMEOUT)

	reportItem := ali_jiankong.ReportItem{
		MetricName:  "test2",
		MetricValue: "1",
		Dimensions:  ali_jiankong.Dimensions{"aaaa": "1", "bbbb": "2", "cccc": "3", "dddd": "4", "eeee": "5"},
	}

	e := cli.Report(reportItem)
	fmt.Println(e)

}

Documentation

Index

Constants

View Source
const (
	REPORT_TIMEOUT time.Duration = 3 * time.Second

	ALI_JIANKONG_NAMESPACE = "acs/custom/"
	ALI_JIANKONG_URL       = "http://open.cms.aliyun.com/metrics/put"
)
View Source
const (
	ALI_JIANKONG_ERROR_NS = "ALI_JIANKONG"
)

Variables

View Source
var (
	ERR_SEND_JIANKONG_REPORT_FAILED    = errors.TN(ALI_JIANKONG_ERROR_NS, 1, "code: {{.code}}, content: {{.content}}")
	ERR_REQUEST_JIANKONG_SERVER_FAILED = errors.TN(ALI_JIANKONG_ERROR_NS, 2, "error: {{.err}}")
)

Functions

This section is empty.

Types

type AliJianKong

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

func NewAliJianKong

func NewAliJianKong(uid string, timeout time.Duration) *AliJianKong

func (*AliJianKong) Report

func (p *AliJianKong) Report(items ...ReportItem) (err error)

func (*AliJianKong) SetTimeout

func (p *AliJianKong) SetTimeout(timeout time.Duration) *AliJianKong

type Dimensions

type Dimensions map[string]string

type ReportItem

type ReportItem struct {
	MetricName      string     `json:"metricName"`
	MetricValue     string     `json:"value"`
	Dimensions      Dimensions `json:"dimensions"`
	DimensionsOrder []string   `json:"-"`
	Unit            string     `json:"unit"`
	Timestamp       string     `json:"timestamp"`
}

func (*ReportItem) Serialize

func (p *ReportItem) Serialize() string

Jump to

Keyboard shortcuts

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