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

70 Commits

Author SHA1 Message Date
Joshua MacDonald
1fab21ddbf
Support use of synchronous instruments in async callbacks (#725)
* Support use of synchronous instruments in async callbacks

* Add a test
2020-05-19 21:33:10 -07:00
Joshua MacDonald
21d094af43
Refactor the api/metrics push controller; add CheckpointSet synchronization (#737)
* Checkpoint

* Finish tests

* Checkpoint

* Checkpoint (builds)

* Checkpoint + RWMutex interface

* Comments

* Remove commitLock

* Apply feedback
2020-05-18 18:37:41 -07:00
Joshua MacDonald
69da3056f2
Move Resource into the metric export Record (#739)
* Checkpoint

* Tests pass
2020-05-18 17:44:28 -07:00
Joshua MacDonald
ee3c9ed1a5
Rename Observer to ValueObserver (#734)
* Observer -> ValueObserver

* Move wrappers into async.go
2020-05-18 11:03:43 -07:00
Joshua MacDonald
76baa9cc7a
Remove the push controller named Meter map (#738)
* Remove the push controller named Meter map

* Checkpoint

* Remove Provider impls

* Add a test

* Expose Provider() getter instead of implementing the interface
2020-05-18 10:48:58 -07:00
Joshua MacDonald
2dee67652a
Histogram aggregator initial state (fix #735) (#736)
* Add a test

* Add comments and description options

* Another test

* Undo buffer re-use

* Mod tidy

* Precommit

* Again

* Copyright

* Undo rename
2020-05-18 09:44:33 -07:00
Joshua MacDonald
6bc14ffd2c
Replace Measure instrument by ValueRecorder instrument (#732)
* Measure->Value recorder and cleanups re: measure

* More edits

* More edits

* Feedback
2020-05-15 22:11:12 -07:00
Tyler Yahn
ce266f9656
Prepare for releasing v0.5.0 2020-05-13 17:11:23 -07: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
Joshua MacDonald
64afb05e53
Metric SDK renames to align with draft SDK spec (#710)
* Replace batcher w/ integrator; rename ungrouped to simple

* SDK -> Accumulator

* Cleamup

* Address feedback
2020-05-11 10:23:06 -07:00
Chen Yixiao
f0855b7d08
Move Number to api/metric package (#706)
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-05-10 23:44:42 -07:00
Liz Fong-Jones
bafdd1b138
Merge branch 'master' into zipkin_mock_addr 2020-05-05 14:08:30 -04:00
tensorchen
375083a085 Update mockZipkin addr from :0 to 127.0.0.1:0 2020-05-06 01:50:00 +08:00
tensorchen
bae2298a36 Rename trace.TraceID & trace.TraceIDFromHex 2020-05-03 13:48:38 +08:00
tensorchen
c6c155de6f Move SpanContext from core package into trace 2020-05-02 20:17:11 +08:00
Joshua MacDonald
4c9a29d2d7
Add a key benchmark, use reflection in key.Infer() (#679)
* Add a key benchmark, optimize SDK SetAttribute

* Use reflect in key.Infer

* Move to separate benchmark file; remove pointer test; remove dead comment

* Run go mod tidy

* Add license header

* Use the reflect scalar accessors

Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
2020-04-30 13:06:00 -07:00
Igor German
5863f8562b
Add jaeger option that allows to specify custom http client (#671) 2020-04-28 14:35:34 -04:00
Rahul Patel
1de7f68bfc
Prepare for releasing v0.4.3 (#664) 2020-04-24 15:24:00 -07:00
Joshua MacDonald
3008c1bf02
Pass Resources through the metrics export pipeline (#659) 2020-04-24 09:44:21 -07:00
Joshua MacDonald
cd1be0e698
Use the label.Set.Equivalent value instead of an encoding in the batcher (#658) 2020-04-24 09:32:49 -07:00
Joshua MacDonald
0bb12d9b1b
New api/label package, common label set impl (#651)
* New label set API

* Checkpoint

* Remove label.Labels interface

* Fix trace

* Remove label storage

* Restore metric_test.go

* Tidy tests

* More comments

* More comments

* Same changes as 654

* Checkpoint

* Fix batch labels

* Avoid Resource.Attributes() where possible

* Update comments and restore order in resource.go

* From feedback

* From feedback

* Move iterator_test & feedback

* Strenghten the label.Set test

* Feedback on typos

* Fix the set test per @krnowak

* Nit
2020-04-23 12:10:58 -07:00
Joshua MacDonald
acb350b8f3
Support JSON marshal of Resources (#654)
* Support JSON marshal of Resources

* Add a test

* Another test

* Fix arch bug

* Fix other test
2020-04-22 14:32:58 -07:00
NiaoGe
d20fc722f2
Fix typo trace.Exporter to trace.SpanSyncer (#653)
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-21 20:34:53 -07:00
Milad
ddad4d45ae
trace exporter: using type names for return values (#648)
* trace exporter: using type names for return values

* Update jaeger.go

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-21 20:30:57 -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
Oleg Shatnyuk
cf7c4e5328
fix zipkin without local endpoint with service name (#644) 2020-04-18 23:02:29 -07:00
Tyler Yahn
ebc245b388
Batch Metrics Exported From the OTLP Exporter (#626)
* Add check to sum transform for unknown NumberKind

* Initial batching

* Move CheckpointSet transform to internal package

* Add tests for the Exporter Export method

Check batching and general output exporter ResourceMetrics are correct.

* Check errors in tests

* Apply suggestions from code review

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

* Use var instead of multiple calls for group IDs

* Fix otlp metric test reporting

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-04-15 12:04:44 -07:00
Joshua MacDonald
a8f7b3247b
Remove WithKeys() option, defaultkeys batcher (#639) 2020-04-14 16:07:11 -07:00
Oncilla
bcb8b645ab
prometheus: add error wrapping (#631)
* prometheus: add error wrapping

This PR adds error wrapping to the prometheus exporter.
The added context should make it easier to follow the error path.

This is a follow-up to #622

* feedback
2020-04-13 09:48:20 -07:00
Tyler Yahn
0a9e861549
Update the OTLP exporter batching of traces (#623)
Instead of batching based on the Resource pointer which is not guaranteed
to uniquely identify common Resources, use the `String` method which is.

Renames the external test package to be identified as the integration
testing. This testing structure (the mock exporter) batches exported
resources transmitted from the resource. This is needed as there is no
guarantees that a batch will be exported in a single payload, therefore,
it is not an ideal place to add resource batch testing for the exporter
itself.

Add unit tests to ensure the Exporter is correctly batching spans by
resource.
2020-04-08 16:49:53 -07:00
Tyler Yahn
856aad92ef
Update OTLP SpanData transform (#614)
* Update OTLP SpanData transform

The ParentSpanId needs to be empty for root spans according to the OTLP
[docs](6c2a86ed2f/gen/go/trace/v1/trace.pb.go (L284-L286)).
This updates the SpanData transform function to not add the ParentSpanID
if it is not a valid span ID (which includes if it is the nil span ID
used for an unset ID).

Additionally, this adds a test to prevent regression.

* Simplify test to just check parent span ID transform

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-07 15:14:23 -07:00
Oncilla
6005d01854
prometheus: check return value from CheckpointSet.ForEach (#622)
This PR modifies prometheus.Collect to reflect the change introduced
by #557.

The `export{Counter,Histogram,LastValue,Summary}` methods now all return
an error instead of calling the error callback directly.
The callback is now only called on the returned error from `ForEach`.

fixes #563

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-07 10:58:49 -07:00
Owais Lone
446727b90d
Updated default port for OTLP exporter (#611)
OpenCensus used `55678` as the default. OTLP used `55680`. This commit fixes the incorrect default port specified for the OTLP exporter.
2020-04-02 10:04:57 -07:00
Oncilla
8ef02a61aa
prometheus: add histogram support to exporter (#601)
This PR adds histogram support to the prometheus exporter.

- Adds a new aggregator selector that returns a histogram for `MeasureKind`.
  The selector can be constructed using `simple.NewWithHistogramMeasure`
- Adds support for histogram aggregators in prometheus collect method.

With this PR, the default selector is changed to use histograms.

In order to support the prometheus histogram, the `aggregator.Histogram`
interface is extended with the `Sum` method.

fixes #487

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-01 14:36:37 -07:00
Rahul Patel
857e80c270
Prepare for releasing v0.4.2 (#608) 2020-03-31 12:57:37 -07:00
Bogdan Drutu
1f6ffa9ed7
Fix time conversion from internal to otlp (#606)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-03-31 10:32:01 -07:00
Liz Fong-Jones
02b6be15e0
Pre release v0.4.1 (#605)
* fix release script for ubuntu

* Prepare for releasing v0.4.1
2020-03-31 13:02:15 -04:00
Rahul Patel
57d5f55600
Prepare for releasing v0.4.0 (#603)
* Prepare for releasing v0.4.0

* update README.

* remove target date for released features.
2020-03-30 14:33:27 -07:00
Andrew Hsu
5d346a4190
update godoc.org links to pkg.go.dev (#602)
Banner at the top of godoc.org pages are already asking users to
redirect to pkg.go.dev as mentioned in blog post
https://blog.golang.org/pkg.go.dev-2020

Signed-off-by: Andrew Hsu <xuzuan@gmail.com>
2020-03-30 15:40:38 -04:00
Joshua MacDonald
e8546e3bc5
Remove Labelset (#595)
* Remove LabelSet frmo api/metric

* SDK tests pass

* Restore benchmarks

* All tests pass

* Remove all mentions of LabelSet

* Test RecordBatch

* Batch test

* Improves benchmark (some)

* Move the benchmark to match HEAD

* Align labels for GOARCH=386

* Add alignment test

* Disable the stress test fo GOARCH=386

* Fix bug

* Move atomic fields into their own file

* Add a TODO

* Comments

* Remove metric.Labels(...)

* FTB

Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
2020-03-27 14:06:48 -07:00
Tyler Yahn
e7a9ba1e2e
Remove unneeded allocation on empty labels (#597)
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
2020-03-25 20:17:43 -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
c9dcc1be28
Move span transforms of the OTLP exporter to internal (#593)
* Move span transforms of the OTLP exporter to internal

Breakup and move functionality of the `transform_spans.go` file into
appropriate files in the `internal/transform` sub-package. This is in
preparation of using some of the overlapping functionality to implement
Resource support in the metric side of the exporter.

Adds more specific unit tests for some of the functionality transferred.
The tests removed used the exporter as a processing engine and the
replacement tests do not do this. The test found in the `oltp_test.go`
seem to comprehensively cover this type of test.

Include Link `Name` in the exporter span link and adds a test to check
for this.

Resolves #527

* Apply suggestions from code review

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

* Fix SpanData doc

* Consolidate span comparison

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-03-25 09:04:31 -07:00
Joshua MacDonald
4c69dd3234
Remove dogstatsd and statsd support (#591) 2020-03-24 11:00:59 -07:00
Krzesimir Nowak
d648712cf2
Kick label encoder out of sdk (#574)
* Temporarily opt-out export.Labels from label encoding stuff

* Stop passing label encoding stuff to export.Labels

* Drop label encoding stuff from SDK

* Dogstatd exporter does not need to implement label exporter anymore

* more dogstatd exporter fixes

* export labels get back to encoding stuff

in a lame way, but improvements are coming in following commits

* Get encoded labels through export.Labels

* make SDK to provide its own implementation of export.Labels

* drop dead code

* add noop label exporter

* make export simple labels immutable

* Move the default label encoder to export package

* Simplify the simple export labels a bit

* Reserve some label exporter IDs

* Document and shuffle the code a bit

* Prepare for bring the iterator benchmark test back

We can install a callback to the Batcher's process function - this is
the place where we can access the labels, and thus test the label
iterator.

* Bring back the iterator benchmarks

* Simplifications and docs

* Fix copyright to be consistent with the rest

* Fix typo

* Put reserved label encoder IDs into constants

We get fewer comments about magic numbers that way.

* Fix the label encoder as label exporter thinko
2020-03-24 09:30:12 -07:00
Rahul Patel
6f881b4400
update to proto v0.3.0 (#588) 2020-03-24 08:45:07 -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
Rahul Patel
a1c243965e
Prepare for releasing v0.3.0 (#578) 2020-03-21 14:06:39 -07:00
Krzesimir Nowak
a01f63bec4
Replace Ordered with an iterator in export.Labels. (#567)
* Do not expose a slice of labels in export.Record

This is really an inconvenient implementation detail leak - we may
want to store labels in a different way. Replace it with an iterator -
it does not force us to use slice of key values as a storage in the
long run.

* Add Len to LabelIterator

It may come in handy in several situations, where we don't have access
to export.Labels object, but only to the label iterator.

* Use reflect value label iterator for the fixed labels

* add reset operation to iterator

Makes my life easier when writing a benchmark. Might also be an
alternative to cloning the iterator.

* Add benchmarks for iterators

* Add import comment

* Add clone operation to label iterator

* Move iterator tests to a separate package

* Add tests for cloning iterators

* Pass label iterator to export labels

* Use non-addressable array reflect values

By not using the value created by `reflect.New()`, but rather by
`reflect.ValueOf()`, we get a non-addressable array in the value,
which does not infer an allocation cost when getting an element from
the array.

* Drop zero iterator

This can be substituted by a reflect value iterator that goes over a
value with a zero-sized array.

* Add a simple iterator that implements label iterator

In the long run this will completely replace the LabelIterator
interface.

* Replace reflect value iterator with simple iterator

* Pass label storage to new export labels, not label iterator

* Drop label iterator interface, rename storage iterator to label iterator

* Drop clone operation from iterator

It's a leftover from interface times and now it's pointless - the
iterator is a simple struct, so cloning it is a simple copy.

* Drop Reset from label iterator

The sole existence of Reset was actually for benchmarking convenience.
Now we can just copy the iterator cheaply, so a need for Reset is no
more.

* Drop noop iterator tests

* Move back iterator tests to export package

* Eagerly get the reflect value of ordered labels

So we won't get into problems when several goroutines want to iterate
the same labels at the same time. Not sure if this would be a big
deal, since every goroutine would compute the same reflect.Value, but
concurrent write to the same memory is bad anyway. And it doesn't cost
us any extra allocations anyway.

* Replace NewSliceLabelIterator() with a method of LabelSlice

* Add some documentation

* Documentation fixes
2020-03-19 15:01:34 -07:00