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 b310b69
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/confidence/confidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ 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
}

fmt.Print(newMap)

var wg sync.WaitGroup
wg.Add(1)
go func() {
Expand Down

0 comments on commit b310b69

Please sign in to comment.