-
Notifications
You must be signed in to change notification settings - Fork 224
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
Abstraction for metrics and tracing #634
Abstraction for metrics and tracing #634
Conversation
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
a8412ba
to
3ce0094
Compare
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@@ -9,7 +9,7 @@ import ( | |||
) | |||
|
|||
func NewHTTPReceiveHandler(ctx context.Context, p *thttp.Protocol, fn interface{}) (*EventReceiver, error) { | |||
invoker, err := newReceiveInvoker(fn) | |||
invoker, err := newReceiveInvoker(fn, noopObservabilityService{}) |
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.
We should get ahead of this and add a observability.Get() that defaults to noopObservabilityService
here and everywhere else. We can do this as a follow up but it should happen before we cut
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.
sure, let's stabilize in a followup. There is some code in opencensus that can be eventually get removed too
// Protocol client. The http transport has had WithBinaryEncoding http | ||
// transport option applied to it. The client will always send Binary | ||
// encoding but will inspect the outbound event context and match the version. | ||
// Protocol client. | ||
// The WithTimeNow, and WithUUIDs client options are also applied to the | ||
// client, all outbound events will have a time and id set if not already | ||
// present. | ||
func NewDefault(opts ...http.Option) (Client, 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.
I wonder if we should deprecate this method and comment how to get the same result with client.NewHTTP
and then alias that to cloudevents.NewHTTPClient
Fixed integration test Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
LGTM |
The goal of this PR is to introduce an abstraction to remove from the core sdk module the dependencies over metrics and tracing. Part of #619
Content of this PR:
ObservabilityService
Breaking changes:
Users of metrics and tracing will have to modify their code to support this change. Now they won't need to use
client.NewObservable
andhttp.NewObservable
, but they'll must use the observability service and the http protocol factory from the opencensus packageDeprecated (and short-circuited functions):
Removed functions:
ObsEncode
andObsDecode
DistributedTracingExtension
which were exposing opencensus types (which were implementing the distributed tracing extension in the wrong way https://github.com/cloudevents/spec/blob/v1.0.1/extensions/distributed-tracing.md#using-the-distributed-tracing-extension)Signed-off-by: Francesco Guardiani francescoguard@gmail.com