go-agent
go-agent copied to clipboard
newrelic.Transaction private field Name does not have a Get method. Only Set.
Description
In newrelic.Transaction
defined here:
https://github.com/newrelic/go-agent/blob/master/v3/newrelic/transaction.go#L21
Has a private field Name which does not have a Get method. Only Set.
Segment defined here: https://github.com/newrelic/go-agent/blob/master/v3/newrelic/segments.go#L20 Does export the Name as public field.
Steps to Reproduce
Trying to get the field name
from transaction is not possible.
Expected Behavior
Getting the field name
from transaction should be possible.
NR Diag results
N/A
Your Environment
N/A
Reproduction case
N/A
Additional context
If there is another way to create/manage transactions which allows for access to name defined in StartTransaction(name) please do let me know if an alternative way is available.
This touches on some fundamental design choices that are part of the agent's implementation. Changing them would need to carefully consider the implications to the operation of the agent code. In light of that, could we get more of an understanding of what you need to accomplish so we can be sure before proposing or agreeing to this sort of change that it would actually be the best path to where you want to go?
One issue is that the transaction name may change over its lifetime, so if you queried it at some point, it might not remain with that name by the time it's done. There are potentially other issues as well which may affect the agent's performance.
Your point of changing over time only emphasis more the lack of a Get method more. If it changes overtime, we should be able the value of the field.
In my opinion, doesn't make sense to have a private field with a Set method, without a Get method. Having writing access without reading access seems off/wrong. I can't think of a scenario where I would want to be able to Set a field without being able to access it with a Get.
I also fail to understand how having a Get method would affect performance in any way, can you elaborate?
It can be worked around by creating a new wrapper struct which includes the Name field accessible with Get/Set or public field. This however, seems like it should be a basic/standard feature, and I think it was an oversight of the implementation/development. The name of the transaction was defined by the client, and includes a Set to be changeable, why not include a Get as well?
Hello, any update on this issue? Are you guys considering working on this? Or is this issue being discarded?
Yes, we still have this as an issue to work on.