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

112 Commits

Author SHA1 Message Date
rghetia
68310ab974
move global trace provider api to global package. (#240)
* move global trace provider api to global package.

* fix doc.
2019-10-25 11:38:52 -07:00
Isobel Redelmeier
918efcacc1 Add span data race tests to tracer test harness (#231) 2019-10-24 16:05:26 -07:00
Gustavo Silva Paiva
5e3a2105b9 add WithSpanKind option to span creation (#234)
* add WithSpanKind option to span creation

* change SpanKind to string alias and add support for SpanKind on ot bridge

* fix tests

* fix import order

* fix nits
2019-10-23 16:25:14 -07:00
Krzesimir Nowak
b3247f04fc Update metrics API to match current spec (#228)
* Update metrics API to match current spec

* update options to match the spec

* drop the global meter API

* more docs

* get rid of leftover mentions about descriptor
2019-10-22 23:29:24 -07:00
Gustavo Silva Paiva
a6e139e1d4 api(trace): change trace id to byte array. (#226)
* api(trace): change trace id to byte array.

* fix lint errors

* add helper to create trace id from hex and improve stdout exporter.

* remove comma.

* fix lint

* change TraceIDFromHex to be compliant with w3 trace-context

* revert remove of hex16 regex because its used to parse SpanID

* lint

* fix typo
2019-10-22 23:01:33 -07:00
rghetia
b04db14146
WIP: Named tracer prototype (#227)
* named tracer prototype

* rename Manager to Provider.

* fix compile error after merge.

* rename Tracer method to GetTracer

* provider with options.

* update test.

* cleanup make circl-ci

* remove global config.

* some cleanup.

* use provider for bridge

* update propagation test.

* update examples and plugins.

* remove GlobalTracer methods.

* fix review comments.

* some more cleanup.

* remove unnecessary getTracer call in benchmark test.
2019-10-22 13:19:11 -07:00
Gustavo Silva Paiva
9b5f5dd13a api(trace): change 'reference' to 'relation' (#225) 2019-10-21 10:15:49 -07:00
Joshua MacDonald
1191a07836
Observer metric has not been specified (#222) 2019-10-17 15:35:42 -07:00
Steven Karis
e11b90cab2 Implement W3C Correlation Context propagator (#179)
* Implement W3C Correlation Context propagator

* PR comments

* PR comments

* Update test to inject context properly

* Fix merge
2019-10-17 15:08:44 -07:00
Isobel Redelmeier
3a9c80c56f Provide conformance tests for tracers (#191)
* Provide conformance tests for tracers

The test harness may be used to ensure that a given tracer behaves
according to the expectations set by the API.

* Add `ToMatchError` matcher

* Use DeepEqual to compare unknown types in matchers

Unlike basic `==`/`!=`, `reflect.DeepEqual` can compare arbitrary
types (e.g., `[]string` to `[]string`)

* Use struct instead of string for test context key
2019-10-17 11:13:57 -07:00
Gustavo Silva Paiva
5e409de1aa change key to a string alias and KeyValue constructors (#217)
* change key to a string alias and KeyValue constructors

* fix int and uint tests
2019-10-16 22:49:58 -07:00
Edward Muller
9f03360a84 Enable golint & gofmt, resolve issues (#214)
* Add golint to linters and resolve issues.

I decided to remove constructors for some of the propagation types
because the constructors can be reduced to either using the zero value
or a single, non optional member.

* Enable gofmt and commit fixes
2019-10-16 10:24:38 -07:00
Krzesimir Nowak
388d3248fe Some metrics followup (#177)
* prevent passing observer descriptors to NewHandle

* add some test for metrics

* reword some docs
2019-10-15 09:28:36 -07:00
Isobel Redelmeier
3516ebc456 Rename IsRecordingEvents and WithRecordEvents (#188)
Since these methods are about the span itself rather than specifically
*events* on the span, it makes sense to drop "events" from their names.

[Closes #33]
2019-10-10 18:07:35 -07:00
Alyson van Hardenberg
384b4bb86a rename tag package to distributedContext (#178)
* rename package tag to package distributedContext

* rename Tag -> Entry

* change distributed context -> dctx to avoid capitalization collision

* change dctx -> distributedcontext

* update stackdriver client example
2019-10-10 14:30:22 -07:00
Damien Mathieu
f863bfbd86 rename noop_meter.go to noop.go (#180)
The file defines noopMeter, noopHandler and noopLabelSet. Renaming it to
the more generic `noop.go` makes it clearer that several structs are
defined there.
2019-10-10 12:46:06 -07:00
Joshua MacDonald
be8fb0b4e2 Golang metrics prototype (#100)
* initial metrics work

* rename cumulative to counter

* rename bidirectional to nonmonotonic

* rename unidirectional to monotonic

* rename nonnegative to signed

this changes the default semantics a bit - before the change measure
could record negative values by default, now it can't.

The specification draft currently specifies both NonNegative and
Signed, but I think it's a mistake.

* rename instrument to descriptor

* license

* rework measurement values

* make measurement value a tagged union

* simplify to one kind of metrics

* add observers

* change some interfaces to match the spec

* keep integral measurement separate from floating ones

* remove duplicated measurement type

* add checking for options

* reorder some fields and functions

* rename a function

to avoid confusion between the Handle type and the Measure type

* drop disabled field from descriptor

* add back typed API for metrics

* make metric options type safe

* merge alternatives into a single bool

* make value kind name less stuttery

* fix observation callback prototype

* drop context parameter from NewHandle

* drop useless parameter names

* make descriptor an opaque struct

* use a store helper

* handle comment fixes

* reword Alternate comment

* drop the "any value" metrics

* make measurement value simpler

* document value stuff

* add tests for values

* docs

* do not panic if there is no span ID in the event
2019-10-08 15:45:49 -07:00
Artem Kartasov
cd5ee69468 Named Tracer: temporary remove unnecessary tracer methods (#158) 2019-10-02 21:19:32 -07:00
rghetia
211007efb2
add binary propagation. (#155) 2019-10-02 13:54:39 -07:00
Alyson van Hardenberg
0eb73325ce rename finish to end (#150)
* rename finish -> end

* missed a few finish -> end spots

* change end back to finish for the bridge span in the openTracing bridge

* fixed grammar, ran make
2019-09-27 10:48:10 -07:00
rghetia
e86b95c440
change TraceOptions to TraceFlags. (#144)
* change TraceOptions to TraceFlags.

* fix grammer in docs.
2019-09-25 14:37:36 -07:00
Krzesimir Nowak
339ca2d974 Initial opentracing bridge (#98)
* Allow specifying custom timestamps for events

Adding event with timestamp is not yet a part of the OpenTelemetry
specification, but this function will come in handy when implementing
the OpenTracing bridge.

* Add opentracing bridge, wrapper tracer and migration interfaces

There are some features missing - setting up links and span kind;
context propagation will only work between two OpenTracing bridges.

* Add some tests for the opentracing bridge

The tests mostly check various aspects of the cooperation between
OpenTracing and OpenTelemetry APIs.
2019-09-24 23:12:22 -07:00
Joshua MacDonald
a3ae50d8bc
Remove experimental/streaming globals, add streaming example (#135)
* Remove globals from exp/streaming

* basic example

* Build the streaming example

* Update README.md for running streaming example

* Remove observer package

* Move observer to exporter

* Fix

* Re-run make circle-ci
2019-09-23 14:39:10 -07:00
rghetia
83935b2558
Add propagator interface and W3C propagator (#85)
* add propagation api.

* add http propagator interface and w3c propagator implementation.

* remove Extract api from trace.

* remove Extract interface for tracer.

* fix copyright.

* fix variable names and comments.

* move inject/extract out of trace.

* replace INVALID_SPAN_CONTEXT with EmptySpanContext function.

* fix tag.Map.

* make carrier as interface instead of http.Request.

* rename structs and update doc comments..

* add doc.go

* update doc.

* add noop propagator.

* add new propagation api with Supplier interface.
- added Default Tracer which simply propagates SpanContext.
- added CopyOfRemote option to simply create remote span.

* remove old propagator.

* rename propagator to TextFormatPropagator.

* rename default tracer/span as pass_through tracer/span.

* add test for pass through tracer.

* add missing interface to pass through tracer.

* return SpanContext instead of contex.Context from Extract interface.
- also remove PassThroughTracer

* fix review comments.

* add more test cases for traceContext extraction.

* remove tidy temporarily from circle-ci target to avoid build failure.

* allow header ending in dash '-'.

* add inject test for non-zero value other than 01 for traceoption

* add AddLink and Link interface to MockSpan

* fix running go mod tidy on every build.
2019-09-23 11:51:32 -07:00
rghetia
c70cb29f22
add support for Link. (#80)
* add support for Link.

* add AddLink to mockSpan

* update api documentation.
2019-09-21 00:26:20 -07:00
Krzesimir Nowak
3362421c9b Drop the registry package (#130)
This is to shrink the PR #100.

The only place where the registry.Variable type was used was metrics,
so just inline that type into its only user. The use of the
registry.Variable type in core.Key was limited to the Name field.

The stats package also used the registry.Variable type, but seems that
also only the Name field was used and the package is going to be
dropped anyway.
2019-09-19 11:20:02 -07:00
Krzesimir Nowak
a776e95c61 Consolidate AddEvent and Event methods, add FinishOptions (#99)
* Merge two event methods in span API

There was an agreement to get rid of the Event interface and
consolidate the two methods for adding events into one. See #57.

* Eliminate the use of the Event interface

There is no need for the SDK to provide the implementation of the
Event interface - it is used nowhere.

* Drop the Event interface

It's dead code now.

* Make it possible to override a finish timestamp through options

Opentracing to opentelemetry bridge will certainly use this feature.

* Obey the start time option

* Add tests for events and custom start/end times
2019-09-03 11:03:51 -07:00
Krzesimir Nowak
3fc6025071 Allow setting the name of the span after starting it (#102)
* Allow setting the name of the span after starting it

* Add test for setting the name of the span
2019-08-26 11:53:12 -07:00
Koichi Shiraishi
887748491b Add vanity import name (#107)
* api: add doc.go and vanity custom import name

* experimental/streaming/exporter: add doc.go & vanity custom import name

* experimental/streaming/exporter/*: add vanity custom import name

* golangci.yml: fix local-prefixes to go.opentelemetry.io

* api,sdk: run `goimports -w -local go.opentelemetry.io`
2019-08-26 09:41:15 -07:00
Krzesimir Nowak
670b0365d8 Make tag.Map a concrete type. (#89)
This is to make tag.Map an immutable type, so it is safe to use
concurrently. The safety is not yet fully achieved because of the
functions returning contents of the map (Value and Foreach). The
functions give callers an access to core.Value objects, which contain
a byte slice, which has pointer like semantics. So to avoid accidental
changes, we will need to copy the value if it is of BYTES type.

Fixes #59
2019-08-23 09:01:52 -07:00
Dave Josephsen
3ca747f4e8 change the api/core tests to use core_testing package (#96)
* add exported value for traceOptionBitMaskUnused (for testing)

* move key_test to package core_test

* add span_context_test to package core_test
2019-08-22 11:40:15 -07:00
Dave Josephsen
8e7e1fd0a9 add tests for api/trace/current.go (#82)
* add tests for api/trace/current.go

* add interface validaion for type: mockSpan

* rework for exported NoopSpan and ditch useless tabletest for TestSetCurrentSpan()
2019-08-22 10:15:22 -07:00
rghetia
a54a8a27c4
Add Sampler API (#70)
- also add implementation of AlwaysSampleSampler and NeverSampleSampler
2019-08-22 09:57:27 -07:00
Isobel Redelmeier
56e1a9d1f4 Export NoopSpan and NoopTracer (#92) 2019-08-13 16:03:40 -07:00
thinkerou
0ce21a987b remove duplicate interface check (#87) 2019-08-12 11:03:29 -07:00
thinkerou
290f108852 use EmptySpanContext function instead of global variable (#86) 2019-08-12 10:59:35 -07:00
thinkerou
0a37b8f43e add IsValid() for SpanContext (#46)
* add IsValid() for SpanContext

* add unit test
2019-08-05 09:58:50 -07:00
rghetia
0f32efcdaa
Trace sdk (#65)
* trace sdk initial commit.

* fix imports and comments.

* remove tracestate

* split trace.go

* add attribute over limit test.

* add comments and restructure span.go and tracer.go

* refactor MessageEvent

* defer unlock

* some more cleanup in span.go

* rename *MessageEvent* to *Event*

* cleanup comments in trace_test.go

* fix typos.

* return full string ID for traceID and spanID.
2019-08-02 13:52:55 -07:00
rghetia
0edf31e1c6
add APIs for traceoption and tracestate. (#60)
* add APIs for traceoption and tracestate.

* remove tracestate and refactor traceoptions.
2019-08-02 10:42:47 -07:00
Dave Josephsen
dad5622903 adds tests for api core key.go (#64)
* adds tests for api core key.go

* re-arrange imports

* change all floats to 42.1

* set TestFloat32 to 42.0
2019-07-23 11:38:23 -07:00
Dave Josephsen
4b974a1beb adds tests for core/span_context.go (#63) 2019-07-19 13:29:42 -07:00
Wei Fu
eba4b51b81 set vtype for newVar (#56)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-07-16 10:08:12 -07:00
rghetia
eed647d11f
replace import with vanity url go.opentelemetry.io. (#54) 2019-07-15 14:49:21 -07:00
Joshua MacDonald
961121698b Eliminate Scope/ScopeID, separate API from SDK for metrics/stats (#48)
* Move scope.Active to trace.CurrentSpan

* Remove scope / does not build

* Global tracer

* Checkpoint

* Checkpoint

* Add key/key.go for key.New

* Comments

* Remove more EventID and ScopeID

* Use Handle to describe static objects

* TODOs

* Remove empty file

* Remove singletons

* Update TODOs

* TODO about map update

* Make stats package option aliases (like key has)

* Rename experimental/streaming

* streaming SDK builds w/ many TODOs

* Get the examples building

* Tidy up metric API / add interface check

* Remove logic from the registry; this is now a placeholder
2019-07-11 15:28:38 -07:00
rghetia
20b2f718b8
Add Circle ci (#41)
* fix compile errors.

* fix lint errors.

* add circle-ci job.

* rename IDHigh to TraceIDHigh

* rename the file.

* add go get for goimports and golangci-lint

* enable GO111MODULE and remove comments.

* remove working dir and update cache name

* Add TEST_RESULT env back.

* run go mod tidy.

* remove go mod download.

* add test coverage.

* fix TraceID.

* fix circlefi config error.

* remove install-tools.

* remove ALL_TEST_SRC from Makefile.
2019-07-02 16:21:24 -07:00
thinkerou
dc4a44ca4e split core.go (#39) 2019-07-01 12:17:50 -07:00
thinkerou
56fe193518 check interface implement for metric (#38) 2019-07-01 12:12:35 -07:00
thinkerou
861e3e8776 check interface implement (#37) 2019-07-01 12:11:24 -07:00
thinkerou
a606839692 use function instead of global var (#36)
* use function instead of global var

* fix lack return
2019-07-01 11:28:25 -07:00
thinkerou
252c6b5502 add interface implement check (#35) 2019-07-01 11:27:52 -07:00
thinkerou
c0a5fd12a5 remove duplicate var define (#34) 2019-07-01 11:25:40 -07:00
thinkerou
084f03d098 use grpc.codes.String instead of custom switch (#32)
* use grpc.codes.String instead of custom switch

* remove unused import
2019-06-29 08:07:14 -07:00
thinkerou
d8f9b2546e move Apply method to map.go and check interface implement (#30)
* move Apply method to map.go

* Update map.go
2019-06-28 16:35:42 -07:00
thinkerou
8c47aeb0af update (#31) 2019-06-27 22:59:13 -07:00
thinkerou
36f51385ff update type style (#29) 2019-06-27 21:26:16 -07:00
rghetia
521a6c40f1
move span, trace and event implementation to sdk. (#27)
* move event to sdk.

* move trace and span implementation to sdk.
- also added noop implementation of span and trace.

* fix review comments.
2019-06-26 22:03:09 -07:00
rghetia
d6d9786732
rename Log and Logf interface to AddEvent and AddEventf. (#22)
* rename Log and Logf interface to AddEvent and AddEventf.
- also remove log package.

* provide only AddEvent interface to Span
- Event can be created using Event specific interface.

* add var trick for Event interface.
2019-06-25 13:50:46 -07:00
rghetia
abccacef85
Revert "Remove log interface from Span." (#21)
This reverts commit a551f0298c.
2019-06-24 10:35:16 -07:00
rghetia
73b844930c
Remove log interface from Span. (#18) 2019-06-21 15:29:29 -07:00
rghetia
3c3532fb04
Add SetStatus, SpanContext and IsRecordingEvent (#12)
* Add span apis.
- SetStatus
- SpanContext
- IsRecordingEvent

* fix formatting.

* use grpc/codes.Code

* change Option to SpanOption

* fix format errors.
2019-06-19 10:44:46 -07:00
rghetia
b4a8d21a36
add license text. (#10) 2019-06-14 13:09:41 -07:00
Joshua MacDonald
e17f4468a6 Golang opentelemetry-go draft API (incomplete) (#9)
* Work in progress from https://github.com/lightstep/opentelemetry-golang-prototype

* Renames

* Rename

* Finish rename

* Rename packages

* README
2019-06-14 11:37:05 -07:00