Files
hatchet/pkg/client/context.go
Gabe Ruttner 6419ad33dc Feat--consistent-analytics-events (#3239)
* chore: log when enqueue errors

* feat: standardize and improve actor model

* feat: track entire surface

* chore: remove heartbeats

* cleanup

* fix: merge

* chore: cleanup and AI

* fix: getter

* chore: feedback

* flush mu

* feat: source attribute

* feat: cli source

* fix: webhook

* feat: add server url
2026-03-12 12:02:36 -07:00

33 lines
807 B
Go

// Deprecated: This package is part of the legacy v0 workflow definition system.
// Use the new Go SDK at github.com/hatchet-dev/hatchet/sdks/go instead. Migration guide: https://docs.hatchet.run/home/migration-guide-go
package client
import (
grpcMetadata "google.golang.org/grpc/metadata"
"context"
)
type contextLoader struct {
Token string
extraMD map[string]string
}
func newContextLoader(token string, extraMD map[string]string) *contextLoader {
return &contextLoader{
Token: token,
extraMD: extraMD,
}
}
func (c *contextLoader) newContext(ctx context.Context) context.Context {
pairs := map[string]string{
"authorization": "Bearer " + c.Token,
}
for k, v := range c.extraMD {
pairs[k] = v
}
md := grpcMetadata.New(pairs)
return grpcMetadata.NewOutgoingContext(ctx, md)
}