Skip to content
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 sampling startegies file flag in OTEL collector #2195

Merged
merged 4 commits into from
Apr 28, 2020

Conversation

pavolloffay
Copy link
Member

Resolves #2154

This patch showcases how upstream OTEL components can be extended to support additional means of configuration. In this case I have added sampling.strategies-file flag to Jaeger receiver. The configuration in OTEL config has higher precedence over the configuration in Viper (like we do for other jaeger flags).

  • if the flag sampling.strategies-file is used and the sampling strategies in the OTEL config is missing it would enable it. e.g.:
go run main.go --config=/home/ploffay/tmp/otel-config.yml  --sampling.strategies-file=/home/ploffay/tmp/sampling.json
receivers:
  jaeger:
    protocols:
      grpc:  

Now let's talk about how this approach could work for other flags. Flags that don't have a default value can be supported easily. However flags with a default value e.g. --collector.http-server.host-port=:14268 are problematic. The problem is that when the default config is created we don't know whether this endpoint should be enabled or disabled as there is always a default value. When the collector is started without a configuration file it's not a problem because we enable all Jaeger endpoints. However when the collector is started with a configuration file the default value in the flag always enables the endpoint - which might be problematic if users want to disable the endpoint.

@pavolloffay pavolloffay requested a review from a team as a code owner April 24, 2020 09:12
@codecov
Copy link

codecov bot commented Apr 24, 2020

Codecov Report

Merging #2195 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2195      +/-   ##
==========================================
+ Coverage   96.16%   96.18%   +0.01%     
==========================================
  Files         219      219              
  Lines       10632    10632              
==========================================
+ Hits        10224    10226       +2     
+ Misses        352      351       -1     
+ Partials       56       55       -1     
Impacted Files Coverage Δ
plugin/sampling/strategystore/static/options.go 100.00% <100.00%> (ø)
cmd/query/app/static_handler.go 88.59% <0.00%> (+1.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66993a2...4f6fd87. Read the comment docs.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@objectiser
Copy link
Contributor

However when the collector is started with a configuration file the default value in the flag always enables the endpoint - which might be problematic if users want to disable the endpoint.

I'm assuming we are only talking about the custom Jaeger build of the OTel Collector? If so, can't we remove the default values and have them moved to the default OTel Collector config?

So then, the flags are only override values.

@@ -104,6 +107,7 @@ func main() {
// getOTELConfigFile returns name of OTEL config file.
func getOTELConfigFile() string {
f := &flag.FlagSet{}
f.SetOutput(ioutil.Discard)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can print out an error in some situations. getOTELConfigFile is a hack that parses flags before actual parsing by cobra command so it's fine to ignore it. If there is an error it is recognized once the command runs.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

PR rebased and updated

@pavolloffay pavolloffay merged commit ee30bd7 into jaegertracing:master Apr 28, 2020
@pavolloffay pavolloffay changed the title Support samling startegies file flag in OTEL collector Support sampling startegies file flag in OTEL collector May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support sampling strategies flag
2 participants