Skip to content

Commit

Permalink
change context structure
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidlazio committed May 30, 2024
1 parent a2047c9 commit 4be06a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/confidence/confidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ func (e Confidence) PutContext(key string, value interface{}) {
e.contextMap[key] = value
}

func (e Confidence) Track(ctx context.Context, eventName string, message map[string]interface{}) *sync.WaitGroup {
newMap := e.GetContext()
func (e Confidence) Track(ctx context.Context, eventName string, data map[string]interface{}) *sync.WaitGroup {
newMap := make(map[string]interface{})
newMap["context"] = e.GetContext()

for key, value := range message {
for key, value := range data {
if key == "context" {
panic("invalid key \"context\" inside the data")
}
newMap[key] = value
}

Expand Down

0 comments on commit 4be06a7

Please sign in to comment.