Example #1
0
// NewDeriveString parses s as an Identifier and returns a new Derive. If
// parsing s fails, it will panic. This simplifies initializing global
// variables.
func NewDeriveString(s string) *Derive {
	id, err := api.ParseIdentifier(s)
	if err != nil {
		log.Fatal(err)
	}

	return NewDerive(id)
}
Example #2
0
// NewGaugeString parses s as an Identifier and returns a new Gauge. If parsing
// s fails, it will panic. This simplifies initializing global variables.
func NewGaugeString(s string) *Gauge {
	id, err := api.ParseIdentifier(s)
	if err != nil {
		log.Fatal(err)
	}

	return NewGauge(id)
}
func ParseCollectdMetric(str string, dsname string) (Metric, error) {
	id, err := api.ParseIdentifier(str)
	m := CollectdMetric{}
	if err != nil {
		return m, err
	}
	m.Identifier = id
	m.DSName = dsname
	return m, nil
}