-
Notifications
You must be signed in to change notification settings - Fork 4
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
cache analyzer sources #401
Conversation
cmd/analyzer/analyzer.go
Outdated
target storage.TargetStorage | ||
logger *log.Logger | ||
} | ||
|
||
type AllSources struct { |
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.
AbstractServiceClientFactoryAggregator here we come
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.
yeah... I was also considering SourceFactory
but it's not quite satisfactory either
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.
Thank you!
I have only one important comment, it's about closing resources.
cmd/analyzer/analyzer.go
Outdated
sdkPT := cfg.Source.SDKParaTime(common.RuntimeEmerald) | ||
sourceClient, err1 := sources.Runtime(ctx, common.RuntimeEmerald) | ||
if err1 != nil { | ||
return nil, err1 | ||
} |
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 a little unhappy about the code duplication here, but I don't have great suggestions.
Refloating a recent idea: If RuntimeClient
used lazy initialization, we could inline sources.Runtime
and not worry about errors. It would also make it so the query_on_cache_miss
flag is not needed.
Definitely not something we'd do in this PR, and likely ever, just from the effort/benefits ratio. But a man can dream.
d6a7fd4
to
8bd1aaa
Compare
tweaking var names linter do not close source in analyzers; rename vars; update comments
8bd1aaa
to
4b75ba3
Compare
We currently pass the source config to each analyzer, and then the analyzer instantiates its own source. That's bad for two reasons:
Tasks:
todo: choose better var names