Skip to content

Commit

Permalink
Application Tags default values (#13)
Browse files Browse the repository at this point in the history
* Update application.go

* Update application.go

* Update application.go
  • Loading branch information
laullon authored and vikramraman committed Feb 5, 2019
1 parent 105b8c9 commit 5e0e1d7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ type Tags struct {
CustomTags map[string]string
}

// Creates a new Tags with application and service name
// New creates a new application Tags with application and service name
func New(application, service string) Tags {
return Tags{
Application: application,
Service: service,
Cluster: "none",
Shard: "none",
CustomTags: make(map[string]string, 0),
}
}
Expand All @@ -24,17 +26,12 @@ func (a Tags) Map() map[string]string {

allTags["application"] = a.Application
allTags["service"] = a.Service

if len(a.Cluster) > 0 {
allTags["cluster"] = a.Cluster
}

if len(a.Shard) > 0 {
allTags["shard"] = a.Shard
}
allTags["cluster"] = a.Cluster
allTags["shard"] = a.Shard

for k, v := range a.CustomTags {
allTags[k] = v
}

return allTags
}

0 comments on commit 5e0e1d7

Please sign in to comment.