1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-12 10:04:29 +02:00
Commit Graph

90 Commits

Author SHA1 Message Date
Tyler Yahn
1e36a61edf
Fix panic in gRPC UnaryServerInfo (#740)
Fixes unresolved issue identified in #691 and attempted in #697.

Adds unit test to ensure the UnaryServerInfo function does not panic
during an error returned from the handler and appropriately annotates
the span with the correct event.

Restructures the interceptor to remove this class of errors.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-05-18 18:54:38 -07:00
Tyler Yahn
55d4f7c31f
Upgrade to v0.5.0 2020-05-15 16:27:40 -07:00
Tyler Yahn
56547c988a
Merge branch 'master' into grpctest 2020-05-15 15:47:13 -07:00
Ahmed Mujtaba
f4a25cf745 Added condition for missing attr received in attr expected 2020-05-15 22:43:07 +02:00
Joshua MacDonald
587cde3352
Remove NewKey and update doc comment (#721)
* Update doc comment

* Remove NewKey

* NewKey->Key
2020-05-13 16:21:23 -07:00
Chen Yixiao
1301b6f3e4
Move core and key to kv package (#720)
* Move core to kv

* Move kv.Value to kv.value.Value

* Move key to kv
2020-05-13 16:06:03 -07:00
Ahmed Mujtaba
c40b3d47cf minor improvements in grpc interceptor test 2020-05-13 19:48:30 +02:00
Ahmed Mujtaba
cffc57c907 Added grpc stream interceptor client 2020-05-11 20:57:13 +02:00
Ahmed Mujtaba
02ff1be72c Minor fixes and improvment in GRPC urinary interceptor test 2020-05-09 15:12:32 +02:00
Ahmed Mujtaba
6bfa16ecef Added test case for grpc UrinaryInterceptorClient 2020-05-09 04:00:15 +02:00
Liz Fong-Jones
eccf13148d
Merge branch 'master' into master 2020-05-05 14:08:55 -04:00
Stefan Prisca
5414d1a142 forgot to precomit... 2020-05-05 09:13:21 +02:00
Stefan Prisca
de6c80d5d4 Merge suggested changes 2020-05-05 09:07:17 +02:00
Stefan Prisca
e1c90dca8a add explicit error handling for span data 2020-05-05 09:07:11 +02:00
Stefan Prisca
3e4da5ac77
Update plugin/grpctrace/interceptor_test.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-05-05 09:05:45 +02:00
Stefan Prisca
13c5db45a0
Update plugin/grpctrace/interceptor_test.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-05-05 08:46:01 +02:00
Stefan Prisca
6904c9e9f0
Update plugin/grpctrace/interceptor_test.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-05-05 08:45:21 +02:00
Stefan Prisca
75b4d68499 use golang table test setup 2020-05-04 10:22:31 +02:00
Stefan Prisca
4ad6e3b73f refactor tests to have single test method 2020-05-04 10:10:51 +02:00
Stefan Prisca
c8578e1512 address feedback 2020-05-02 14:50:11 +02:00
tensorchen
c6c155de6f Move SpanContext from core package into trace 2020-05-02 20:17:11 +08:00
Stefan Prisca
54f5c350a8 rename to make the tests more relevant 2020-05-01 13:53:05 +02:00
Stefan Prisca
1bd88dc455 Add tests for interceptor service attributes 2020-05-01 13:43:38 +02:00
Stefan Prisca
6ade533508 fix interceptor regexp 2020-05-01 11:12:52 +02:00
Anthony Mirabella
973b38607b
Create basic othttp.Transport for simple client instrumentation (#678)
* Create basic othttp.Transport for simple client instrumentation

* change props to propagators for clarity

* Add othttp.Transport usage example

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-29 13:17:05 -07:00
Paul Reichelt
6de3dab6b6
Resolve #72 - gRPC Interceptor (#621)
* Move interceptor to plugin

* Add basic net.peer info

* Ensure that grpc status match span status

See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-rpc.md#status

* Set rpc.service attribute

* Add StreamClientInterceptor and StreamServerInterceptor

* Fix: golint errors

* Apply automated go.mod changes from make

* Implement suggestions to improve readability
2020-04-23 13:07:14 -07:00
Krzesimir Nowak
927d9155ae
Increase the visibility of the api/key package (#650)
* Point to the convenience functions in api/key package

This is to increase the visibility of the api/key package through the
api/core package, otherwise developers often tend to miss the api/key
package altogether and write `core.Key(name).TYPE(value)` and complain
at the verbosity of such a construction. The api/key package would
allow them to write `key.TYPE(name, value)`.

* Use the api/key package where applicable

This transforms all the uses of `core.Key(name).TYPE(value)` to
`key.TYPE(name, value)`. This also should help increasing the
visibility of the api/key package for developers reading the otel-go
code.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-21 20:26:51 -07:00
Steven E. Harris
8c949274ca
othttp: add RemoteAddrKey for including HTTP client address in top-level spans (#627)
* othttp: add RemoteAddrKey for HTTP client address

Include the requesting HTTP client's network address in each top-level
span emitted by othttp.NewHandler.

* Copyedit documentation for attribute keys
2020-04-09 08:28:19 -07:00
Anthony Mirabella
c8ec530c84
Ensure spans created by httptrace client tracer reflect operation structure (#618)
* Ensure spans created by httptrace client tracer reflect operation structure

* Cleanup (clientTracer).start based on PR feedback

* Ensure a span is recorded even if end() is called before start()

* Ensure start attributes for spans started by (clientTracer).end() are recorded

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-07 09:22:50 -07:00
Marwan Sulaiman
6489b07bf5
othttp: add WithSpanFormatter option (#617)
* othttp: add WithSpanFormatter option

* plugin/othttp: add span formatter test

* remove typo

* preserve operation && change option name

* nil check

* fix comment typo

Co-Authored-By: Rahul Patel <rghetia@yahoo.com>

* add default formatter test case

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-04-06 08:37:25 -07:00
Tyler Yahn
c97b4f726c
Update project License headers and checking (#596)
Update license header to standard format for source files missed prior.

Add license header to new source files.

Add Makefile check to test all `*.go` and `*.sh` files have a copyright
notice (or comment about them being auto-generated) within the first few
lines.
2020-03-25 14:47:17 -07:00
Tyler Yahn
a485d0ec64
Update License header for all source files (#586)
* Update License header for all source files

- Add Apache 2.0 header to source files that did not have one.
- Update all existing headers dated to 2019 to be 2020
- Remove comma from License header to comply with the Apache 2.0
  guidelines.

* Update Copyright notice

Use the standard Copyright notices outlined by the
[CNCF](https://github.com/cncf/foundation/blob/master/copyright-notices.md#copyright-notices)
2020-03-23 22:41:10 -07:00
Anthony Mirabella
e0406dd3eb
Provide an implementation of the Header* filters that does not depend on go1.14 (#565) 2020-03-17 08:45:44 -07:00
Anthony Mirabella
2ef25ea570
Add filters for othttp plugin (#556)
* Add request filtering capability to othhtp.Handler

* Add simple and useful filters for othttp plugin

* Add note that all requests are traced in the absence of any filters

* Add copyright notice to plugin/othttp/filters/filters_test.go

Co-Authored-By: Tyler Yahn <MrAlias@users.noreply.github.com>

* Add package docstring for filters package

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-03-16 16:34:15 -07:00
Gustavo Silva Paiva
85751428a3
add shorter version for global providers (#538) 2020-03-11 08:23:32 -07:00
Joshua MacDonald
3bf3927eb5
Add status message parameter (#524)
* Add status message parameter

* Cleanups around use of codes.OK

* Update for status message
2020-03-07 10:38:59 -08:00
Rahul Patel
547d584da8
Add global propagators (#494)
* Add global propagators

The default global propagators are set to the chained W3C trace and
correlation context propagators.

* Use global propagators in plugins

The httptrace and grpcplugins should also get some API for setting a
propagator to use (the othttp plugin already has such an API), but
that can come in some other PR.

* Decrease indentation in trace propagators

* Drop obsolete TODOs

Now we do "something" with correlation context - it ends up in the
context, and we put the context into the request, so the chained HTTP
handler can access it too.

The other TODO was about tag.Upsert which is long gone.

* Do not unnecessarily update the request context

The request context already contains the span (and we add some
attribute there), so inserting it into context again is pointless.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-03-05 10:12:10 -08:00
Rahul Patel
6769330394
use NewRoot() standard code. (#513) 2020-03-04 14:52:12 -08:00
Krzesimir Nowak
91ea965f8b
Missing PR fixes (#503)
* Drop bogus comment, fix typo

A result of copy-pasting.

* Unexport HTTP header constants

* Rename instruments in tests

"ajwaj" is my favourite placeholder text, but seems like I forgot to
replace its occurences with proper names.

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-03-02 14:50:53 -08:00
Tyler Yahn
52fb033e13
Rename the exporter directory to exporters (#502)
The `go.opentelemetry.io/otel/exporter/trace/jaeger` package was
mistakenly released with a `v1.0.0` tag instead of `v0.1.0`. This
resulted in all subsequent releases not becoming the default latest,
meaning that `go get`s pulled in the incompatible `v0.1.0` release of
that package when pulling in more recent packages from other otel
packages. Renaming the `exporter` directory to `exporters` fixes this
issue by consequentially renaming the package.

Additionally, this action also renames *all* exporters. This is
understood to be a disruptive action to existing users as they will need
to update any dependencies they currently have on our exporters.
However, it was decided to take this action regardless. The need to
resolve the existing issue explained above is highly important, and
given the Alpha state of this project these kinds of breaking changes
should be expected (though not without reason).

Resolves #331

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-03-02 13:54:57 -08:00
Krzesimir Nowak
8ebc7bbad0
Name context functions consistently (#481)
It would be nice to follow a single schema for naming context
functions. In the trace package we followed the form FooFromContext
and ContextWithFoo. Do the same in the correlation package. The schema
WithFoo is mainly used for functions following the options pattern.

Not sure about a name of the NewContext function, though. For now I
have left it alone.

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-27 09:10:52 -08:00
Krzesimir Nowak
6b97bb047a
Move correlation context propagation to correlation package (#479)
Correlation context propagation shouldn't be a part of the trace
package - it is a different aspect of the propagation cross-cutting
concern.

This commit also adds a DefaultHTTPPropagator function for correlation
context propagation and makes the plugins use it.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-02-20 10:31:21 -08:00
Krzesimir Nowak
cf7a4d909c
Refactor propagators (#467)
* Remove binary propagators

They are in process of being dropped from the specification and we
haven't be using them anywhere in the project. Can reintroduce them
later.

* Rename Supplier to HTTPSupplier

The supplier is used only in HTTP propagators currently. It's not
clear if it will be useful for binary propagators if they get to be
specified at some point.

* Rework propagation interfaces

The biggest change here is that HTTP extractors return a new context
with whatever information the propagator is able to retrieve from the
supplier. Such interface does not hardcode any extractor's
functionality (like it was before by explicitly returning a span
context and correlation context) and makes it easy to chain multiple
propagators.

Injection part hasn't changed.

* Add Propagators interface

This interface (and its default implementation) is likely going to be
the propagation API used the most. Single injectors, extractors or
propagators are likely going to be used just as parameters to the
Option functions that configure the Propagators implementation.

* Drop noop propagator

It's rather pointless - just create an empty Propagators instance.

* Fix wrong name in docs

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-02-13 23:16:04 -08:00
Krzesimir Nowak
942713a02d
Replace span relationship with a potentially remote parent context (#451)
This PR removes the non-compliant ChildOf and FollowsFrom interfaces
and the Relation type, which were inherited from OpenTracing via the
initial prototype. Instead allow adding a span context to the go
context as a remote span context and use a simple algorithm for
figuring out an actual parent of the new span, which was proposed for
the OpenTelemetry specification.

Also add a way to ignore current span and remote span context in go
context, so we can force the tracer to create a new root span - a span
with a new trace ID.

That required some moderate changes in the opentracing bridge - first
reference with ChildOfRef reference type becomes a local parent, the
rest become links. This also fixes links handling in the meantime. The
downside of the approach proposed here is that we can only set the
remote parent when creating a span through the opentracing API.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-02-04 08:55:03 -08:00
Cheng-Lung Sung
32489ddae9
make trace.TraceContext as default context propagator (#456)
* make trace.TraceContext as default context propagator

* Update api/trace/trace_context_propagator.go

Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>

* Update plugin/othttp/handler.go

* Update DefaultPropagator in plugin/{http,grpc}trace

* update DefaultPropagator as method instead of var

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-03 09:28:39 -08:00
Amr Hanafi
8fcdf8be73
Send span.kind to jaeger and overwrite grpc metadata instead of using append (#441)
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-01-31 14:03:04 -08:00
Krzesimir Nowak
405a92ab3e
Misc fixes from PR 381 (#443)
* Remove Vendor constants from tracing plugins

Unused. And confusing, since "ot" may mean "opentracing" as well.

* Simplify current span key declaration

No need for a block.

* Fix typo

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-30 10:25:53 -08:00
Krzesimir Nowak
6b4acf47b8 Reorganize propagation code (shrink PR 381) (#444)
* Rename distributedcontext package to correlation

Correlation is the name we agreed upon.

* Move trace propagators to api/trace

The trace propagators tests had to be moved to a testtrace subpackage
to avoid import cycles between api/trace and internal/trace.

Needed to shut up golint about stutter in trace.TraceContext -
TraceContext is a name of a W3C spec, so this stutter is
expected. It's certainly still better than golint's suggestion of
having trace.Context.

* Rename api/propagators to api/propagation

This package will not contain any propagators in the long run, just
the interface definitions.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-28 10:13:46 -08:00
Krzesimir Nowak
437d9af9ab Reword some function documentation in grpc plugin (#446)
Fixes #435.
2020-01-27 10:39:21 -08:00
Tyler Yahn
2d5ba32f4f Remove Tracer name prefix for Span names (#430)
Spans should not have the Tracer name as a prefix for their names. This
removes the `spanNameWithPrefix` function and instead passes through the
span name unmodified wherever this had been called.

Tests that checked Span names are updated to have the non-prefix
expected names.
2020-01-14 04:54:48 -08:00