-
Notifications
You must be signed in to change notification settings - Fork 0
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
moves clog into clues #56
Conversation
53afe8a
to
aa9d90d
Compare
// | ||
// Unless you call this before initialization. Then it'll panic. We do want you to init | ||
// the logger first, else you'll potentially lose these logs due different buffers. | ||
func Singleton() *builder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really a fan of having something like this. If we run into the situation described, it's probably a design issue that should be addressed. I'm concerned something like this will allow more design issues to slip through because they allow kind of papering over the root problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm back and forth on it. I do agree that not providing this method makes a good forcing function to resolve cases that would sloppily use it. I'm also aware that every now and then devs will hit a corner case where this sort of accessibility makes life much less painful or arduous. I'm not in a rush to do so, but we can take it out if there are strong feelings against the design. That's a two-way-door.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be best to remove something like this until we have more insight into what other SDKs clues will be used with (e.x. this wouldn't work if we needed to use it with temporal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporal already has logging hooks built in, so there's no concerns with that. But, sure, I can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #67
} | ||
|
||
// Returns the default location for log file storage. | ||
func defaultLogLocation() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting the default location and using a global env var to set the location seem problematic. Now two programs that consume this package can't run on the same machine with the defaults, and it's not clear what could happen if people do run with the defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Can we put a pin in this and follow up later? Current presumption is that live runs will feed to Stderr
by default, not to log files, and that some background receiver will handle serialization of stderr logs to storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still rather uncomfortable with the assumptions being made about setup of the logging component. This is technically an open-source library and I'm sure we'd like to see usage in our own systems going forward. However, the logging setup has hidden configurations that will lead to difficult to debug issues if not noticed while also making some pretty heavy assumptions about usage in general (e.x. assume sent to stderr which isn't really the standard when it comes to outputting log files AFAIK)
If the goal is adoption and usage then, given that this is basically a core feature that everything is going to rely on, the implementation should be robust enough that folks can easily do what they need and are unlikely to hit unexpected issues (this kind of gets back to "how soon is later"?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no disagreement with your assesment. But is it really a blocker to punt on the issue for this PR? The code already matches this in the existing clog repo, so we're not avoiding the issue at this moment. And I will follow up on it. But this PR is supposed to be a copy-paste, not a fixup of the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #68
|
||
for _, tt := range table { | ||
suite.T().Run(tt.name, func(t *testing.T) { | ||
assert.Equal(t, tt.expected, getValue(tt.value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually sure if this will just end up testing the interface
test case a bunch of time since that's the type in the struct or if it will be testing the underlying types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we test both casses with this spread. I'll add some other cases for coverage, just to have that clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we're on slightly different trains of thought here? My concern is whether declaring the test table struct to have value any
for the input will result in always testing the interface segment of the code under test since technically any
is an alias to interface{}
. If that is the way the code behaves, then adding additional test cases to this test won't change anything
I think to figure out how this is actually run, you'd need to add temporary print statements to the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to figure out how this is actually run, you'd need to add temporary print statements to the code
Heh, no, I grok. And that's exactly what I did. All the other changes were because I figured I was already in the code and wanted to touch things up a bit.
Overall, I think we need to be careful about scope creep. It's nice to have one thing that does everything and the kitchen sink, but the thing needs to work really well for that to really be a good situation. The larger the scope, the more likely it is for some areas or others to not be as high quality as we'd like With a package like this, there's also the chance that we end up hooking together things in such a way that we're getting too much data back. Having too much data can be just as crippling as not having enough. If we really want to add metrics, we need to be very careful about doing so |
Ah, metrics is intended to be a sort of isolated sub-package. I don't plan on a coupled implementatio with clues or clog as it stands. Expectation is for it to be loosely coupled in the way those two packages are. The primary connection being that the metrics subpackage would extract otel information from a clues context, the same way clog does in the next PR on this branch. Otherwise the goal is for it to feel separate and optional. |
e01b3d8
to
09d5882
Compare
Transferring Clog into Clues as a subpackage will solve: 1. multi-package updates (clues -> clog -> something with both clog and clues) 2. better preparation for OTEL support integration into clues and clog. 3. sets up future extensions like metrics tracking via clues.
09d5882
to
92bca4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally LGTM, unresolved comments still need addressed though
return b | ||
} | ||
|
||
// Label adds all of the appended labels to the error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Label adds all of the appended labels to the error. | |
// Label adds all of the appended labels to the log. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in another PR
|
||
for _, tt := range table { | ||
suite.T().Run(tt.name, func(t *testing.T) { | ||
assert.Equal(t, tt.expected, getValue(tt.value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we're on slightly different trains of thought here? My concern is whether declaring the test table struct to have value any
for the input will result in always testing the interface segment of the code under test since technically any
is an alias to interface{}
. If that is the way the code behaves, then adding additional test cases to this test won't change anything
I think to figure out how this is actually run, you'd need to add temporary print statements to the code
Transferring Clog into Clues as a subpackage will solve: