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
Krzesimir Nowak
574463c9ef
Allow dropping items from correlations + docs + cleanups (#454)
* Drop entry from correlation map

Entry used to contain stuff like TTL, but right now the notion of
entry was dropped from the spec.

* Compute exact size of the correlations map

The map will be immutable, so spend some more time to ensure that we
will not unnecessarily waste some memory on a basically read-only map.

* Allow dropping keys from correlations map

This is to follow the spec. Before this change it was possible in an
awkward way by using Foreach to gather and filter the key-value pairs,
and then calling NewMap with a MultiKV MapUpdate.

* Document the correlation package

* Add missing license blurbs in correlation package

* Add tests for deleting items in correlations

* Factor out getting map size and test it

This is an implementation detail that can't be tested in a black-box
manner.

* Fix copyright dates

* Simplify/disambiguate keySet function parameters/return values

* Fix typo in Apply docs

* Fix test names

* Explain the nonsense of dropping keys from new map
2020-02-03 13:07:53 -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
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
Rebecca Pruim
20bb650b2d Improve detail in stdout exporter (#436)
* Switch stdout exporter to use ungrouped batcher

* Add unspecified keys to name without equals signs

* Fix tests for stdout exporter

* Add test for unspecified keys

* Move test to stdout_test.go
2020-01-24 05:51:58 -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
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
Luis
71f38454c8 fixed typo (#408)
this is a small fix of a single typo that triggered my OCD ;-)

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-03 09:38:05 -08:00
Tyler Yahn
bb4f7facfb Global trace forwarding implementation (#406)
* Global trace forwarding implementation according to https://github.com/open-telemetry/oteps/pull/74
2020-01-02 16:20:38 -05: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
Cheng-Lung Sung
5eb457a119 [trace] add option.Writer for stdout output (#404)
* add option.File for stdout output

* Unify the naming of `Writer` field (io.Writer) in Options
2020-01-02 11:40:37 -05: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
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
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
Isobel Redelmeier
a9756528ba Add inspectable test tracer (#353)
* Add inspectable test tracer

This adds a test Tracer implementation that tracks its active and ended
spans and uses a Span implementation that can be inspected (e.g., to see
what attributes have been set).

* Ensure test tracer can start spans concurrently

* Flip conditional logic to return early

* Remove duplicate test

* Fix file name casing

🤦

* Add comments to testtrace code

* Remove Link and AddLink methods from test Span

* Enable concurrently setting and getting test attrs

* Remove SetAttribute from test tracer

* Fix test

* Fix names post-rebase
2019-12-04 14:00:35 -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
ab164e6638 Merge propagation and api/propagation into api/propagators (#362)
* Merge propagation

Rename and merge propagation and api/propagation
to api/propagators.

Drop propagator suffix in general such that
TextFormatPropagator becomes TextFormat since
usage is propagators.TextFormat

fixes #311

* Rebase and godoc updates

* Revert go mod changes

* Replace carrier with supplier in godoc
2019-12-03 13:52:03 -08:00
ferhat elmas
eb9fe13a77 Drop SetAttribute from Span (#361)
fixes #302
2019-12-03 16:58:55 +11:00
ferhat elmas
f25c84f35f Fix lint target (#360) 2019-11-27 23:20:33 -08: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
Cheng-Lung Sung
1b08d827a4 Rename GetMeter() to Meter() (#357) 2019-11-26 09:54:05 -08:00
Cheng-Lung Sung
13cd2ac417 move /global to /api/global (#356)
implement #337
2019-11-25 20:41:24 -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
ferhat elmas
eb3b31e12d Unslice to simplify (#324) 2019-11-18 10:47:04 -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
Wei Fu
c3d5b7b16d remove empty package (#322)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-11-15 00:23:36 -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
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
Cheng-Lung Sung
881e51f708 Add MarshalJSON for core.Value (#281)
- fix #280, where stdout export will not print Attributes value from
  MessageEvents.
- add unit test for it.
2019-11-04 13:46:34 -06: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
Cheng-Lung Sung
50a419f477 api/distributedcontext: add Map unit tests (#270)
- also update with new module dir
2019-11-02 14:46:13 -07:00
Gustavo Silva Paiva
8b061a2102 Improve Value.Emit() with strconv. (#262)
* use strconv instead of fmt.Sprint

* rollback float it has no significant improvement on time and worse allocated bytes.

* change int32 and uint32 to separate cases.
2019-11-01 12:06:33 -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
Krzesimir Nowak
cb1e6f59f6 document api/core and api/key packages (#263) 2019-10-31 14:55:51 -07:00
Cheng-Lung Sung
903908ddad add unit test (key.String) to key api (#260)
follow issue #51
2019-10-31 09:31:46 -07:00
Joshua MacDonald
8862436993 Support named Meters, use global package (#258)
* Support named Meters, use global package

* Comments/typos fixed
2019-10-30 23:35:02 -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
Krzesimir Nowak
25e97e56a4 move mock tracer to internal/metric (#259)
* export noop meter

* move mock meter to internal/metric package
2019-10-30 12:59:34 -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
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