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

737 Commits

Author SHA1 Message Date
Tyler Yahn
dcd0a10493 Rename the sdk/export/metric package name (#432)
Rename the package from "export" to "metric". Note that all the existing
imports of this package use an explicit name of `export` and, therefore,
no import declaration changes are included.

Rename the `MetricKind` to `Kind` to not stutter in the type usage. Note
this does not include a method name change for the `Descriptor` method
`MetricKind`.
2020-01-16 10:05:12 -08:00
Damien Mathieu
3a32a19c9a fix aggregator.go import package (#431)
This import package doesn't match the tests file, preventing imports of
the project from master with tests (without go modules).

The package path matches the test file version, so this moves
aggregator.go to match too.
2020-01-15 09:17:18 -05: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
Martin Garton
8b0f7ef5f4 Fix aggregator import path (#421)
When this was moved, the import path was not updated to match.  This
fixes it to avoid a message like "code in directory foo expects import
bar"
2020-01-07 10:30:41 -05:00
Johannes Liebermann
d4557c3dfa Refactor current span check (#419)
- Simplify conditionals.
- Remove unnecessary nil check.

Go type assertions return a bool value indicating whether the
assertion succeeded. When the assertion is performed on a nil value,
the bool becomes false without a panic, therefore the nil check is
unnecessary.
2020-01-06 14:24:51 -05:00
Tyler Yahn
91091b44eb Add comments and test for 64-bit field alignment (#418)
* Add comments on needed filed alignment

Add comment about alignment requirements to all struct fields who's
values are passed to 64-bit atomic operations.

Update any struct's field ordering if one or more of those fields has
alignment requirements to support 64-bit atomic operations.

* Add 64-bit alignment tests

Most `struct` that have field alignment requirements are now statically
validated prior to testing. The only `struct`s not validated that have
these requirements are ones defined in tests themselves where multiple
`TestMain` functions would be needed to test them. Given the fields are
already identified with comments specifying the alignment requirements
and they are in the test themselves, this seems like an OK omission.

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-06 13:08:40 -05:00
Liz Fong-Jones
4c9bf78ab3 s/options/config/ (#410)
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-03 09:48:45 -08:00
Matej Gera
067aa9e142 [metrics] standardize/simplify export pipeline setup (#395)
* Introduce simplified export pipeline setup for stdout

* Standardize dogstatsd,stdout,prometheus calling.

* Creates NewRawExporter, NewExportPipeline, InstallNewPipeline methods.
* Uses Options rather than Config throughout for options.

* fix merge conflicts.

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-02 10:41:21 -08:00
Joshua MacDonald
dd781560d4
Rename handle to bound instrument (@sircelsius) (#400)
* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* chore(meter): renamed from *BoundInstrument to Bound*, renamed AcquireBoundInstrument to Bind

* chore(meter): renamed Release to Unbind

* Self feedback in doc.go

* Rename confusing method name

Co-authored-by: Marc Bramaud <sircelsius@users.noreply.github.com>
2019-12-27 16:30:19 -08:00
Letian Zhang
4f88422aa7 initialize checkpoint when creating ddsketch aggregator to prevent panic when merging into a empty one (#402) (#403) 2019-12-26 08:31:41 -08:00
Joshua MacDonald
1414d363de
Global meter forwarding implementation (#392)
* Initial skeleton

* Revert noop provider removal

* Checkpoint

* Checkpoint

* Implement Bound instrument and LabelSet

* Add test

* Add a benchmark

* Add a release test

* Document LabelSetDelegator

* Lint and comments

* Add a second Meter test; fix typo; add a panic

* Add a test for the builtin SDK

* Address feedback
2019-12-23 23:03:04 -08:00
Joshua MacDonald
11f67cea8e Comments in the metrics SDK (#399)
* Comments from walkthrough

* Update
2019-12-23 16:38:35 -08:00
Gustavo Silva Paiva
6f04903876 Change prometheus to not aggregate metrics and only export them. (#385)
* draft using stop aggregating on prometheus client (counters)

* remove prometheus client aggregations

Measures are being exported as summaries since histograms doesn't
exist on OpenTelemetry yet.

Better error handling must be done.

* make pre commit

* add simple error callback

* remove options from collector

* refactor exporter to smaller methods

* wording

* change to snapshot

* lock collection and checkpointset read

* remove histogram options and unexported fields from the Exporter

* documenting why prometheus uses a stateful batcher

* add todo for histograms

* change summaries objects to summary quantiles

* remove histogram buckets from tests

* wording

* rename 'lockedCheckpoint' to 'syncCheckpointSet'

* default summary quantiles should be defaulted to no buckets.

* add quantiles options

* refactor test.CheckpointSet and add docs

* flip aggregators merge

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2019-12-23 09:47:51 -08:00
Cheng-Lung Sung
09ae5378b7 rename Message in Event to Name (#389)
implements #387
2019-12-18 10:13:05 -08:00
Vineeth Pothulapati
b863b8f6ab Rename CurrentSpan to SpanFromContext & SetCurrentSpan to ContextWithSpan (#379)
Signed-off-by: vineeth <vineethpothulapati@outlook.com>
2019-12-11 08:51:32 -08:00
Jonas-Taha El Sesiy
1ab645fedb Consistently use pointer receivers for core.Number (#375)
Change all occurrences of value to pointer receivers
Add meta sys files to .gitignore
Code cleanup e.g.
- Don't capitalize error statements
- Fix ignored errors
- Fix ambiguous variable naming
- Remove unnecessary type casting
- Use named params

Fix #306
2019-12-09 13:03:11 -08:00
ferhat elmas
afd9d5a0d4 Make span start/end configuration more greppable (#369)
* Make span start/end configuration more greppable

Rename SpanOption to StartOption
Rename StartOptions to StartConfig
Rename EndOptions to EndConfig

fixes #197
2019-12-05 08:41:13 +11:00
ferhat elmas
eb9fe13a77 Drop SetAttribute from Span (#361)
fixes #302
2019-12-03 16:58:55 +11:00
ET
fef504d469 Add Min() interface - rename MaxSumCount to MinMaxSumCount (#352)
* Add Min() interface - rename MaxSumCount to MinMaxSumCount

Fixes https://github.com/open-telemetry/opentelemetry-go/issues/319

* update stdout exporter to collect and output the minimum value
* update min and max atomically in Aggregator Update
* changed all references to maxsumcount to minmaxsumcount

* Address PR comments
2019-11-26 14:07:58 -08:00
Vineeth Reddy
a99f872759 Span interface should only allow LinkedTo at creation. (#349)
* Remove AddLink & Link from Span Interface

I have remove AddLink and Link from the interface and all it refereneces and replaced AddLink with addlink, Also Removed respective unit tests

Signed-off-by: vineeth <vineethpothulapati@outlook.com>

* removing the unused code from unit tests

Signed-off-by: VineethReddy02 <vineethpothulapati@outlook.com>
2019-11-26 16:03:07 -05:00
Gustavo Silva Paiva
3d78564d2f Prometheus exporter (#334)
* Prom exporter structure

* update prometheus exporter with master and add example.

* remove distributedcontext from prometheus example

* docs and interface checker

* make precommit

* make precommit & remove "OnRegisterError"

* coerce values to float

* return register errors and maybe fix precommit?

* add option to specify a prometheus.Registry

* make exporter implement http.Handler interface

* fix map keys bugs

* remove unused const

* fix modules dependencies.

* add support for histogram

* get metrics with labels values only instead of a labels map

* make exporter implements label encoder interface

* encode labels if the encoder is different.

* split metrics on several files and encapsulate them in structs

* make pre commit

* unexport 'sanitize'

* remove 'AllValues' in favor of 'Points' and change to 'NewDefaultLabelEncoder'

* add prometheus tests

* remove newlines on struct declaration

* formatting

* rewording

* imports

* add todo on labelValues

* blame myself for todo (:

* add todos on sanitize

* add support for summaries. custom remove label encoder.

* imports

* imports

* update with upstream
2019-11-26 11:47:15 -08:00
Cheng-Lung Sung
1b08d827a4 Rename GetMeter() to Meter() (#357) 2019-11-26 09:54:05 -08:00
ET
9a2484c373 Implement support for NonAbsolute Measurement MaxSumCount (#335)
* Add tests for nonabsolute and varying sign values

* Implement support for NonAbsolute Measurement MaxSumCount

Previously, the MaxSumCount aggregator failed to work correctly with
negative numbers (e.g. MeasureKind Alternate()==true).

* Pass NumberKind to MaxSumCount New() function

Allows it to set the initial state (current.max) to the correct value
based on the NumberKind.

* Revert extraneous local change

* Pass full descriptor to msc New()

This is analagous to the DDSketch New() constructor

* Remember to run make precommit first

* Add tests for empty checkpoint of MaxSumCount aggregator

An empty checkpoint should have Sum() == 0, Count() == 0 and Max()
still equal to the numberKind.Minimum()

* Return ErrEmptyDataSet if no value set by the aggregator

Remove TODO from stdout exporter to ensure that if a maxsumcount or
ddsketch aggregator returns ErrEmptyDataSet from Max(), then the
entire record will be skipped by the exporter.

Added tests to ensure the exporter doesn't send any updates for
EmptyDataSet checkpoints - for both ddsketch and maxsumcount.

* Relayout Aggreggator struct to ensure int64s are 8-byte aligned

On 32-bit architectures, Go only guarantees that primitive
values are aligned to a 4 byte boundary. Atomic operations on 32-bit
machines require 8-byte alignment.

See https://github.com/golang/go/issues/599

* Addressing PR comments

The use of Minimum() for the default uninitialized Maximum value means
that in the unlikely condition that every recorded value for a measure
is equal to the same NumberKind.Minimum(), then the aggregator's Max()
will return ErrEmptyDataSet

* Fix PR merge issue
2019-11-25 09:51:49 -08:00
ferhat elmas
0f052af2f4 Rename GetTracer to Tracer (#347)
* Rename GetTracer to NewTracer

* Drop New prefix
2019-11-25 09:46:07 -08:00
Joshua MacDonald
799a4180bd
Fix race conditions in push_test.go (#340)
* Fix race conditions in push_test.go

* Add circle race test
2019-11-22 10:48:53 -08:00
Joshua MacDonald
b9706b20f9
Dogstatsd metrics exporter (#326)
* Add MetricAggregator.Merge() implementations

* Update from feedback

* Type

* Ckpt

* Ckpt

* Add push controller

* Ckpt

* Add aggregator interfaces, stdout encoder

* Modify basic main.go

* Main is working

* Batch stdout output

* Sum udpate

* Rename stdout

* Add stateless/stateful Batcher options

* Undo a for-loop in the example, remove a done TODO

* Update imports

* Add note

* Rename defaultkeys

* Support variable label encoder to speed OpenMetrics/Statsd export

* Lint

* Checkpoint

* Checkpoint

* Doc

* Precommit/lint

* Simplify Aggregator API

* Record->Identifier

* Remove export.Record a.k.a. Identifier

* Checkpoint

* Propagate errors to the SDK, remove a bunch of 'TODO warn'

* Checkpoint

* Introduce export.Labels

* Comments in export/metric.go

* Comment

* More merge

* More doc

* Complete example

* Lint fixes

* Add a testable example

* Lint

* Dogstats

* Let Export return an error

* Checkpoint

* add a basic stdout exporter test

* Add measure test; fix aggregator APIs

* Use JSON numbers, not strings

* Test stdout exporter error

* Add a test for the call to RangeTest

* Add error handler API to improve correctness test; return errors from RecordOne

* Undo the previous -- do not expose errors

* Add simple selector variations, test

* Repair examples

* Test push controller error handling

* Add SDK label encoder tests

* Add a defaultkeys batcher test

* Add an ungrouped batcher test

* Lint new tests

* Respond to krnowak's feedback

* Checkpoint

* Funciontal example using unixgram

* Tidy the example

* Add a packet-split test

* More tests

* Undo comment

* Use concrete receivers for export records and labels, since the constructors return structs not pointers

* Bug fix for stateful batchers; clone an aggregator for long term storage

* Remove TODO addressed in #318

* Add errors to all aggregator interfaces

* Handle ErrNoLastValue case in stdout exporter

* Move aggregator API into sdk/export/metric/aggregator

* Update all aggregator exported-method comments

* Document the aggregator APIs

* More aggregator comments

* Add multiple updates to the ungrouped test

* Fixes for feedback from Gustavo and Liz

* Producer->CheckpointSet; add FinishedCollection

* Process takes an export.Record

* ReadCheckpoint->CheckpointSet

* EncodeLabels->Encode

* Format a better inconsistent type error; add more aggregator API tests

* More RangeTest test coverage

* Make benbjohnson/clock a test-only dependency

* Handle ErrNoLastValue in stress_test

* Update comments; use a pipe vs a unix socket in the example test

* Update test

* Spelling

* Typo fix

* Rename DefaultLabelEncoder to NewDefaultLabelEncoder for clarity

* Rename DefaultLabelEncoder to NewDefaultLabelEncoder for clarity

* Test different adapters; add ForceEncode to statsd label encoder
2019-11-21 20:46:05 -08:00
Gustavo Silva Paiva
2c437c9efe fix benchmark error, with always/never sample and add benchmark setAttribute vs setAttributes (#325) 2019-11-20 12:34:43 -08:00
Joshua MacDonald
dfae2acc6c
Fix the defaultkeys metrics batcher (#333) 2019-11-19 13:25:24 -08:00
Gustavo Silva Paiva
3495d74971 specialize simplelru(span's lruMap) for attributes only (#328)
* copy of simplelru for attributes without excessive usage of interface{}

This also make sure we only add attributes/links if isRecording.

Move method to export the attributes list to attributeMap.

* run make precommit to update mod files.
2019-11-18 10:51:57 -08:00
Joshua MacDonald
9878f3b700 Metrics stdout export pipeline (#265)
* Add MetricAggregator.Merge() implementations

* Update from feedback

* Type

* Ckpt

* Ckpt

* Add push controller

* Ckpt

* Add aggregator interfaces, stdout encoder

* Modify basic main.go

* Main is working

* Batch stdout output

* Sum udpate

* Rename stdout

* Add stateless/stateful Batcher options

* Undo a for-loop in the example, remove a done TODO

* Update imports

* Add note

* Rename defaultkeys

* Support variable label encoder to speed OpenMetrics/Statsd export

* Lint

* Doc

* Precommit/lint

* Simplify Aggregator API

* Record->Identifier

* Remove export.Record a.k.a. Identifier

* Checkpoint

* Propagate errors to the SDK, remove a bunch of 'TODO warn'

* Checkpoint

* Introduce export.Labels

* Comments in export/metric.go

* Comment

* More merge

* More doc

* Complete example

* Lint fixes

* Add a testable example

* Lint

* Let Export return an error

* add a basic stdout exporter test

* Add measure test; fix aggregator APIs

* Use JSON numbers, not strings

* Test stdout exporter error

* Add a test for the call to RangeTest

* Add error handler API to improve correctness test; return errors from RecordOne

* Undo the previous -- do not expose errors

* Add simple selector variations, test

* Repair examples

* Test push controller error handling

* Add SDK label encoder tests

* Add a defaultkeys batcher test

* Add an ungrouped batcher test

* Lint new tests

* Respond to krnowak's feedback

* Undo comment

* Use concrete receivers for export records and labels, since the constructors return structs not pointers

* Bug fix for stateful batchers; clone an aggregator for long term storage

* Remove TODO addressed in #318

* Add errors to all aggregator interfaces

* Handle ErrNoLastValue case in stdout exporter

* Move aggregator API into sdk/export/metric/aggregator

* Update all aggregator exported-method comments

* Document the aggregator APIs

* More aggregator comments

* Add multiple updates to the ungrouped test

* Fixes for feedback from Gustavo and Liz

* Producer->CheckpointSet; add FinishedCollection

* Process takes an export.Record

* ReadCheckpoint->CheckpointSet

* EncodeLabels->Encode

* Format a better inconsistent type error; add more aggregator API tests

* More RangeTest test coverage

* Make benbjohnson/clock a test-only dependency

* Handle ErrNoLastValue in stress_test
2019-11-15 13:01:20 -08:00
Joshua MacDonald
ee87858c09 Avoid one memory allocation in LabelSet construction (#318) 2019-11-14 13:13:42 -08:00
Gustavo Silva Paiva
9d19d8296c Clear NoopTracer implementation and improve Tracer argument names (#314)
* clean dead code from noop tracer

* rename arguments from the Tracer interface's methods

* remove service, resources and component options from sdk/tracer and mock tracer

* remove unused fields from sdk/tracer
2019-11-14 10:50:20 -08:00
Gustavo Silva Paiva
1fd93b293c change trace.WithAttributes to append values instead of replacing (#315)
* change trace.WithAttributes to append values instead of replacing

* improve doc
2019-11-14 18:03:23 +00:00
Joshua MacDonald
769a03ac97 Use a formula for tolerance in sampling tests (#298) 2019-11-08 11:11:59 -08:00
Joshua MacDonald
2546646050
Fix metric SDK race condition (#293)
* Initial fix

* benchmark acquire

* Rename handle benchmarks
2019-11-06 10:54:36 -08:00
Joshua MacDonald
68bd627ac2
Move export types into trace and metric-specific subdirs (#289) 2019-11-05 13:08:55 -08:00
Joshua MacDonald
1bfa1aa429
Change SpanKind type an integer type (#288)
* Change SpanKind to an integer

* Take suggestion

* Use the helper from the bridge
2019-11-04 16:05:43 -08:00
Joshua MacDonald
9040d824ae
Add array aggregation for raw measure metrics, improve testing (#282)
* Array aggregator part 1

* Improve median testing

* More testing

* More testing

* Update other dist tests

* Add to the benchmark

* Move errors into aggregator package, use from ddsketch; update Max/Min/Quantile to return errors for array/ddsketch/maxsumcount

* Lint

* Test non-absolute ddsketch

* Lint

* Comment

* Add note
2019-11-04 14:24:01 -08:00
Liz Fong-Jones
d25fae7c10 set attributes in tracer.Start() (#286)
* set attributes in tracer.Start()

* add tests

* remove no longer needed attribute additions
2019-11-04 11:04:38 -08:00
Liz Fong-Jones
9f82c642f5
use LinkedTo rather than ChildOf for PublicEndpoint (#272)
This causes us to no longer emit missing root spans if we do not have the trace associated with the tracing headers we receive on public endpoints.
2019-11-04 14:03:40 +01:00
Liz Fong-Jones
440b6653c9 remove rSSP and rBSP code, use NewProvider instead. (#271) 2019-11-01 16:35:18 -07:00
rghetia
15bfc5bb12
Namespace import path under "/otel" (#274)
Also fixes example module paths so that they use the vanity URL instead
of the github URL.

[Closes #184]
2019-11-01 11:40:29 -07:00
Eran Levy
579e0ce7c6 add more test cases to jaeger exporter and fix comments (#242)
* fix comments and add jaeger tests

* add more jaeger tests

* remove TODOs and add more jaeger tests

* remove TODOs and add more jaeger tests

* fix jaeger tests

* add jaeger agent tests

* fix merge conflicts and fix test

* fix test name
2019-10-31 10:52:46 -07:00
Joshua MacDonald
915775e348
Add MetricAggregator.Merge() implementations (#253)
* Add MetricAggregator.Merge() implementations

* Update from feedback

* Type
2019-10-30 22:15:27 -07:00
Krzesimir Nowak
563985f5d1 Shrink core.Value (#256)
* shrink the value type

went down from 40 bytes to 24

* add missing license blurb

* stringify value type

* print string value types in stdout exporter

* make Value function take a pointer receiver
2019-10-30 15:01:19 -07:00
Joshua MacDonald
de6715fca3
Remove the distributedctx.Mutator (#252)
* Remove the distributedctx.Mutator

* Remove unused field

* Update examples
2019-10-30 13:21:13 -07:00
Joshua MacDonald
88dafbbb16
Remove NewZeroNumber in favor of Number(0) (#255) 2019-10-30 11:22:14 -07:00
Joshua MacDonald
320c62a780
Remove BYTES values, as they are are not thread safe (#249)
* Remove BYTES values, as they are mutable

* Remove more BYTES
2019-10-30 10:20:53 -07:00
Edward Muller (SFDC)
f420f7409d sdk/trace: Test the Sampling Probability (#247)
* sdk/trace: Test the Sampling Probability

Closes #163

* Add tests for when the parent is sampled.
2019-10-29 16:53:50 -07:00
Joshua MacDonald
937f4ff8b0
Metrics SDK work-in-progress (#172)
Introduce the new SDK, four aggregators, and an export interface.
2019-10-29 13:27:22 -07:00
Gustavo Silva Paiva
4e545e2ab8 api(trace): change SpanID to byte array (#241)
* api(trace): change SpanID to byte array

* fix doc and create const errors
2019-10-28 10:05:06 -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
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
Isobel Redelmeier
e4052cf674 Make sdk's Span#SetSpan thread-safe (#232)
[Closes #230]
2019-10-22 15:25: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
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
Isobel Redelmeier
849cdc7630 Propagate FollowsFrom span relationships in SDK (#190)
[Closes #189]
2019-10-14 13:20:03 -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
Artem Kartasov
ffbef6a007 SDK: Multiple Unregister should not trigger multiple shutdown call (#176)
* SDK: Multiple Unregister should not trigger multiple shutdown call

* fix a data race: waitGroup.Add() should be outside of a goroutine
2019-10-08 23:31:29 -07:00
Damien Mathieu
c2d5c66990 Export package (#162)
* setup sdk exporter package

* use sdk exporter package in sdk trace

* use sdk exporter package in all exporters

* empty the exporters list before testing Load

* move SpanData to the exporter package

* use the SpanProcessor registration, don't register exporters

* rename exporter structs to avoid stutter

* rename Syncer and Batcher to SpanSyncer and SpanBatcher

So it's explicit they are for spans, and we reduce the risk of name
conflict

* remove not moot todo

* rename sdk exporter to export

* only execute the SpanData if it is sampled
2019-10-08 11:56:58 -07:00
Artem Kartasov
93c667978d SDK: Add Shutdown test for Span Processor (#169)
* SDK: Add Shutdown test for Span Processor

* SDK: Shutdown test for Span Processor. Review fixes
2019-10-08 10:34:19 -07:00
rghetia
3d5b2fa328
Batched span processor (#154)
* add batch span processor.

* add blocking support.

* use With* function for options.
- also changed how Shutdown is handled.

* block Shutdown until queue is flushed.

* fix comment.
2019-10-01 13:50:51 -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
rghetia
a853377a2f
Update example to use jaeger exporter and update Readme (#143)
* update http example to use jaeger exporter and sdk.

* update image location.

* remove extra parameters for jaeger.
2019-09-25 13:22:33 -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
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
rghetia
8af3bfcdc2
Use trace.SetCurrentSpan to store the span in the context in SDK. (#129) 2019-09-19 12:23:07 -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
rghetia
cb0d352ec6
SDK: span processor interface and simple span processor. (#117)
* SDK: SpanProcessor Interface.

* add simple span processor.

* rename span processor.

* fix logic to export or process span data.
2019-09-16 13:58:15 -07:00
rghetia
9f85824979
Exporter: Initial Jaeger Trace Exporter commit. (#112)
* Exporter: Initial Jaeger Trace Exporter commit.

* remove unused methods and add TODOs.

* remove TODO.

* fix build error by exporting event struct.

* move Event from basetypes.go to export.go
2019-09-09 14:59:39 -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
thinkerou
290f108852 use EmptySpanContext function instead of global variable (#86) 2019-08-12 10:59:35 -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
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
6d798e3a2f add lacked import and remove unused import (#33) 2019-07-01 11:23:26 -07:00
thinkerou
f5ec719fbd update type style (#28) 2019-06-27 13:34:57 -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