* Tidy up imports
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* [flagutil] Augument OptionalFlag to implement `pflag.Value`
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Migrate go/trace to use pflag for flag definitions
Closes#10747.
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Update help
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Closes#8198.
A common pain point with the standard `package flag` is the inability to
tell whether a flag was set on the command line or not. You can check
against the default value, but that's not perfect either, because then
you cannot tell the difference between a flag that was not specified at
all and a flag that was set to exactly the default value.
Enter `OptionalFlag`. We define some structs that wrap a primitive
(`float64` for example) with a boolean flag to track whether `Set()` was
ever called on the flag. Since, for the jaeger sampler params, we only
need a `string` for the sampler type and a `float64` for the sampling
rate, I only implemented `OptionalFlag` for those two types for now.
Plus, all of this becomes obsolete if we move to `cobra`, so I wasn't
highly-motivated to implement this interface for every primitive type
(and we can also add more implementations if we need them).
Anyway. Armed with our optional flags, we can make the configuration in
`newJaegerTracerFromEnv` more sophisticated, giving flags precedence
over environment variables, but also not ignoring environment variables
(which we were previously doing by indiscriminately setting the sampler
type to `const`).
Signed-off-by: Andrew Mason <amason@slack-corp.com>
I believe this is more idiomatic golang, and it makes it
easier to work with the code base on modern IDEs.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
* Extracted the opentracing wrapper to it's own file
* Commented all the public methods
* gofmt/goimports
* Made sure the two interceptor builders are similar
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Before this change, the GRPC server could get started before tracing
had been initiated, which meant that the GRPC interceptors were not
hooked up properly.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
* Java: tracing=[off,opentracing]
* go: tracing=[off,opentracing_jaeger]
In both environments, the default is no tracing.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Since we are not really following the OT conventions for
span annotation, I'm removing this method.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
The old API had an issue with contexts not being passed
around correctly. This new API should make it easier to
remember to do it correctly.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Please refer to #2694 and #2670 for motivation and reasoning for
this change.
I've tried to follow best practice in inserting the copyright
headers. In other open source projects, not all files carry
the notice. For example documentation doesn't. I've followed
similar ground rules.
I did not change the php because there is a separate LICENSE
file there by Pixel Federation. We'll first need to notify
them our intent before changing anything there.
As for the presubmit check, it's going to be non-trivial
because of the number of exceptions, like file types,
directories and generated code. So, it will have to be
a separate project.