context.go 628 B

1234567891011121314151617
  1. package internal
  2. type contextKeyType struct{}
  3. var (
  4. // TransactionContextKey is the key used for newrelic.FromContext and
  5. // newrelic.NewContext.
  6. TransactionContextKey = contextKeyType(struct{}{})
  7. // GinTransactionContextKey is used as the context key in
  8. // nrgin.Middleware and nrgin.Transaction. Unfortunately, Gin requires
  9. // a string context key. We use two different context keys (and check
  10. // both in nrgin.Transaction and newrelic.FromContext) rather than use a
  11. // single string key because context.WithValue will fail golint if used
  12. // with a string key.
  13. GinTransactionContextKey = "newRelicTransaction"
  14. )