You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the next agent release, we are considering a new Transaction method called SetWebRequest. This method allow consumers to provide request information without having an *http.Request, or without having the request at the beginning of the Transaction. We're thinking it could look something like this:
typeTransactioninterface {
// ... other methods// SetWebRequest adds request attributes and marks the transaction as a// web transaction.SetWebRequest(Request) error
}
// Request provides request information to Transaction.SetWebRequest.typeRequestinterface {
Header() http.HeaderURL() *url.URLMethod() stringTransport() TransportType
}
What do you think?
It would be nice to allow consumers to provide a *http.Request to SetWebRequest. Possible ways of making this happen:
We could change the Transaction.SetWebRequest parameter to an interface{} (which could be either a Request or a *http.Request). Unfortunately, this would lose strong type safety.
We could have a func NewRequest(*http.Request) Request helper function do the necessary transformation. This would look something like this:
txn.SetWebRequest(newrelic.NewRequest(req))
What would be a better name for the NewRequest helper?
Or we could have two Transaction methods: one which takes a Request and another which takes a *http.Request.
We could change the Transaction.SetWebRequest parameter to an *http.Request, and ask consumers to convert their requests into *http.Request format. Is it easier to convert into a *http.Request, or to satisfy the Request interface? The Request interface makes it explicit which fields we will access, which is nice.
Hi All,
For the next agent release, we are considering a new Transaction method called
SetWebRequest
. This method allow consumers to provide request information without having an*http.Request
, or without having the request at the beginning of the Transaction. We're thinking it could look something like this:What do you think?
It would be nice to allow consumers to provide a
*http.Request
toSetWebRequest
. Possible ways of making this happen:We could change the
Transaction.SetWebRequest
parameter to aninterface{}
(which could be either aRequest
or a*http.Request
). Unfortunately, this would lose strong type safety.We could have a
func NewRequest(*http.Request) Request
helper function do the necessary transformation. This would look something like this:What would be a better name for the
NewRequest
helper?Or we could have two Transaction methods: one which takes a
Request
and another which takes a*http.Request
.We could change the
Transaction.SetWebRequest
parameter to an*http.Request
, and ask consumers to convert their requests into*http.Request
format. Is it easier to convert into a*http.Request
, or to satisfy theRequest
interface? TheRequest
interface makes it explicit which fields we will access, which is nice.This will satisfy: #19
The text was updated successfully, but these errors were encountered: