-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Clarify and rename IsRecordingEvents
and WithRecordEvents
#186
Comments
To me, the most salient piece of information here is "Is this a Real span" vs "Is this a no-op span". I don't like the use of "Recording" to convey this information. |
Heh. Up until now I was under the impression presented by @iredelmeier (although had nagging suspicions I was wrong, but haven't had a chance to dig in). If these are really meant to indicate if these spans will get exported or not and that is determined by the spans being "real" vs. "no-op", then Go already has a means of doing this via the type system (possibly via a helper function). If that's not the case, what else am I missing? |
My understanding is that the initial goal of It feels like the "recording" functionality has morphed a certain amount since then, and I'm not sure how much of the evolution has been intentional vs accidental. Thoughts on removing this functionality for now? (Happy to move to a spec issue or RFC depending on the answers here!) |
I think this deserves a spec issue. I still believe "IsNoopSpan()" tells us exactly what we need--the intention is to have a way of eliding expensive computation intended for diagnostics that are going nowhere. |
@jmacd |
Thanks for clarifying. So, it means what I thought it meant. |
@jmacd Does that mean a change to the name then or something else? |
I don't know. I agree with @bogdandrutu that we want a positive method, not a negative, and in code we're likely to see
I might suggest "IsReal()". I don't feel strongly here. |
And if the example is like the one above, I'd prefer to have lazy value support.
|
+1. Lazy evaluation via a function seems like a much better way to deal with the problem of real/noop spans than littering code with span.SetAttribute(key.Lazy(func() (core.Value, error) {
// some expensive calculation
return core.NewIntValue(12), nil }),
) I also feel that returning an error, as a way to ignore the core.Value, is appropriate. |
Related PR w/ proof-of-concept for lazy and structured values: |
I don't know how it is in Go but in some languages the code above will generate an unnecessary extra allocation. Or if users are concerned about holding too much memory they also may prefer the Also to clarify a bit |
I'm not very concerned about this, but if there's a user who is very concerned about memory allocation, I still wouldn't use the "is recording" test. I'd use something like the
where value implements
or similar. Then there's no allocation and lazy evaluation. |
closing stale issues. |
#186) * Bump github.com/golangci/golangci-lint from 1.29.0 to 1.30.0 in /tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.29.0 to 1.30.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.29.0...v1.30.0) Signed-off-by: dependabot[bot] <support@github.com> * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
The emphasis on "events" in
IsRecordingEvents
andWithRecordEvents
suggests that the methods pertain specifically to events in the sense of logs/what gets added with these methods, when these are really more about whether the span will get exported.The
WithRecordEvents
docs also suggest that the default forIsRecordingEvents
is false, when in reality it's up to the implementation.The text was updated successfully, but these errors were encountered: