-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support global and per endpoint / backend static attributes in all layers #20
Conversation
9116c1f
to
a7e6a88
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.
I took your PR as base and put it into this other branch: #27 .
I would like to make a PR to your branch, so you could review it, and then merge this PR. But since I merged your PR in the main repo (I guess I made a little mess), I don't know how to do it. So, would you mind reviewing that one ?
Luckily it maintains you as an author of the commits (I did not want to take credit for your work, just tried to test it in existing code bases)
Another way would be ... to .. merge that branch into yours ?
Sorry for the mess.
And thank you very much for your contribution.
EndpointPipeOpts(cfg *luraconfig.EndpointConfig) config.PipeOpts | ||
EndpointBackendOpts(cfg *luraconfig.Backend) config.BackendOpts |
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.
the change of the signature from *config.PipeOpts
to config.PipeOpts
is a breaking backwards compat change, and should be avoided.
} | ||
|
||
func mergedBackendOpts(s *StateConfig, cfg *luraconfig.Backend) config.BackendOpts { | ||
BackendOpts := *s.cfgData.Layers.Backend |
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 would say variables should not start with a capital character.
return mergedBackendOpts(s, cfg) | ||
} | ||
|
||
func mergedBackendOpts(s *StateConfig, cfg *luraconfig.Backend) config.BackendOpts { |
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 would say this function could be a "member" of s , and be:
func (s *StateConfig) mergedBackendOpts(cfg *luraconfig.Backend) *config.BackendOpts {
|
||
// LuraExtraCfg extracts the extra config field for the namespace if | ||
// provided | ||
func LuraExtraCfg(extraCfg luraconfig.ExtraConfig) (*ConfigData, 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.
this makes the code more readable ! 👍
go build -o srv ./server | ||
.PHONY: build | ||
.PHONY: srv |
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, we can remove the .PHONY
line if we actually generate a file with the target name.
@dhontecillas thanks for the comments. I reviewed the other PR you created, all looks good to me.
Don't worry about that :), I don't really mind which PR gets merged and given that your PR addresses all the comments already, feel free to continue with that one. |
Description
This PR adds support for:
global
andproxy
layersUse Case
The main idea is to provide allow for better grouping when creating dashboards with the metrics.
Approach
Two new fields were added to the
global
andproxy
layersmetrics_static_attributes
traces_static_attributes
The reason for this option was that the configuration on these two layers was already flat (as opposed to the
backend
layer which has ametrics
andtraces
section) , hence this keeps the convention already set. Also, changing to something like thebackend
layer could lead to some breaking changes.NOTE: I don't have strong opinions on this format and I'm willing to adapt the PR to your preferred way to pass the configuration
Also, configuration provided in an endpoint of backend section will now be parsed to get static labels which will be merged with any other label provided at the top level of the configuration. All other configuration parameters provided will be ignored.