Граф коммитов

45 Коммитов

Автор SHA1 Сообщение Дата
Andrew Mason baf2600ceb
[trace] Migrate `go/trace` to use `pflag` for flag definitions (#11028)
* 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>
2022-08-17 13:40:04 -07:00
Vicent Marti 8de235531d all: gofmt -w -r 'interface{} -> any' src
Signed-off-by: Vicent Marti <vmg@strn.cat>
2022-03-22 09:39:55 +01:00
Andrew Mason a7f7676921
[VEP4, phase1] fix flags in tests in `endtoend/worker` and strings in `go/trace` (#9931)
* [endtoend/worker] fix flags in tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* [trace] fix flags in log messages

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-21 16:46:03 -04:00
Vicent Marti 6751ed1fb6 sqlparser: move MySQLServerVersion to servenv
Signed-off-by: Vicent Marti <vmg@strn.cat>
2021-11-24 11:03:39 +01:00
Andrew Mason 43c1fbb59f [trace] Add support for turning on logging in tracing plugins with the standard logging infrastructure
Signed-off-by: Andrew Mason <amason@slack-corp.com>
2021-06-07 19:11:38 -04:00
Andrew Mason 29e9556747 [trace] Add optional flags to support flexible jaeger configs
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>
2021-05-27 21:53:26 -04:00
Aditya Sharma 47611bca39 goimports -local vitess.io/vitess -w .
Signed-off-by: Aditya Sharma <git@adi.run>
2021-01-04 18:27:04 -05:00
Aditya Sharma c9b6d608f7 run go fix ./...
Signed-off-by: Aditya Sharma <git@adi.run>
2021-01-01 13:29:32 -05:00
Andres Taylor 9cb268a8b8 change how tracing query comments are handled
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-07-22 08:31:02 +02:00
ZouYu 97e61db9d7 Fix go-lint warning: package comment should be of the form 'Package trace ...'
Signed-off-by: ZouYu <zouy.fnst@cn.fujitsu.com>
2020-06-12 10:53:54 +08:00
Andres Taylor 5f54728738 Remove noisy log line
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-05-20 15:27:10 +02:00
Karel Alfonso Sague 245508242d Add datadog plugin for tracing
Signed-off-by: Karel Alfonso Sague <kalfonso@squareup.com>
2020-01-10 14:04:05 +11:00
yuxiaobo 03e83d6c30 add license in /go file
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-10-21 22:30:02 +08:00
Sugu Sougoumarane 477d8d47db
Merge pull request #5259 from systay/tiny-refactoring
Make StatementType a type alias instead of an int
2019-10-05 07:36:43 -07:00
Andres Taylor f0cfd16670 Make StatementType a type alias instead of an int
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-10-02 06:17:29 +02:00
Andres Taylor 978108243a Use standard opentracing TextMap instead of custom backend code
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-09-16 06:01:43 +02:00
Andres Taylor 9db6df7057 Use interfaces instead of functions
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>
2019-09-10 07:41:07 +02:00
Andres Taylor fd131c8540 Made span context extraction testable and added tests
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-08-21 13:26:31 +02:00
Andres Taylor 930f6faa35 Add functionality to extract spans from strings
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-08-21 13:26:31 +02:00
Andres Taylor 8d174a8101 Minor clean ups
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-08-21 13:26:31 +02:00
Andres Taylor b845c016ee Make it possible to serialize span contexts over strings
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-08-21 13:26:31 +02:00
Andres Taylor a835bb0882 Made it clear how to remove Jaeger
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-04-26 08:22:50 +02:00
Andres Taylor 98d0428d51 Clean up of tracing
* 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>
2019-04-25 15:22:14 +02:00
Andres Taylor 60b4643725 Fix problems with start of tracing
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>
2019-04-25 07:10:57 +02:00
Andres Taylor 2453911d69 Changing tracing configuration
* 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>
2019-04-23 16:35:57 +02:00
Andres Taylor d507fef7b9 Removing trace.NewClientSpan
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>
2019-04-12 17:23:45 +02:00
Andres Taylor 459756c74d Fixups after peer review
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-04-12 11:04:53 +02:00
Andres Taylor 6dcdcb4607 Change how SQL queries are added to trace spans
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-04-02 11:58:54 +02:00
Gerald Kaszuba bba4c75a25 Jaegar command line options.
Signed-off-by: Gerald Kaszuba <gak@gak0.com>
2019-04-01 19:30:47 +11:00
Andres Taylor cdea8585f9 Move out start of tracing to plugin files
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-29 09:08:59 +01:00
Andres Taylor 96a1e3109f Hide OpenTracing better
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-28 15:20:03 +01:00
Andres Taylor ec483e45d3 Move tracing grpc code to the trace package
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:18 +01:00
Andres Taylor f0934d0e71 Remove span type since it was not being used much
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:18 +01:00
Andres Taylor 487135e5f8 Document an interface
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:18 +01:00
Andres Taylor 2b52464112 gofmt code
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:18 +01:00
Andres Taylor c9dcd5a65b Improved how to register new tracing backends
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:18 +01:00
Andres Taylor 2b4fc22d2e Mark client calls to servers as such
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:17 +01:00
Andres Taylor 4c4bf8d884 Start tracing when starting processes
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:17 +01:00
Andres Taylor 4392122102 Change the internal tracing API
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>
2019-03-27 16:51:17 +01:00
Andres Taylor b4cd56f9f4 Adds Jaeger as a tracing implementation
Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-03-27 16:51:17 +01:00
Sugu Sougoumarane 7af23e1dde license: BSD->Apache v2.0
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.
2017-05-06 00:38:56 -07:00
Anthony Yeh b35847b8e1 Add trace.CopySpan to copy the span from one Context to another.
This can be used to maintain parent span relationships when starting
background tasks with a new context, in response to a request.
2015-01-05 23:22:08 -08:00
Anthony Yeh 001586999a Allow trace plugins to be registered from outside the package.
Fixes #248
2014-12-16 15:39:09 -08:00
Anthony Yeh 04f9e79bbc Rewrite imports for golang subrepositories.
As per this announcement:
https://groups.google.com/forum/m/#!msg/golang-announce/eD8dh3T9yyA/HDOEU_ZSmvAJ
2014-12-14 12:48:10 -08:00
Anthony Yeh e797fc38e3 Add adapter interface for tracing libraries. 2014-11-11 22:26:43 -08:00