-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go Agent 3.0 #106
Comments
Generally in favor -- seems like a good idea. Obviously transitioning over a major version bump like this can be slow/painful (I work in an enterprise setting with a too-long release cycle and various maintenance needs). But the overall approach is cleaner and clear. Specifically from the context of #74 ... will the new Application config have a method to validate the license key? I'm cool with a functional approach to configuration; can we tack on validation? |
Hi @cjcjameson Thanks for the feedback!
Without waiting for a connect (which is done async in a goroutine), the only license key validation that can be done is checking the length (40 characters). Is that worth it? What would you like that API to look like? |
ah, I see. No sweat if not. |
Having |
Since we're discussing breaking changes, I'd like to propose removing the As these errors exist only within the go-agent workflow, I'm never going to let these errors prevent the rest of my code (my business-logic) from executing. So either I:
None of the docs show checking for these errors and if I have already configured the go-agent to log, then why not simply let the agent log these errors instead of returning them? |
Another proposed change for v3.0 that we would love everyone's feedback on. We would like to propose changing the names of transactions created by Breaking transactions out by method increases the granularity of transaction data. Routes that used to roll up into a single transaction name would now be more properly split. This would allow you to better monitor your routes. In this Gorilla example, these two routes would previously be rolled up under the transaction name r := mux.NewRouter()
r.HandleFunc("/hello", handlerGET).Methods("GET")
r.HandleFunc("/hello", handlerPOST).Methods("POST")
http.Handle("/", r) Unfortunately however, changing transaction names comes at a cost. It would mean that you could not directly compare timing information on the transactions between the v2 and v3 agents. You may have to change your alerting or custom dashboards to match. This is why we are eager to hear your thoughts as we want the next version of the Go Agent to be the best it can be! |
Hi All These changes are released as beta in the The godocs for this 3.0 API are located here! https://godoc.org/github.com/newrelic/go-agent/v3/newrelic This 3.0 work will be officially released in the next release, which will be tagged with |
Hi and thank you for the new release! Here is our feedback as of the The migration processOverall I found the migration checklist really easy to follow - the before/after examples really helped. Some things I spotted:
Config from environment variablesThis is a great new addition - saves us having to add env-handling boilerplate to each app :-)
Changes to distributed tracing methodsIn the v3 release, For non-HTTP use-cases (such as passing a trace ID via command line to another process, or for an event being added to a queue for consumption by a worker on another instance) it feels a bit strange to be having to create an http headers object for this. This can be seen in one of the examples: go-agent/v3/examples/custom-instrumentation/main.go Lines 29 to 33 in 85c56f3
Are there any further changes that could be made to make the API feel more natural in these use-cases? Misc
|
Hi @edmorley! Thank you for this feedback! We really appreciate it! You're the best!!
Oops! Good catch! This will be fixed.
We did not know about the SHA version form. Good to know! Hopefully, we do not have more beta releases, but if so, we will look into this!
Oops! Good catch! This will be fixed.
I'm glad ConfigFromEnvironment is useful! We will ensure it is better emphasized in the migration guide.
This sounds useful. We will improve the RecordPanics documentation.
Yikes! Typos will be fixed!
Sure, we will add them!
Great question. We aren't sure: Populating
We apologize for the naming confusion. We lament these differences. Changing and deprecating names across agents is a hurdle, but we will look into it!
Good catch. We will fix this! Thanks again for all your thoughts @edmorley!! |
Thank you for your fast reply!
A few ideas:
That said, perhaps just silently ignoring is the simplest option!
Ah I didn't realise that. In which case it makes sense. I love the idea of supporting open standards - so happy to have a slight compromise in API in return :-)
Would it be possible to make it opt in?
Amazing, thank you :-) |
Hi @edmorley We just released another version of the 3.0 beta with some changes you might like 😄 https://github.com/newrelic/go-agent/blob/master/CHANGELOG.md#2162 We highly value your feedback! Please keep it coming! |
Awesome, thank you! I've pulled it locally, will try it out tomorrow :-) |
With the latest version of the agent I get a go-agent/v3/newrelic/config.go Lines 408 to 412 in 620eeca
|
That is indeed a bug. We will get that fixed asap and issue another patch release. Thanks for catching it @edmorley !! |
One other thing I spotted was that whilst eg: go-agent/v3/examples/server/main.go Lines 29 to 31 in 85c56f3
go-agent/v3/examples/server/main.go Lines 67 to 69 in 85c56f3
go-agent/v3/integrations/nrecho-v3/example/main.go Lines 16 to 18 in 85c56f3
go-agent/v3/integrations/nrecho-v4/example/main.go Lines 16 to 18 in 85c56f3
go-agent/v3/integrations/nrgin/example/main.go Lines 48 to 50 in 85c56f3
|
Hi All Version 3.0.0 has been released! Thanks for all your help @edmorley. You will be pleased to see that Heroku dyno support is included! |
UPDATE
These changes are released as beta in the v3 directory of the new release! Please take a look and give it a try!
https://godoc.org/github.com/newrelic/go-agent/v3/newrelic
This 3.0 work will be officially released in the next release, which will be tagged with
v3.0.0
and tags for each of the integrations such asv3/integrations/nrecho-v3/v1.0.0
.Go Agent 3.0 Ideas
Hi All!
We are considering a major version release with breaking changes to improve the Go Agent API.
We would like to reduce minor points of irration.
We want to balance improvement with avoiding upgrade friction.
Here are the changes we propose. We would love your feedback!
Note that we will not be maintaining old agent versions after this major version has been released.
Complete List of Proposed Changes
Changes That Definitely Affect You
The
newrelic
package moves from"github.com/newrelic/go-agent"
to"github.com/newrelic/go-agent/v3/newrelic"
.The underscore in the
_integrations
directory is removed. Thus the"github.com/newrelic/go-agent/_integrations/nrgin/v1"
import path becomes"github.com/newrelic/go-agent/v3/integrations/nrgin"
.Go module files will be added. Each integration will be in its own module. Our first release will have git tags like this:
v3.0.0.0
for the basenewrelic
package.v3/integrations/nrgin/v1.0.0
for the integration which supports the Gin frameworkv3/integrations/nrecho-v3/v1.0.0
for the integration which supports version 3 of the Echo frameworkv3/integrations/nrecho-v4/v1.0.0
for the integration which supports version 4 of the Echo frameworkApplication and Transaction change from interfaces to structs. All methods on these types will have pointer receiver. References to these types in your code will need a pointer added.
NewConfig is removed and the NewApplication signature changes to:
New functions are provided to modify the Config. Here's what your
Application creation will look like:
Changes That Affect You If You Call StartTransaction
The following changes will affect you are starting transactions manually. You will not be affected if you are using on the framework integration packages or rely on WrapHandle or WrapHandleFunc.
Application.StartTransaction signature changes to:
Transaction no longer implements http.ResponseWriter.
Transaction.SetWebResponse signature changes to:
The WebRequest type changes from an interface to a struct
and Transaction will have two methods for adding request information:
Other Misc Changes
The transaction parameter to NewRoundTripper is removed. The function signature becomes:
TransportType type is changed from a struct to a string.
Turn DistributedTracePayload from and interface into a struct.
Attributes are renamed:
"httpResponseCode"
becomes"response.status"
The
Config.TransactionTracer.SegmentThreshold
field moves toConfig.TransactionTracer.Segments.Threshold
and theConfig.TransactionTracer.StackTraceThreshold
field moves toConfig.TransactionTracer.Segments.StackTraceThreshold
.The payload parameter to Transaction.AcceptDistributedTracePayload changes to a string. The signature becomes:
Discussion
Change Directory Layout and Import Paths
Problems:
newrelic
package name doesn't match the"github.com/newrelic/go-agent"
import path directory. Tools don't like this.Solution: We propose moving the
newrelic
package into anewrelic/
directory and removing the underscore from the_integrations/
directory.newrelic
package import path becomes"github.com/newrelic/go-agent/v3/newrelic"
.nrhttprouter
package import path becomes"github.com/newrelic/go-agent/v3/integrations/nrhttprouter"
.Change Application and Transaction Types
Problem: The Application and Transaction types are interfaces. This causes pain:
Consumers need nil checks throughout their code.
Consumers who have created
mockApplication
andmockTransaction
types for testing or debugging situations need to update them every time we add new methods. Technically, we have been breaking the semantic versioning rules by adding methods without incrementing the major version number.We can't provide use godoc links to specific application and transaction methods.
Solution: We propose changing Application and Transaction into structs with pointer method receivers. Consumers wouldn't need nil checks in their code or need to create their own mocks. This would be a big change for consumers using lots of transaction and application parameters. Functions that look like this:
Should be changed to look like this:
But what if consumers don't remember to add the
*
in all locations? We don't want consumers to copy a struct containing a mutex and non-pointer fields. We think we can avoid this problem using another level of indirection:With this design, everything will work fine if consumers copy the Transaction value. Not only would the pointers to the Transaction be made nil-safe, but the pointers to the
*internalTxn
would be made nil-safe too:We will change transaction and application methods and functions to use pointers. For example, the transaction context functions will now look like this:
These changes are not strictly necessary given the extra level of indirection, but the lack of pointer might be a source of confusion since Go programmers don't expect stateful structs to be copied by value.
http.ResponseWriter and StartTransaction Changes
Changing Transaction into a struct will necessitate other changes.
Currently, the transaction implements "optional" response writer methods (such as http.CloseNotifier) to match the input response writer (passed in to
Application.StartTransaction
orTransaction.SetWebResponse
). If the transaction becomes a struct, then its method set can't be changed. Therefore, we propose the following change: Transaction would not implement http.ResponseWriter. Instead, theSetWebResponse
method would return the replacement writer:This method will return the input parameter if the transaction is nil so that it can be used safely in all circumstances.
If the response writer parameter is removed from
StartTransaction
, we believe it makes sense to remove the request parameter too.This makes the API simpler and easier for consumers creating background transactions. Here is what the implementation of WrapHandle would look like after the proposed changes:
Fortunately, consumers using WrapHandle or an integration framework support package will be unaffected by the changes.
Change Config and Application Construction
Problem: NewConfig is clunky. Multiple lines of code are needed to set up an application, and it is possible to pass an invalid Config to NewApplication.
Solution: We propose using the functional options pattern (as done in our new telemetry sdk):
For consumers who want to use the environment variables consistent with other agents, we will provide a function like this:
The text was updated successfully, but these errors were encountered: