Renamed TagMap() -> Tags(), MetaMap() -> Meta

This commit is contained in:
Holger Obermaier 2022-02-01 14:49:09 +01:00
parent 0e70b663ee
commit 00fdb189a4
4 changed files with 13 additions and 13 deletions

View File

@ -27,12 +27,12 @@ type CCMetric interface {
SetTime(t time.Time) SetTime(t time.Time)
MetaMap() map[string]string // Map of meta data tags Meta() map[string]string // Map of meta data tags
MetaList() []*lp.Tag // Ordered list of meta data MetaList() []*lp.Tag // Ordered list of meta data
AddMeta(key, value string) // Add a meta data tag AddMeta(key, value string) // Add a meta data tag
GetMeta(key string) (string, bool) // Get a meta data tab addressed by its key GetMeta(key string) (string, bool) // Get a meta data tab addressed by its key
TagMap() map[string]string // Map of tags Tags() map[string]string // Map of tags
AddTag(key, value string) // Add a tag AddTag(key, value string) // Add a tag
GetTag(key string) (string, bool) // Get a tag by its key GetTag(key string) (string, bool) // Get a tag by its key
RemoveTag(key string) // Remove a tag by its key RemoveTag(key string) // Remove a tag by its key
@ -42,8 +42,8 @@ type CCMetric interface {
RemoveField(key string) // Remove a field addressed by its key RemoveField(key string) // Remove a field addressed by its key
} }
// MetaMap returns the meta data tags as key-value mapping // Meta returns the meta data tags as key-value mapping
func (m *ccMetric) MetaMap() map[string]string { func (m *ccMetric) Meta() map[string]string {
return m.meta return m.meta
} }
@ -68,8 +68,8 @@ func (m *ccMetric) Name() string {
return m.name return m.name
} }
// TagMap returns the the list of tags as key-value-mapping // Tags returns the the list of tags as key-value-mapping
func (m *ccMetric) TagMap() map[string]string { func (m *ccMetric) Tags() map[string]string {
return m.tags return m.tags
} }
@ -248,10 +248,10 @@ func FromMetric(other ccMetric) CCMetric {
tm: other.Time(), tm: other.Time(),
} }
for key, value := range other.TagMap() { for key, value := range other.Tags() {
m.tags[key] = value m.tags[key] = value
} }
for key, value := range other.MetaMap() { for key, value := range other.Meta() {
m.meta[key] = value m.meta[key] = value
} }

View File

@ -141,10 +141,10 @@ func (r *metricRouter) EvalCondition(cond string, point lp.CCMetric) (bool, erro
// Add metric name, tags, meta data, fields and timestamp to the parameter list // Add metric name, tags, meta data, fields and timestamp to the parameter list
params := make(map[string]interface{}) params := make(map[string]interface{})
params["name"] = point.Name() params["name"] = point.Name()
for key, value := range point.TagMap() { for key, value := range point.Tags() {
params[key] = value params[key] = value
} }
for key, value := range point.MetaMap() { for key, value := range point.Meta() {
params[key] = value params[key] = value
} }
for _, f := range point.FieldList() { for _, f := range point.FieldList() {

View File

@ -30,7 +30,7 @@ func (s *GangliaSink) Write(point lp.CCMetric) error {
var err error = nil var err error = nil
var tagsstr []string var tagsstr []string
var argstr []string var argstr []string
for key, value := range point.TagMap() { for key, value := range point.Tags() {
switch key { switch key {
case "cluster": case "cluster":
argstr = append(argstr, fmt.Sprintf("--cluster=%s", value)) argstr = append(argstr, fmt.Sprintf("--cluster=%s", value))

View File

@ -62,11 +62,11 @@ func (s *InfluxSink) Init(config sinkConfig) error {
func (s *InfluxSink) Write(point lp.CCMetric) error { func (s *InfluxSink) Write(point lp.CCMetric) error {
tags := map[string]string{} tags := map[string]string{}
fields := map[string]interface{}{} fields := map[string]interface{}{}
for key, value := range point.TagMap() { for key, value := range point.Tags() {
tags[key] = value tags[key] = value
} }
if s.meta_as_tags { if s.meta_as_tags {
for key, value := range point.MetaMap() { for key, value := range point.Meta() {
tags[key] = value tags[key] = value
} }
} }