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
Anthony Mirabella
0aadfb27bc
Prepare release v0.16.0 (#1464)
* Prepare for releasing v0.16.0

* Prepare CHANGELOG for v0.16.0 release

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-01-13 20:44:06 -05:00
Joshua MacDonald
207587b6ab
Metric histogram aggregator: Swap in SynchronizedMove to avoid allocations (#1435)
* Move emptyState() allocations outside lock

* Add more testing

* Re-comment; add CHANGELOG

* Add CHANGELOG PR number

* Update CHANGELOG.md

Co-authored-by: Sam Xie <xsambundy@gmail.com>

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
Co-authored-by: Sam Xie <xsambundy@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-01-13 20:21:28 -05:00
Sam Xie
c29c6fd1ad
Shutdown underlying span exporter while shutting down BatchSpanProcessor (#1443)
* Fix BatchSpanProcessor does not shutdown underlying span exporter

* Update CHANGELOG

* Fix tests

* Update CHANGELOG.md
2021-01-13 20:14:03 -05:00
Joshua MacDonald
dfece3d2b9
Combine the Push and Pull metric controllers (#1378)
* Push->basic

* Repackage

* Rename away from push

* Make exporter optional; export from a separate goroutine

* Move pull_test into controller_test

* Precommit pass

* New OTLP/Prom example

* Precommit

* Fix the example

* Shorten the example

* Test starting controller w/o exporter

* Test export timeout

* Remove ancient example & lint

* go.mod revert & tidy

* Comments

* Tidy a diff

* Tidy a diff

* Move export kind selector in the new example

* Split this test into its original parts

* Reduce diff size

* Changelog

* Remove extra Add/Done pair

* Remove unused stopCh param; document the Stop behavior

* Typo

* Use ctx

* Missed v0.15

* Apply PR feedback

* Precommit pass

* 0.14 -> 0.15 in new file

* Remove diff chunk markers

* Fix OTLP example

* Upstream

* dashpole comments

* aneurysm9 feedback

* Tidy go.sum
2021-01-13 17:07:44 -05:00
Joshua MacDonald
49f699d657
Remove Quantile aggregation, DDSketch aggregator; add Exact timestamps (#1412)
* Remove quantile definition

* Complete removal of Quantile-related function

* Comment in selector/simple/simple.go

* Remove 'quantile' in mmsc

* Rename array->exact

* Update changelog

* Add PR number

* Rename exact benchmark

* New test for exact timestamps

* Add timestamp tests

* More test

* From feedback

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Samples->Points

* Rename

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-12 10:19:13 -08:00
Eundoo Song
9c949411ce
Rename internal/testing to internal/internaltest (#1449) 2021-01-12 08:56:16 -08:00
Andrei Ozerov
40f1c0039d
Add Tracestate into the SamplingResult struct (#1432)
* Add Tracestate into the SamplingResult struct

Add `trace.Tracestate` field into the SDK `trace.SamplingResult` struct.

Use ParentContext from SamplingParameters to return Tracestate in
`traceIDRatioSampler`, `alwaysOnSampler` and `alwaysOffSampler`.

Add a new test to check that Tracestate is passed.

* Updated CHANGELOG.md for #1432 PR

Added changes description for #1432.

* Update sdk/trace/sampling_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-06 11:09:48 -08:00
Joshua MacDonald
fe9d1f7ec5
Use uint64 Count consistently in metric aggregation (#1430)
* Use uint64 Count consistently

* Number
2021-01-05 23:17:20 -08:00
Matej Gera
439cd31389
Add TraceState to SpanContext in API (#1340)
* Add TraceState to API

* Add tests for TraceState

* Update related tests

- stdout exporter test
- SDK test

* Update OTLP span transform

* Update CHANGELOG

* Change TraceState to struct instead of pointer

- Adjust tests for trace API
- Adjust adjacent parts of codebase (test utils, SDK etc.)

* Add methods to assert equality

- for type SpanContext, if SpanID, TraceID, TraceFlag and TraceState are
equal
- for type TraceState, if entries of both respective trace states are
equal

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Copy values for new TraceState, adjust tests

* Use IsEqualWith in remaining tests instead of assertion func

* Further feedback, minor improvements

- Move IsEqualWith method to be only in test package
- Minor improvements, typos etc.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-21 13:11:48 -08:00
Eundoo Song
f11a86f780
Fix typo in comment (#1402) 2020-12-15 08:06:58 -08:00
Krzesimir Nowak
af114baf6b
Call otel.Handle with non-nil errors (#1384)
* Call otel.Handle with non-nil errors

That's what normally happens in other call sites. Those two didn't
check it, but passed the "error" to Handle. The default, delegating
implementation of ErrorHandler was printing the error unconditionally,
which resulted in pointless lines like `2020/12/07 19:51:28 <nil>` in
demos, for example.

* Add tests

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-10 21:28:41 -08:00
Johannes Liebermann
c3c4273ecc
Add RO/RW span interfaces (#1360)
* Store span data directly in the span

- Nesting only some of a span's data in a `data` field (with the rest
  of the data living direclty in the `span` struct) is confusing.
- export.SpanData is meant to be an immutable *snapshot* of a span,
  not the "authoritative" state of the span.
- Refactor attributesMap.toSpanData into toKeyValue and make it
  return a []label.KeyValue which is clearer than modifying a struct
  passed to the function.
- Read droppedCount from the attributesMap as a separate operation
  instead of setting it from within attributesMap.toSpanData.
- Set a span's end time in the span itself rather than in the
  SpanData to allow reading the span's end time after a span has
  ended.
- Set a span's end time as soon as possible within span.End so that
  we don't influence the span's end time with operations such as
  fetching span processors and generating span data.
- Remove error handling for uninitialized spans. This check seems to
  be necessary only because we used to have an *export.SpanData field
  which could be nil. Now that we no longer have this field I think we
  can safely remove the check. The error isn't used anywhere else so
  remove it, too.

* Store parent as trace.SpanContext

The spec requires that the parent field of a Span be a Span, a
SpanContext or null.

Rather than extracting the parent's span ID from the trace.SpanContext
which we get from the tracer, store the trace.SpanContext as is and
explicitly extract the parent's span ID where necessary.

* Add ReadOnlySpan interface

Use this interface instead of export.SpanData in places where reading
information from a span is necessary. Use export.SpanData only when
exporting spans.

* Add ReadWriteSpan interface

Use this interface instead of export.SpanData in places where it is
necessary to read information from a span and write to it at the same
time.

* Rename export.SpanData to SpanSnapshot

SpanSnapshot represents the nature of this type as well as its
intended use more accurately.

Clarify the purpose of SpanSnapshot in the docs and emphasize what
should and should not be done with it.

* Rephrase attributesMap doc comment

"refreshes" is wrong for plural ("updates").

* Refactor span.End()

- Improve accuracy of span duration. Record span end time ASAP. We
  want to measure a user operation as accurately as possible, which
  means we want to mark the end time of a span as soon as possible
  after span.End() is called. Any operations we do inside span.End()
  before storing the end time affect the total duration of the span,
  and although these operations are rather fast at the moment they
  still seem to affect the duration of the span by "artificially"
  adding time between the start and end timestamps. This is relevant
  only in cases where the end time isn't explicitly specified.
- Remove redundant idempotence check. Now that IsRecording() is based
  on the value of span.endTime, IsRecording() will always return
  false after span.End() had been called because span.endTime won't
  be zero. This means we no longer need span.endOnce.
- Improve TestEndSpanTwice so that it also ensures subsequent calls
  to span.End() don't modify the span's end time.

* Update changelog

Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-10 21:15:44 -08:00
Tyler Yahn
61e07a0d62
Release v0.15.0 (#1392) 2020-12-10 21:00:59 -08:00
Joshua MacDonald
eb28005e2f
Metric Accumulator fix for SumObservers (#1381)
* Let SynchronizedMove(nil) reset and discard

* Add common test for SynchronizedMove(nil)

* End-to-end test for the Processor and SumObserver

* Implement SynchronizedMove(nil) six ways

* Lint

* Changelog

* Test no reset for wrong aggregator type; Fix four Aggregators

* Cleanup

* imports

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-10 18:13:08 -08:00
Anthony Mirabella
970755bd08
Enable support for externally-defined ID generators (#1363)
* Enable support for externally-defined ID generators

* Moved the SDK's `internal.IDGenerator` interface to the `sdk/trace`
package.
* Added `trace.WithIDGenerator()` `TracerProviderOption`.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Update CHANGELOG.md with PR info

* Address PR feedback:

* Fix IDGenerator godoc comment
* rename type defaultIDGenerator to randomIDGenerator
* rename defIDGenerator() to defaultIDGenerator()

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Rework trace.IDGenerator interface

* NewTraceID() -> NewIDs(ctx)
** Returns both TraceID and SpanID
* NewSpanID() -> NewSpanID(ctx, traceID)
** Returns only SpanID, has access to TraceID
* Both methods now receive a context, from which they may extract
information
* startSpanInternal() updated to receive a context to pass to the ID
generator

* Drop outdated comment from docblock

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-12-09 20:30:32 -05:00
dependabot[bot]
e1ff2d15cf
Bump github.com/google/go-cmp from 0.5.3 to 0.5.4 (#1374)
* Bump github.com/google/go-cmp from 0.5.3 to 0.5.4

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.3...v0.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-30 10:31:41 -08:00
luckyxiaoqiang
5d0372dd2e
Fix typo in comment (#1377) 2020-11-30 08:54:38 -08:00
Tyler Yahn
575df22b79
Release v0.14.0 (#1355)
* Prepare for releasing v0.14.0

* Update changelog
2020-11-20 08:36:54 -08:00
Daniil Rutskiy
2c2f9852fe
Add missing tests for attributesMap (#1337)
* Rename sdk/trace/attributesMap.go -> sdk/trace/attributesmap.go

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Add missing tests for attributesMap

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Add missing license header

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Delete underscores in test names

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Tests clean up

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>
2020-11-18 19:15:26 -05:00
Justin Foote
3207770f88
Set telemetry.sdk.name resource attribute to "opentelemetry" (#1332)
* Set telemetry.sdk.name resource attribute to "opentelemetry"

* Update config_test.go to correct `telemetry.sdk.name`

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 10:00:59 -08:00
Krzesimir Nowak
3d6e8b5078
Move Version function and code from global to toplevel (#1330)
* Move global code to toplevel package

* Move version function to toplevel package

* Update changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 09:30:54 -08:00
dependabot[bot]
20c78fed0a
Bump github.com/google/go-cmp from 0.5.2 to 0.5.3 (#1339)
* Bump github.com/google/go-cmp from 0.5.2 to 0.5.3

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.2...v0.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 09:11:53 -08:00
Johannes Liebermann
070b657c21
Add parent context to SpanProcessor.OnStart (#1333)
* Add parent context to SpanProcessor.OnStart

The spec requires doing so. Right now SpanProcessor implementations
aren't doing anything with this argument.

* Update changelog

* Fix typo in test name
2020-11-16 11:45:49 -05:00
Krzesimir Nowak
75d4911c95
Move metric code to a separate package (#1321)
* Move metrics code to metric package

* Update changelog
2020-11-12 07:28:32 -08:00
Krzesimir Nowak
386331a472
Prepare to move metrics code to separate subpackage (#1316)
* Move registry package under metric

* Move Number type to the metric/number subpackage

This also renames NumberKind type to Kind.

* Update changelog

* Drop outdated comment
2020-11-11 07:24:12 -08:00
Joshua MacDonald
f9984f2d4e
Support configurable AggregationTemporality in exporters; add OTLP missing sum point temporality/monotonic fields (#1296)
* Restructure ExportKindSelector helpers; eliminate PassThroughExportKind; add StatelessExportKindSelector()

* WithExportKindSelector(); Additional testing

* Changelog update

* Test the new selectors

* From review feedback

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-10 07:44:42 -08:00
alrex
3a06b393b9
Update span collection limits to 1000 (#1318)
* set collection limit to 1000

* update changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-10 07:40:01 -08:00
Tyler Yahn
a354c026b6
Clean up SDK span field docs (#1312)
Remove cruft about spanStore.

Update documentation about how span.mu is used (related to #1311).

Reformat to conform with idiomatic field documentation.
2020-11-09 10:40:02 -08:00
Krzesimir Nowak
3268501910
Move tracing code to trace package (#1307)
* Move tracing code to trace package

* Update changelog
2020-11-06 17:13:31 -05:00
José Carlos Chávez
e22a48de5a
chore: adds vanity import for files that don't have it. (#1297) 2020-11-04 09:10:58 -08:00
Joshua MacDonald
187adeb251
Change resource.New() to use functional options; add builtin attributes for (host.*, telemetry.sdk.*) (#1235)
* Add a resource.Configure() with functional options

* Add a changelog

* Add tests for builtin resources

* Rename to WithoutBuiltin

* Add new test; restore environment after tests

* Apply feedback

* Apply suggestions from code review

❤️

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Comment edits

* Rename New, former method NewFromAttributes

* NewFromAttributes->NewWithAttributes

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-31 11:16:55 -07:00
Tyler Yahn
034195692a
Update README and documentation to better communicate pre-GA state (#1281)
* Update README

Move project status to top of project documentation and add explicit
warnings that this project may introduce breaking changes.

* Add disclaimer to public packages docs

* Use explicit warning in README
2020-10-29 09:23:13 -07:00
Ilya Kaznacheev
a6b31e0da1
Update SpanProcessor Shutdown with context and error (#1264)
* 1232: update SpanProcessor Shutdown with context and error

* 1232: add changelog info

* 1232: fix CI error, rm commented code

* 1232: fix CI unhandled error

* 1232: Done commit properly

* Add shutdown error handling

* Merge branch 'master' into update-span-processor

* Revert now unneeded context declaration move

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2020-10-26 19:06:55 -07:00
Hui Kang
d75ccbb378
Add a Shutdown method to sdk TraceProvider (#1227)
* Add a Shutdown method to api TraceProvider

- sdktraceprovider shutdown span processors
- In examples, replace processosr shutdown with
  traceprovider's shutdown

Signed-off-by: Hui Kang <kangh@us.ibm.com>

* remove shutdown in the api provider interface

* Add context in parameter and return error

* handle error in shutdown

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-26 09:20:49 -07:00
Tyler Yahn
d6dd84f6fa
Move the otel/api/global package to otel/global (#1262)
* Move otel/api/global to otel/global

* Update global package references

* Add changes to CHANGELOG
2020-10-17 10:03:48 -07:00
Tyler Yahn
818c7b14b3
Move metric api package into otel (#1252)
* Update metric Kind to InstrumentKind

* Update all the other modules with Kind rename

* Update metric Descriptor with instrument Kind rename

* Update other modules with Descriptor method rename

* Update OTLP exporter test field name

* Rename kind filenames

* Add changes to CHANGELOG

* Fix documentation for Grouping and PrecomputedSum

* Rename meter.go to metric.go

* Move descriptor.go into metric.go

* Move must.go into metric.go

* Move instruments into metric_instrument.go

* Rename metric api_test.go to metric_test.go

* Move instrumentkind_test.go into metric_test.go

* Rename sdkapi.go metric_sdkapi.go

* Move api/metric into otel

* Update to use moved packages

* Rename otel.go to error_handler.go

* Add changes to CHANGELOG

* Fix merge conflict resolution error
2020-10-17 09:48:21 -07:00
Tyler Yahn
ec300b28ad
Update Span API event methods (#1254)
* Update Span API event methods

Remove the context argument from the event methods. It is unused and can
be added back in as a passed option if needed in the future.

Update AddEvent to accept a required name and a set of options. These
options are the new EventOption type that can be used to configure a
SpanConfig Timestamp and Attributes.

Remove the AddEventWithTimestamp method as it is redundant to calling
AddEvent with a WithTimestamp option.

Update RecordError to also accept the EventOptions.

* Add changes to CHANGELOG

* Add LifeCycleOption

Use the LifeCycleOption to encapsulate the options passed to a span for
life cycle events.
2020-10-16 08:09:27 -07:00
Tyler Yahn
396dd6053c
Rename Kind from the api/metric package (#1240)
* Update metric Kind to InstrumentKind

* Update all the other modules with Kind rename

* Update metric Descriptor with instrument Kind rename

* Update other modules with Descriptor method rename

* Update OTLP exporter test field name

* Rename kind filenames

* Add changes to CHANGELOG

* Fix documentation for Grouping and PrecomputedSum
2020-10-13 07:55:31 -07:00
Tyler Yahn
65044a118b
Move api/apitest into the otel/oteltest package (#1241)
* Move the apitest package into oteltest

* Add documentation to exported func and type

* Add changes to CHANGELOG

* Update move in other modules
2020-10-12 08:47:41 -07:00
Joshua MacDonald
f60f51d0a2
Move asyncronous metrics state helper out of apimetric/metrictes (#1234) 2020-10-11 14:46:29 -04:00
Paul Osman
02cd123542
Call sampler on local child spans. (#1233)
* Call sampler on local child spans.

* Update CHANGELOG.md

* Adding a test for calling the sampler on local child spans

* Add clarifying comment to test
2020-10-09 18:48:34 -04:00
Tyler Yahn
27c84d689d
Move trace api package into otel (#1229)
* Move trace API to otel

* Move tracetest to oteltest

* Update package documentation

* Remove old api/trace package

* Lint

* Add changes to CHANGELOG

* Add tests for rest of trace API

* Apply suggestions from code review

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Documentation fixes

Includes resolutions for review issues.

* Correct CHANGELOG post release

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-10-08 19:58:56 -07:00
Anthony Mirabella
9ebca887f0
Pre release v0.13.0 (#1231)
* Prepare for releasing v0.13.0

* Update CHANGELOG.md for v0.13.0 release
2020-10-08 18:18:50 -04:00
Tyler Yahn
577b21745b
Update codes to match specification (#1214)
* Update codes to match specification

* Add changes to changelog

* go mod tidy

* Add unit tests for codes

* Update SetStatus methods to only filter Unset

* Update apitest code being tested
2020-10-05 11:36:03 -07:00
Stanley Nguyen
de50711fcc
feat(span): remove SetAttribute method (#1216)
* feat(span): remove SetAttribute method

* Update CHANGELOG.md

Revert markdown lint changes and unify the `Removed` section.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-02 14:41:15 -07:00
ET
04297f4d04
Enable exporting Histogram aggregation to OTLP metric (#1209)
* Add Count() to Histogram interface

* Fix copy/pasted comment for Count() interface

* Implement Histogram conversion to OTLP protobuf

* Add CHANGELOG message

* Filled in PR # for Changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-28 17:58:15 -07:00
huikang
a69f8fbe7a
Add integration tests for span processor ordering (#1208)
- Test by span attributes added by processors in the order
  they were registered.

Signed-off-by: Hui Kang <kangh@us.ibm.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-28 09:29:14 -07:00
Joshua MacDonald
3a9f5fe15f
Test benchmarks in precommit (#1207)
* Fix the metric SDK benchmarks

* Test the benchmarks in precommit
2020-09-25 13:27:03 -07:00
Anthony Mirabella
0b348c345f
Prepare v0.12.0 release (#1205)
* Prepare for releasing v0.12.0

* Update CHANGELOG.md for v0.12.0 release

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-24 19:01:48 -04:00
Joshua MacDonald
8c3cc43992
Use LastValue by default for ValueObserver instruments (#1165)
* Use LastValue by default for ValueObserver instruments

* Update test

* Update test with feedback

* Update fix

* Update changelog

* sum->scalar

* Tests pass

* Add a test

* Undo incorrect proto adds

* Restore origin protos

* Restore

* Upstream

* Add more tests

* Precommit

* Typo

* ore test feedback
2020-09-24 18:30:55 -04:00
Tyler Yahn
1e72b51b31
Add example test for a custom SpanProcessor (#1196)
* Add example test for a custom SpanProcessor

* Use existing test framework exporter

* Update example

* Add fixes from upstream
2020-09-24 18:20:18 -04:00
huikang
b97533a74b
Register/unregister in the fixed order (#1198)
- change the processors' map to array
- increase test coverage

Signed-off-by: Hui Kang <kangh@us.ibm.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-24 11:43:23 -07:00
Tyler Yahn
7d71867644
Rename *Provider names (#1190)
* Rename *Provider names

There is overlap in naming with MeterProviders and TracerProviders. This
is means the specification is not implemented and these types can not
exist in the same package (#1179). This makes each type and related
functions and types explicit.

* Add changes to CHANGELOG
2020-09-23 18:16:13 -04:00
ET
e7e1dce982
Update sampling decision names (#1192)
* Rename SamplingDecision enum values

As prescribed in
https://github.com/open-telemetry/opentelemetry-specification/pull/938
and https://github.com/open-telemetry/opentelemetry-specification/pull/956.

* Include in Changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-22 10:34:43 -07:00
Anthony Mirabella
b9357d7ee2
Remove flaky BatchSpanProcessor.ForceFlush() test (#1189)
It is unreliable with no clear good way to make it reliable.  The
ForceFlush() method is a simple passthrough to bsp.exportSpans() and the
existing tests of that method should suffice.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-21 13:30:49 -07:00
Anthony Mirabella
995be31f42
Add ForceFlush() method to SpanProcessor interface (#1166)
* Add ForceFlush() method to SpanProcessor interface

* Add a stub implementation to SimpleSpanProcessor
* Add a working implementation to BatchSpanProcessor

* add CHANGELOG.md entry

* Eliminate sleep from BatchSpanProcessor.ForceFlush() test

* Generating test spans serially should reduce test flakiness
2020-09-20 13:35:44 -04:00
Matej Gera
a12224a454
Ensure exported interfaces have named method parameters (#1172)
* Ensure exported interface types have named arguments

* Update Styling Guide

* update CHANGELOG
2020-09-16 09:09:45 -07:00
Matej Gera
1f7c220652
Don't consider unset env var to be an error during resource detection (#1170)
* Don't consider unset env var an error during detection

* update CHANGELOG
2020-09-14 12:08:05 -04:00
Matej Gera
0041e2d26e
Rename ParentOrElse sampler to ParentBased and enhance it according to the spec (#1153)
* Rename ParentOrElse to ParentBased and enhance it according to the spec

- Renaming of type and sampler function
- Enhancing ParentBased with sampler options
- Set default samplers for each applicable parent-based case
- Adjust ShouldSample(...) func accordingly

* Adjust existing tests for ParentBased and add new ones

- add tests for ParentBased sampler options and description
- renaming in trace_test.go

* Update CHANGELOG.md

* PR feedback

- More clearer naming of structs; add comments where missing
- Adhere to the configuration style guide

* PR feedback - punctuation
2020-09-10 12:39:04 -07:00
JBD
9f4525847f
Convert XConfigure into constructors (#1155)
* Convert XConfigure into constructors

Previously, we discussed the possibility of converting
the config types into internal ones. But due to the
cyclic dependencies it introduces, we are only
converting XConfigure into constructors and document that
XConfig types are most likely are not going to be directly
used by developers.

In package documents, constructors will be nicely listed
under the config types and they won't be yet another
standalone symbol developers need to learn about.

Fixes #1130.

* Add the changes to the CHANGELOG
2020-09-10 15:15:17 -04:00
dependabot[bot]
9a4981cc67
Bump google.golang.org/grpc from 1.31.1 to 1.32.0 in /sdk (#1145)
* Bump google.golang.org/grpc from 1.31.1 to 1.32.0 in /sdk

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.31.1 to 1.32.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.31.1...v1.32.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aneurysm9 <Aneurysm9@users.noreply.github.com>
Co-authored-by: Anthony J Mirabella <a9@aneurysm9.com>
2020-09-09 13:25:27 -04:00
Tyler Yahn
422188a85f
Correct SDK trace Exporter interface (#1078)
* Update trace export interface

Move to conforming to the specification.

* Update documentation in export trace

* Update sdk trace provider to support new trace exporter

* Update SpanProcessors

Support the Provider changes and new trace exporter.

* Update the SDK to support the changes

* Update trace Provider to not return an error

* Update sdk with new Provider return

Also fix the testExporter ExportSpans method

* Update exporters with changes

* Update examples with changes

* Update Changelog

* Move error handling to end of shutdown

* Update exporter interface

Rename to SpanExporter to match specification. Add an error return value
to the Shutdown method based on feedback. Propagate these changes.

Remove the Stop method from the OTLP exporter to avoid confusion and
redundancy.

* Add test to check OTLP Shutdown honors context

* Add Jaeger exporter test for shutdown

* Fix race in Jaeger test

* Unify shutdown behavior and testing

* Update sdk/trace/simple_span_processor.go

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-09-09 10:19:03 -07:00
Tyler Yahn
d143b8fbf8
Unify API Span Start/End Options (#1108)
* Unify API Span Start/End Options

Replace both with `SpanOption`. Add a unified `SpanConfig` to match and
a `SpanConfigure` function to parse a `SpanConfig` from `SpanOption`s.

Update all the related options to use new `SpanOption`s.

* No non-zero SpanConfig defaults

The SDK uses an internal clock for the current time that cannot be use
if it does not know the time has not been set.

* Append attributes for WithAttributes

This preserves existing behavior.

* Add unit test for SpanConfigure

* Propagate changes

* Update append option documentation

* Update testing comments

* Move comments on guarantees to appropriate function

* Add documentation for SDK methods

Include SDK implementation specific information in the Tracer Start
method and Span End method.

* Add changes to Changelog

* Apply suggestions from code review

Co-authored-by: ET <evantorrie@users.noreply.github.com>

* Update the SpanKind comment in the  SpanConfig

Try for a less tautological comment.

Co-authored-by: ET <evantorrie@users.noreply.github.com>
2020-09-03 07:34:36 -07:00
ET
4d83d5b571
Change name of ProbabilitySampler to TraceIdRatioBased (#1115)
* Change name of ProbabilitySampler to TraceIdRatioBased

* Modify behavior to ignore parent span
* Add test for inclusivity property on TraceIdRatioBased sampler
* Modify tests in `trace_test.go` to reflect change in parent
  span behavior

* Add to CHANGELOG

* Satisfy golint

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-09-03 07:28:01 -07:00
Tyler Yahn
0fec28040d
Update trace API TracerOption (#1109)
* Update Tracer configuration.

Conform to API option design outlined in #536.

Add tests to validate new TracerConfigure function

Drop the `instrumentation` prefix.

* Stick with instrumentationVersion for now

* Propagate changes

* Add changes to Changelog
2020-09-02 07:20:52 -07:00
Andrew
1c3626e636
#872 Make metric test helpers public (#1040)
* Make metric test helpers public

* Move everything metric test related to api/metric/metrictest

* Unify metric measurement assertions

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-27 13:03:56 -07:00
dependabot[bot]
5d9daf0654
Bump google.golang.org/grpc from 1.31.0 to 1.31.1 in /sdk (#1105)
* Bump google.golang.org/grpc from 1.31.0 to 1.31.1 in /sdk

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.31.0 to 1.31.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.31.0...v1.31.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-27 12:19:01 -07:00
dependabot[bot]
737d81208b
Bump github.com/google/go-cmp from 0.5.1 to 0.5.2 (#1093)
* Bump github.com/google/go-cmp from 0.5.1 to 0.5.2

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.1...v0.5.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-26 11:39:41 -07:00
Anthony Mirabella
1f2eba2cdb
Release v0.11.0 (#1089)
* Prepare for releasing v0.11.0

* Update CHANGELOG.md to reflect scope of v0.11.0 release

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-24 22:38:37 -04:00
Thomas Meire
e17e3caec8 Remove the orphaned RegisterSpanProcessor and UnregisterSpanProcessor #1077 2020-08-22 12:38:13 +02:00
Tyler Yahn
f995380e58
Unify api/label and api/kv in new label package (#1060)
* Move `api/label` to `label`

* Move `api/kv` package contents into `label` package

* Unify label package name

* Move `api/internal/rawhelpers.go` to `internal`

* Propagate replacing `api/kv` with `label` pkg

* golint

* Fix over-aggressive change

* Update Changelog
2020-08-17 20:25:03 -07:00
ET
62d603f1a6
Build on newly released version of go, go 1.15 (#1064)
* Build on newly release version of go, go 1.15

Remove 1.13 build job per policy of supporting past two releases.

* String conversions in 1.15 require byte, rune or string.

Simply passing an integer now issues a warning.
2020-08-16 20:04:53 -07:00
Joshua MacDonald
5d1dd4ee23
Add a dimensionality-reducing metric Processor (#1057)
* Add a dimensionality-reducing metric processor

* Precommit

* Add package docs

* Remove dead code
2020-08-13 15:47:17 -07:00
Joshua MacDonald
1cdf4ee8e6
Create a export.Checkpointer API; refactor metric export pipeline test helpers (#1055)
* Add regexp filter in api/label, test

* Add regexp option to sdk.Config

* Return indistinct values only when keyRe != nil

* Filter in sdk

* Add an accumulator filter test

* SDK tests pass

* Precommit

* Undo set filters

* Backout related filter changes

* Add a new test

* Checkpoint

* Comments

* Comments in label.Set

* Lint

* Add Checkpointer

* Test refactor continues

* Refactor reducer test

* Checkpoint

* Update push_test

* Update pull controller

* Comment

* Remove pending PRs

* Remove exportertest pkg

* Revert basic changes

* Revert testing changes

* Restore processortest changes

* Precommit & comments

* Comments on pull semantics

* Comments

* Fix buggy test; incorrect expectation following error

* Finish this test

* Comments

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-13 13:12:32 -07:00
Joshua MacDonald
3a05cd9325
Change Metric Processor to merge multiple observations (#1024)
* Add regexp filter in api/label, test

* Add regexp option to sdk.Config

* Return indistinct values only when keyRe != nil

* Filter in sdk

* Add an accumulator filter test

* SDK tests pass

* Precommit

* Undo set filters

* Backout related filter changes

* Add a new test

* Fix build

* Apply suggestions from code review

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Update comments

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-11 10:25:47 -07:00
Tyler Yahn
8f9f2d84cf
Move OTLP to the OTLP exporter (#1050)
* Move proto to OTLP exporter

* Update OTLP exporter import of proto

* Use gogo protobuf

To stop using the deprecated github.com/golang/protobuf and match what
the collector is doing, switch to generating OTLP with the
github.com/gogo/protobuf/proto instead of
github.com/golang/protobuf/proto.

* Clean dependencies

Remove all protobuf dependencies from otel package and all of its
dependencies.

* Update CHANGELOG

* Clean OTLP exporter go mod

Remove submodule beforehand to avoid unneeded direct dependencies.

* Use default ref for GitHub workflow

* Update path that triggers proto gen action

* Correct license-check exclusion for OTLP

* Update commented location of the OTLP and code
2020-08-10 19:55:52 -07:00
Eundoo Song
4d0101ae12
Rename test packages (#1049)
* Rename processor/test to processortest

* Rename controller/test to controllertest

* Rename testharness to apitest

* Rename testtrace to tracetest
2020-08-10 13:35:15 -07:00
Tyler Yahn
efd4e3a383
Remove google.golang.org/grpc/codes dependency from API by adding an equivalent codes package (#1046)
* Add otel/codes package to replace google.golang.org/grpc/codes

* Replace google.golang.org/grpc/codes with otel/codes

* Update opentracing bridge to use OTel codes

* Update semconv to use OTel codes

* Update SDK to convert from OTel codes to gRPC

* go mod tidy

* Add change to CHANGELOG

* Fix word from feedback
2020-08-10 09:17:09 -07:00
Tyler Yahn
2dfa5e4fe1
Remove WithSpan method from Tracer interface (#1043)
* Remove WithSpan method from Tracer interface

Also remove implementation in SDK.

* Add panic event reporting to span End

* Update Changelog with changes

* Update CHANGELOG.md

* Update README.md

Fix code tabs

* Refactor span End

* Fix un-ended span from feedback.
2020-08-08 12:10:36 -07:00
Tyler Yahn
1dbc75bc2f
Clean stale indirect dependency requirements (#1041)
* Clean stale indirect dependency requirements

In the recent changes to isolate the main `otel` package there were many
indirect dependencies of the package that were removed, however, the
go.mod was not automatically cleaned of these. This removes those (and
similar ones in the otel-collector example and otel exporter) and prunes
the go.sum files accordingly.

* Run in a clean system to reproduce build
2020-08-07 09:05:22 -07:00
alrex
f88f5e4a1a
Renaming OTEL_RESOURCE_LABELS env var (#1042)
* Renaming OTEL_RESOURCE_LABELS env var

As per the specification here https://github.com/open-telemetry/opentelemetry-specification/pull/758

* update changelog
2020-08-06 17:05:11 -07:00
Tyler Yahn
799c178925
Make opentracing bridge into own Go module (#1038)
* Make opentracing bridge into own Go module

* Update dependabot config

* Clean dependencies of project

Now the bridge is a module, clean all upstream modules that no longer
implicitly depend on it.

* Update Changelog

* go mod tidy
2020-08-06 07:59:41 -07:00
Tyler Yahn
3780b80214
Remove the oterror package (#1026)
* Break up the oterror package

* Update use of ErrorHandler in project

* Update handler naming and comments
2020-08-05 10:31:42 -07:00
Anthony Mirabella
ae278e9186
Remove othttp and httptrace instrumentations that have moved to contrib (#1032) 2020-08-04 23:30:23 -07:00
dependabot[bot]
ea0720c05e
Bump google.golang.org/grpc from 1.30.0 to 1.31.0 (#1004)
* Bump google.golang.org/grpc from 1.30.0 to 1.31.0

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.30.0 to 1.31.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.30.0...v1.31.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
2020-08-04 14:08:36 -07:00
Bogdan Drutu
ac3fc6f6fd
Add Noop and InMemory SpanBatcher, help with testing integrations (#994)
* Add Noop and InMemory SpanBatcher, help with testing integrations

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update sdk/export/trace/tracetest/test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* More feedback

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-30 15:48:19 -07:00
Andy Schweig
5438916f62
Expose optional ResponseWriter interfaces. (#979)
http.ResponseWriters may implement additional interfaces
(http.CloseNotifier, http.Flusher, http.Hijacker, http.Pusher,
io.ReaderFrom) that get lost when the ResponseWriter is wrapped in
another object. This change uses the httpsnoop package to wrap the
ResponseWriter so that the resulting object implements any of the
optional interfaces that the original ResponseWriter implements as
well as using the replacement ResponseWriter methods that gather
information for tracing.
2020-07-30 10:30:47 -07:00
Tyler Yahn
fd61d2edec
Release v0.10.0 (#990)
* Prepare for releasing v0.10.0

* Update CHANGELOG

* Correct Changelog

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-07-30 08:57:24 -07:00
MitchellDumovic
12992106de
Change default Sampler to ParentOrElse(AlwaysOn) (#989)
* Change default Sampler to ParentOrElse(AlwaysOn)

* add note to changelog
2020-07-29 19:10:12 -07:00
Tyler Yahn
8fbaa9d432
Make the SDK into its own Go module (#985)
* Remove otel/sdk dependency from grpctrace

Use otel/trace/testtrace instead and cleanup testing code.

* Update httptrace to not depend on the SDK

Update testing to use api/trace/testtrace instead.

* Add changes to Changelog

* Make the SDK its own Go module

* Upgrade go.mod to 1.14 project wide

* go mod tidy
2020-07-29 15:54:26 -07:00
Eundoo Song
e06c9da916
Rename aggregator/test to aggregatortest (#980)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-28 14:31:56 -07:00
Tyler Yahn
2833212bd9
Decouple API from SDK (#977)
* Remove SDK from othttp instrumentation

* Remove dependency on SDK in api/kv pkg

Benchmark the kv package not the SDK here.

* Update api/global benchmarks

Move SDK related tests to SDK where applicable

* Add internal testing SDK implementation

To be used by the API for testing so it does not depend on the actual
SDK.

* Update api/global/internal to use internal/sdk

* Fix lint on sdk/metric benchmark

* Lint internal/sdk

* Merge internal/sdk into api/trace/testtrace

* Update Changelog
2020-07-28 10:47:08 -07:00
Y.Horie
6917167123
Rename kv.Infer to kv.Any (#969) (#972)
* Consider renaming Infer to Any. Any is a commonly used concept in Go.
2020-07-27 09:29:22 -07:00
Tyler Yahn
3b01a854d1
Make the stdout exporter a package (#963)
* Make the stdout exporter its own package

Follow the pattern of the other exporters.

* Update dependabot with stdout exporter

* Add replace directives for stdout exporter

* Remove outdated example test from metric SDK

* go mod tidy

* Update othttp example test

Remove unused stdout exporter.

* Remove tests in API that depend on stdout exporter

The global package does not need to be validated with the SDK. A more
properly constructed end-to-end integration test should be built if this
is actually needed.

* Add replace clause for otel in stdout go.mod
2020-07-24 20:44:51 -07:00
Tyler Yahn
c6611f4478
Move export test package to SDK (#962)
* Move export test package to SDK

* Rename package to metrictest

Follow Go std lib conventions in test package naming.

* Update import paths
2020-07-24 20:32:52 -07:00
Tyler Yahn
d99ac0993e
Remove sub-package value from kv (#968)
* Remove sub-package value from kv

* Update refs to `go.opentelemetry.io/api/kv/value`

* Update Changelog
2020-07-24 12:25:27 -07:00
Tyler Yahn
452256cbf4
Unify trace and metric stdout exporters (#956)
* Consolidate stdout exporter

* Move config to own file and match project standard

* Abstract Exporter into unified struct

* Rename trace part of the exporter

* Update import paths and configuration

* Update tests

* Update InstallNewPipeline to not return traceProvider

It is a registered global, access it that way.

* Update example_test

* Update docs

* Update example to be for whole package

* Update metric output

Closer match the span output.

* Clean up span output

Print as a batch and cleanup marshaling.

* Correct spelling error in doc

* Add Exporters README

* Update Changelog

* Propagate changes to rest of project

* Lint fixes

* Fix example test in metric SDK

* Add disable config options for trace and metric

Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
2020-07-22 12:34:44 -07:00
Tyler Yahn
58e50e249f
Release v0.9.0 (#952)
* Prepare for releasing v0.9.0

* Update Changelog
2020-07-20 12:40:42 -07:00
YANYZP
99c299877d
OT resource detector (#939)
* first

* all included

* constant

* res keys

* env detector

* Update sdk/detect/env.go

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* new test cases and strings operation to handle labels

* solved conflict

* typo

* corrected comments

* deleted env var handling

* push again

* rerun

* restructuring

* new way to aggregate errors

* all in resources package and verbose comments

* solved merge conflicts

* included new error types

* improved error handling

* updated changelog.md

* updated changelog

* updated changelog.md

* updated changelog

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-20 08:43:51 -07:00
Tyler Yahn
aff7a80d5a
Release v0.8.0 (#929)
* Prepare for releasing v0.8.0

* Update Changelog

* Update Changelog
2020-07-10 09:23:53 -07:00
Joshua MacDonald
3475d5575e
Fix incorrect aggregation; Prometheus exporter behavior (#903)
* Avoid applying stale udpates; add a test

* Add Memory option to basic processor

* Always use memory in the pull controller

* Test the memory option

* Precommit

* Add a Prometheus-specific test

* More comment on Memory option

* Link to 862

* Remove sleep

* Update changelog

* Comment on stale and stateless aggregators

* Update sdk/metric/processor/basic/config.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-07 12:52:35 -07:00
Tyler Yahn
49ac8eb238
Prepare for the v0.7.0 release (#876)
* Prepare for releasing v0.7.0

* Update Changelog for v0.7.0 release

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-06-26 13:54:33 -07:00
Mujtaba Ahmed
5be82c0e47
Added support array attributes (#798)
* Added support array attributes

* Changed function signature for AsArray attribute

* Fixed code comments for array attributes

* Fixed typos in comments in value.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-24 15:58:08 -07:00
dependabot[bot]
9cdfdb2d3a
Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 (#824)
* Bump github.com/stretchr/testify from 1.4.0 to 1.6.1

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.4.0 to 1.6.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.4.0...v1.6.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Update go.mod

* math.Inf(1)+math.Inf(-1)=NaN

Math is hard

* Remove indirect transitive dependency

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Co-authored-by: Evan Torrie <evantorrie@users.noreply.github.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-06-24 11:16:21 -07:00
ET
a8faf8cacc
Eliminate Uint64NumberKind from API (#864)
fixes #851

This includes all of the associated methods, such as
  AsUint64, AsUint64Atomic, AsUint64Ptr, CoerceToUint64, SetUint64
  SetUint64Atomic, SwapUint64, SwapUint64Atomic, AddUint64,
  AddUint64Atomic, CompamreAndSwapUint64, CompareUint64

Only significant change as a result was converting the histogram
aggregator's `count` state field into an int64 from a `metric.Number`.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-23 16:28:04 -07:00
Joshua MacDonald
2966505271
Rename Integrator to Processor (#863)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-23 12:00:15 -07:00
Joshua MacDonald
0f682d9247
Lost commits of #840 (#856) 2020-06-23 11:14:26 -07:00
Joshua MacDonald
0382850707
Rename AggregationSelector to AggregatorSelector (#859) 2020-06-23 10:51:15 -07:00
Joshua MacDonald
ea53fb4d1a
Rename SynchronizedCopy to SynchronizedMove and update comment (#858) 2020-06-23 10:41:11 -07:00
Joshua MacDonald
d343f987f8
Rename simple integrator to basic integrator (#857)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-23 10:36:10 -07:00
Joshua MacDonald
0e2fdfc682
Support cumulative, delta, and pass-through exporters (#840)
* Update Process()

* Checkpoint

* Add subtractor; fix test

* Fix all simple integrator tests

* Build the rest (checkpoint)

* Pass all but Prometheus tests

* Precommit pass

* Add aggregation.Kind argument to ExportKindFor

* Remove Subtractor support

* Remove dead test code

* Restore the Subtractor code

* Fix the tests

* Comments

* Add tests for MetricKind

* Add ChangeSign test

* Test ExportKind

* New file

* Rename ChangeSign

* Remove a TODO, add a TODO

* Remove Stateful remnants

* Typo

* Typo

* Test an invalid export kind

* Comments

* Lint

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-22 22:59:51 -07:00
Joshua MacDonald
4e4271791f
Add export timestamps; distinguish Accumulation vs. Record (#835)
* Introduce Accumulation

* Refactor export structs

* FTB exporters

* Test timestamps

* Test no-start case

* From feedback

* Apply suggestions from code review

(Thanks @MrAlias!)

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Comments in sdk/metric/integrator/test

* Fix build

* Comments and feedback

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-18 10:16:33 -07:00
Yoan Blanc
3d3664ec04
fix: typo (#834)
it seems to be for a pull controller
2020-06-17 09:05:29 -07:00
Joshua MacDonald
9925ebe517
Single-state Aggregator and test refactor (#812)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-13 00:55:01 -07:00
Tyler Yahn
288a3dd435
Metrics instrumentation version (#811)
* Support instrumentation library in metrics

* Update stdout exporter to display instrumentation info

* Fix tests that use the STDOUT exporter

* Refactor to keep SDK out of API

* Update global Meter and test Meter version

* Revert unneeded import syntax change

* Fix Unit comment

* Update comments

* Update comment

* Revert no-op change to import
2020-06-12 09:11:17 -07:00
Tyler Yahn
7d5117fafd
Changes AlwaysParentSample to ParentSample(fallback) (#810)
* Changes AlwaysParentSample to ParentSample(fallback)

To match
https://github.com/open-telemetry/opentelemetry-specification/blob/v0.5.0/specification/trace/sdk.md#parentorelse
introduced in
https://github.com/open-telemetry/opentelemetry-specification/pull/609

* Fix lint
2020-06-11 08:27:21 -07:00
jmacd
8b58f4f48e Uppercase 2020-06-10 00:53:31 -07:00
jmacd
e3c9929313 Remove dead code 2020-06-10 00:52:41 -07:00
jmacd
a877fbbb85 Comments 2020-06-10 00:42:57 -07:00
jmacd
8483cc3d23 Add Aggregation.Kind() 2020-06-10 00:32:14 -07:00
jmacd
bb2eb8ee26 Comments 2020-06-10 00:05:17 -07:00
jmacd
6f0c6b4683 Split aggregation.go 2020-06-09 22:53:30 -07:00
jmacd
da2bdb8249 Update aggregation.go/aggregator.go 2020-06-09 22:41:51 -07:00
Tyler Yahn
e53841a4b4
Support Instrumentation Library Info in Trace Export Pipeline (#805)
* Update Tracer API with instrumentation version

Add option to the `Provider.Tracer` method to specify the
instrumentation version.

Update the global, noop, opentracing bridge, and default SDK
implementations.

This does not propagate the instrumentation library version to the
exported span. That is left for a follow-on PR.

* Revert trace_test.go

This is for the next PR.

* Support instrumentation library in SDK trace exports

* Update Jaeger exporter to export instrumentation
2020-06-09 22:15:53 -07:00
Vladimir Mihailenco
7ebd7b5ffa
Fix BatchSpanProcessor.Shutdown to wait until all spans are processed (#766)
* Fix BatchSpanProcessor.Shutdown to wait until all spans are processed

Currently it exits too soon - before drainQueue is finished

* Check bsp.stopCh to reliably drop span when batcher is stopped

* Enable tests

* Always use WithBlocking

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-06-09 15:20:48 -07:00
Tyler Yahn
a98bb979df
Update Tracer API with instrumentation version (#802)
* Update Tracer API with instrumentation version

Add option to the `Provider.Tracer` method to specify the
instrumentation version.

Update the global, noop, opentracing bridge, and default SDK
implementations.

This does not propagate the instrumentation library version to the
exported span. That is left for a follow-on PR.

* Revert trace_test.go

This is for the next PR.

* Update SDK to include version for default instrumentation

If the instrumentation library name is empty and the default
instrumentation is uses, include the SDK version.

* Update comments and documentation

* Remove default instrumentation version
2020-06-09 11:47:54 -07:00
Joshua MacDonald
9401bd9cda
Remove Context arguments from Aggregator.Checkpoint and Integrator.Process (#803)
* Typo

* Swap order of ddsketch.New for consistency w/ histogram.New

* Remove Integrator.Process ctx argument

* Remove Aggregator.Checkpoint ctx argument

* Revert bugfix
2020-06-09 11:00:50 -07:00
Tyler Yahn
50f0f85c79
Discard error in trace testing 2020-06-02 13:33:19 -07:00
Tyler Yahn
e73d119d6c
Update concurrency support in test Handlers 2020-06-02 13:03:02 -07:00
Tyler Yahn
8c5b1663a2
Fix push_test.go
Add test handler
2020-06-02 12:50:34 -07:00
Tyler Yahn
2efa30feec
Error on span name set with uninitialized 2020-06-02 12:43:01 -07:00
Tyler Yahn
0b928ed0a1
Update metric SDK to use oterror.Handler 2020-06-02 12:26:25 -07:00
Joshua MacDonald
86a10268b8
Minor cleanups in sdk/metric/aggregator (#781)
* Typo

* Swap order of ddsketch.New for consistency w/ histogram.New
2020-05-30 20:16:40 -07:00
Paulo Janotti
b3f17329c8 Remove SpanID from sampling parameters
Update code per latest spec, see:
https://github.com/open-telemetry/opentelemetry-specification/pull/621
2020-05-28 16:08:04 -07:00
Tyler Yahn
a5e9204b58
Merge branch 'master' into pre_release_v0.6.0 2020-05-21 15:45:47 -07:00
Joshua MacDonald
b17a7845df
Rename Register* to New* (#761) 2020-05-21 15:42:14 -07:00
Tyler Yahn
ad37aae65c
Prepare for releasing v0.6.0 2020-05-21 12:10:12 -07:00
Tyler Yahn
0d3daf02b1
Merge branch 'master' into jmacd/prom_res 2020-05-21 11:55:41 -07:00
jmacd
4f3188ab95 Fix use of values in benchmark 2020-05-21 11:36:52 -07:00
jmacd
9d2e78ae2b Comment 2020-05-21 11:21:13 -07:00
jmacd
17b8543050 Lint 2020-05-21 11:18:47 -07:00
jmacd
2aa0f1496e Comment on linear vs binary search 2020-05-21 11:09:10 -07:00
jmacd
db993ec5cc Cleanup sort 2020-05-21 10:46:22 -07:00
jmacd
9548817e7e Add a benchmark 2020-05-21 10:45:26 -07:00
jmacd
dacebd6430 Use []float64 for boundaries 2020-05-21 10:29:03 -07:00
jmacd
3d2493463c Comments 2020-05-21 09:53:34 -07:00
jmacd
b63cf49bba Use sort.Search to locate histogram bucket 2020-05-21 02:08:08 -07:00
jmacd
48a8a869fe Upstream 2020-05-21 02:01:06 -07:00
jmacd
1c8c5df4db resource.Merge uses label.MergeIterator 2020-05-21 00:33:39 -07:00
jmacd
0b5080372a Add benchmark 2020-05-21 00:19:08 -07:00
Anthony J Mirabella
923a6c8afc Replace sdktrace.WithResourceAttributes() with WithResource() 2020-05-20 16:08:43 -04:00
Joshua MacDonald
5461669733
Add a pull controller, use it for Prometheus (#751)
* Checkpoint new pull controller

* Tests pass

* Fix example

* Example fix

* Add a test

* Comment

* address MrAlias's feedback
2020-05-20 10:27:26 -07:00
Joshua MacDonald
15e8edd498
Add the UpDownSumObserver instrument (#750)
* Add the UpDownSumObserver instrument

* Precommit

* Downcase error message
2020-05-20 10:19:51 -07:00
Vladimir Mihailenco
244ed23e44
Rename ScheduleDelayMillis to BatchTimeout (#752)
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-05-20 10:12:57 -07:00
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
c5f2252c48
Add the SumObserver instrument (#747)
* Add the SumObserver instrument

* Lint
2020-05-19 11:49:24 -07:00
Joshua MacDonald
0a333cade1
Add the UpDownCounter instrument (#745)
* Add UpDownCounter to the API

* Add an SDK test

* Comment fix
2020-05-19 10:00:22 -07:00
Joshua MacDonald
055e9c54e1
Disable parts of batch_span_processor test as flakes (#743)
* Name the BSP tests

* Add a drain wait group; use the stop wait group to avoid leaking a goroutine

* Lint & comments

* Fix

* Use defer/recover

* Restore the Add/Done...

* Restore the Add/Done...

* Consolidate select stmts

* Disable the test

* Lint

* Use better recover
2020-05-19 09:36:33 -07:00
Tyler Yahn
51ff97e534
Add timeout to push Controller (#742)
Addresses existing TODO in the push `tick` function by added a context
timeout set to a configurable Controller timeout. This ensures that hung
collections or exports do not have runaway resource usage.

Defaults to the length of a collector period.
2020-05-18 21:43:27 -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
Tyler Yahn
3e1d85ee23
Merge branch 'master' into master 2020-05-18 11:15:50 -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
Vladimir Mihailenco
4408b6e328 Remove buggy enqueueWait 2020-05-16 10:19:46 +03: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
1d554f34c1
Add standard package contain all semantic conventions 2020-05-15 12:42:13 -07:00
Tyler Yahn
55bbf51459
Switch to kv.Key types 2020-05-15 11:44:17 -07:00
Tyler Yahn
f7f3fc3918
Remove redundant "Key" from const names 2020-05-15 11:38:02 -07:00
Tyler Yahn
4eecaf5391
Update resourcekey package doc 2020-05-15 11:35:44 -07:00
Tyler Yahn
7c209b5c8c
Rename resourcekeys to singular resourcekey 2020-05-15 11:33:14 -07:00
Vladimir Mihailenco
b2285e0c71 Fix timer.Stop 2020-05-15 14:01:43 +03:00
Vladimir Mihailenco
28571207b7 Add a comment 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
88d9ad0ba8 Add ref to #174 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
8885bc404d Move IsSampled check 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
774889cbfa Add proper enqueue sync 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
ab19dddd0f Update tests 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
891d16dd15 Replace Ticker with Timer since Ticker does not Reset yet 2020-05-15 11:54:56 +03:00
Vladimir Mihailenco
2719c0ac16 Rewrite processQueue for better batching 2020-05-15 11:54:56 +03:00
Tyler Yahn
ce266f9656
Prepare for releasing v0.5.0 2020-05-13 17:11:23 -07:00
Joshua MacDonald
fefdf59a0b
Batch Observer callback support (#717)
* api/metric changes from jmacd:jmacd/batch_obs_2

* Add an SDK test

* Use a single collector method

* Two fixes

* Comments; embed AsyncRunner

* Comments

* Comment fix

* More comments

* Renaming for clarity

* Renaming for clarity (fix)

* Lint
2020-05-13 16:27:52 -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
tensorchen
2ffbd869d7 Rename TraceFlagsSampled, TraceFlagsUnused 2020-05-06 01:41:54 +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
ET
34bd998963
Remove internal StateLocker implementation (#688)
Fixes #657

With the changes in #667 and #669 to use a plain-old-mutex for
concurrent access of Histogram and MinMaxSumCount aggregators,
the StateLocker implementation is no longer used in the project.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-30 14:15:04 -07:00
Joshua MacDonald
d7b3c3d7e7
Fix and test uses of global.Meter with RecordBatch() (#680)
* Test use of global.Meter.RecordBatch

* Avoid new dep
2020-04-29 16:13:55 -07:00
ET
e4ec924b25
Reimplement histogram using mutex instead of stateLocker (#669)
* Reimplement histogram using mutex instead of stateLocker

Move existing implementation to histogram_statelocker.go. Implement
benchmarks for single thread and parallel histogram updates comparing
mutex version to stateLocker version

* Drop statelocker implementation and alignment tests, benchmarks

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-29 10:08:58 -07:00
ET
bd16ce0cfa
Switch MinMaxSumCount to a mutex lock instead of StateLocker (#667)
* Switch MinMaxSumCount to a mutex lock instead of StateLocker

With multiple values being modified for each Update(), a single mutex
lock and non-atomic operations ends up being faster than making each
value update into an atomic operation.

* Remove StateLocker implementation and comparison benchmarks

* Remove field offset tests. No longer required with no atomics.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-28 18:27:13 -07:00
Liz Fong-Jones
ee30252752
add SetAttribute(string,interface{}) (#674) 2020-04-28 14:24:47 -07: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
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
Joshua MacDonald
395440db10
Checkpoint only after Update; Keep records in the sync.Map longer (#647)
* Add a test

* Benchmark

* Ensure records can persist across intervals

* Remove dead code

* Address feedback, refactor & eliminate race
2020-04-21 20:23:15 -07:00
Joshua MacDonald
e554562513
Do not cache reflect.ValueOf() in metrics Labels (#649)
* Benchmark label iterator

* Remove cachedValue, a minor optimization
2020-04-20 20:29:46 -07:00
Shouri Piratla
669d4b3a6c
TraceID and SpanID implementations for Stringer Interface (#642)
* TraceID and SpanID implementations for Stringer Interface

* Hex encode while stringifying

* Modify format specifiers wherever SpanID is used

* comment changes

* Remove TraceIdString() and SpanIdString()

* Comments Fixes
2020-04-16 15:42:48 -07:00
Joshua MacDonald
a8f7b3247b
Remove WithKeys() option, defaultkeys batcher (#639) 2020-04-14 16:07:11 -07:00
Tyler Yahn
8e97011ea8
Update Resource (#613)
* Update Resource

When looking at grouping telemetry in an exporter based on the Resource
it is ideal if a map can be make with the key being represented by a
Resource. However, given the Resource is not hashable, this is not
possible.

This add a `String` method that can be used as a map key during
grouping. Additionally, this means the Resource now implements the
`Stringer` interface providing human-readable info when prited.

The internal structure of the Resource is changed. A static slice
containing all key-values in a sorted order replaces the existing map.
Additionally a set of keys is added to accommodate lookup during
`Merge`. Also, the string representation is kept in an internal field so
as to save processing for the `String` method (all fields are assumed to
be static after creation).

The `Attributes` method now returns a sorted slice of the associated
key-values.

The `Merge` method has been updated to support the changed structure of
the Resource.

New tests are added to validate the `String` method.

* Update comment

* Change loop into returned append

* Update key-value less func

Keys are unique in this package, treat them that way.

* Remove unnecessary allocation on empty attributes

* Update `Merge` method

Remove incomplete sorting of merged slices. Instead use the `sort`
package.

Add tests to catch sorting failure identified.

* Apply suggestions from code review

Co-Authored-By: ET <evantorrie@users.noreply.github.com>

* Escape Resource string representation

To ensure uniqueness of the string representation, the key-value content
needs to be escaped.

* Switch to an eager evaluation for the `String` method

* Refactor `Merge` method

Leave optimization to the future and simplify the merge.

* Add AttributeIterator

Include a method for a user of the Resource to iterate over the related
attributes without needed to copy the attributes.

* Fix ineffectual

* Fix lint

* Add licenses

* keys -> keySet for Resource

Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-07 12:15:36 -07:00
ET
367635b740
Create a new recorder rather than reuse one for same labels (#610)
Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-04-02 16:51:37 -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
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
Joshua MacDonald
1e8e72b530
Process the queue until no data but respect max batch size (#599) 2020-03-27 16:21:20 -07: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
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
Joshua MacDonald
cfe74cf91f
Add a RecordBatch benchmark (#594) 2020-03-25 08:57:40 -07:00
Joshua MacDonald
06f833e2ae
Unique instrument checking (#580)
* Add skeleton uniqueness checker

* Fix the build w/ new code in place

* Add sync tests

* More test

* Implement global uniqueness checking

* Set the library name

* Ensure ordered global initialization

* Use proper require statement for errors

* Comment

* Apply feedback fixes

* Comment and rename from feedback
2020-03-24 10:54:08 -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
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
Ilya Kaznacheev
7623fc544a
Remove GetDescriptor (#575)
* Remove GetDescriptor

* Add Must var hotfix
2020-03-20 17:19:48 -07:00
Krzesimir Nowak
cc756f6a8d
Encode labels once during checkpoint (#572)
The `checkpoint` function is executed in a single thread so we can do
the encoding lazily before passing the encoded version of labels to
the exporter. This is a cheap and quick way to avoid encoding the
labels on every collection interval.

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-03-20 09:17:45 -07:00
Tyler Yahn
f7df68b68b
Add support for Resources in the SDK (#552)
* Add support for Resources in the SDK

Add `Config` types for the push `Controller` and the `SDK`. Included
with this are helper functions to configure the `ErrorHandler` and
`Resource`.

Add a `Resource` to the Meter `Descriptor`. The choice to add the
`Resource` here (instead of say a `Record` or the `Instrument` itself)
was motivated by the definition of the `Descriptor` as the way to
uniquely describe a metric instrument.

Update the push `Controller` and default `SDK` to pass down their configured
`Resource` from instantiation to the metric instruments.

* Update New SDK constructor documentation

* Change NewDescriptor constructor to take opts

Add DescriptorConfig and DescriptorOption to configure the metric
Descriptor with the description, unit, keys, and resource.

Update all function calls to NewDescriptor to use new function
signature.

* Apply suggestions from code review

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

* Update and add copyright notices

* Update push controller creator func

Pass the configured ErrorHandler for the controller to the SDK.

* Update Resource integration with the SDK

Add back the Resource field to the Descriptor that was moved in the
last merge with master.

Add a resource.Provider interface.

Have the default SDK implement the new resource.Provider interface and
integrate the new interface into the newSync/newAsync workflows. Now, if
the SDK has a Resource defined it will be passed to all Descriptors
created for the instruments it creates.

* Remove nil check for metric SDK config

* Fix and add test for API Options

Add an `Equal` method to the Resource so it can be compared with
github.com/google/go-cmp/cmp.

Add additional test of the API Option unit tests to ensure WithResource
correctly sets a new resource.

* Move the resource.Provider interface to the API package

Move the interface to where it is used.

Fix spelling.

* Remove errant line

* Remove nil checks for the push controller config

* Fix check SDK implements Resourcer

* Apply suggestions from code review

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

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-03-20 08:58:32 -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
Joshua MacDonald
d8682c1999
Refactor the SDK helpers, create MeterImpl (#560)
* Create MeterImpl interface

* Checkpoint w/ sdk.go building

* Checkpoint working on global

* api/global builds (test fails)

* Test fix

* All tests pass

* Comments

* Add two tests

* Comments and uncomment tests

* Precommit part 1

* Still working on tests

* Lint

* Add a test and a TODO

* Cleanup

* Lint

* Interface()->Implementation()

* Apply some feedback

* From feedback

* (A)Synchronous -> (A)Sync

* Add a missing comment

* Apply suggestions from code review

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

* Rename a variable

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-03-19 12:02:46 -07:00
ET
217a97d9b6
Replace ErrNoLastValue and ErrEmptyDataSet by ErrNoData (#557)
Handle ForEach returning an error
2020-03-16 16:28:33 -07:00
Rahul Patel
6ada85adba
add resource option to Provider. (#545)
- update otlp exporter to export resources.
2020-03-13 13:07:36 -07:00
Mike Goldsmith
638b865c90
Update Sampler descriptions (#511)
* update always and never sample descriptions

* fix typo

* rename always on / off sampler files, structs and variables to match

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-03-13 12:17:52 -07:00
ET
8680783750
Use StateLocker in MinMaxSumCount (#546)
* Add MinMaxSumCount stress test

* Reimplement MinMaxSumCount using StateLocker

* Address PR comments

* Round #2 of PR comments

Co-authored-by: Rahul Patel <rahulpa@google.com>
2020-03-12 15:43:19 -07:00
ET
46ac030360
Eliminate goroutine leak in histogram stress test (#547)
Update copyright date to when file was created (2020)
Create random numbers between 0 and 100 to more evenly match the
buckets defined in the histogram test (25, 50, 75)
2020-03-12 15:37:06 -07:00
Joshua MacDonald
23e65ac79d
Remove metric options; rename "counter" aggregator to "sum" (#541)
* Remove options (mostly)

* Rename counter aggregator to 'sum'

* Fix prometheus test

* Rewordings from feedback
2020-03-11 20:21:34 -07:00
Krzesimir Nowak
d9210f5676
Zipkin exporter (#495)
* Add zipkin exporter

The zipkin exporter implements the SpanBatcher interface. It follows
the current-at-the-time-of-writing document about conversion from
OpenTelemetry span data to Zipkin spans. Which means that endpoint
information is not yet filled.

* Fix typo in docs

* Add a zipkin example

This sends span information to a locally running zipkin collector.
Currently I have a problem getting the collector to show me the spans
after accepting them with HTTP 202. Not sure if this is because of
missing endpoint information.

* Make gitignore consistent

The fixed paths should be prefixed with a slash. The "relative" paths
mean that git will ignore all the files that end with the path.

* Add tests for zipkin exporter
2020-03-11 14:49:02 -07:00
Joshua MacDonald
4047c0877a
Introduce metric constructor errors, MeterMust wrapper (#529)
* Update api for Must constructors, with SDK helpers

* Update for Must constructors, leaving TODOs about global errors

* Add tests

* Move Must methods into metric.Must

* Apply the feedback

* Remove interfaces

* Remove more interfaces

* Again...

* Remove a sentence about a dead inteface
2020-03-11 11:57:57 -07:00
Gustavo Silva Paiva
288821cd22
Make histogram aggregator checkpoint consistent (#438)
* change the histogram aggregator to have a consistent but blocking Checkpoint()

* docs

* wrapping docs

* remove currentIdx from the 8bit alignment check

* stress test

* add export and move lockfreewrite algorithm to an external struct.

* move state locker to another package.

* add todos

* minimal tests

* renaming and docs

* change to context.Background()

* add link to algorithm and grammars

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-03-11 11:12:23 -07:00
Joshua MacDonald
ae9033e01f
Use a variable-size array to represent ordered labels in maps (#523)
* Use an array key to label encoding in the SDK

* Comment

* Precommit

* Comment

* Comment

* Feedback from krnowak

* Do not overwrite the Key

* Add the value test requested

* Add a comment
2020-03-11 09:11:27 -07:00
Joshua MacDonald
9674c81cb7
Drop the gauge instrument (#537)
* drop gauge instrument

* Restore the benchmark and stress test for lastvalue aggregator, but remove monotonic last-value support

* Rename gauge->lastvalue and remove remaining uses of the word 'gauge'

Co-authored-by: Krzesimir Nowak <krzesimir@kinvolk.io>
2020-03-10 16:00:37 -07:00
Anthony Mirabella
7a1cbbc191
Update Samplers to conform to Spec (#531)
* Refactor SDK Sampler API to conform to Spec

* Sampler is now an interface rather than a function type
* SamplingParameters include the span Kind, Attributes, and Links
* SamplingResult includes a SamplingDecision with three possible values, as well as Attributes

* Add attributes retruned from a Sampler to the span

* Add SpanKind, Attributes, and Links to API Sampler.ShouldSample() parameters

* Drop "Get" from sdk Sampler.GetDescription to match api Sampler

* Make spanID parameter in API Sampler interface a core.SpanID

* Fix types and printf format per PR feedback from krnowak

* Ensure unit test error messages reflect new reality

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-03-10 08:25:11 -07:00
Rahul Patel
1ff0f2a26a
add resource type. (#528)
* add resource type.

* sort attributes in test to fix ci.

* add resource keys and update test.
2020-03-09 09:30:42 -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
79de90a313
fix data race in BatchedSpanProcessor (#518)
* fix data race in BatchedSpanProcessor

- fixes #517

* fix ci.

* fix another test.

* move wait group to generateSpan func.
2020-03-05 13:41:00 -08:00
Rahul Patel
161556aab8
Update provider to use AlwaysSampler instead of ProbabilitySampler (#506)
* update provider to use AlwaysSampler instead of ProbabilitySampler

* remove unused defaultSamplingProbability constant

* fix broken tests

* update failure message in test

* fix test description

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-03-05 13:29:51 -08:00
Rahul Patel
a202f16100
Add observer metric (#474)
* wip: observers

* wip: float observers

* fix copy pasta

* wip: rework observers in sdk

* small fix in global meter

* wip: aggregators and selectors

* wip: monotonicity option for observers

* some refactor

* wip: docs

needs more package docs (especially for api/metric and sdk/metric)

* fix ci

* Fix copy-pasta in docs

Co-Authored-By: Mauricio Vásquez <mauricio@kinvolk.io>

* recycle unused recorders in observers

if a recorder for a labelset is unused for a second collection cycle
in a row, drop it

* unregister

* thread-safe set callback

* Fix docs

* Revert "wip: aggregators and selectors"

This reverts commit 37b7d05aed5dc90f6d5593325b6eb77494e21736.

* update selector

* tests

* Rework number equality

Compare concrete numbers, so we can get actual numbers in the error
message when they are not equal, not some uint64 representation. This
also uses InDelta for comparing floats.

* Ensure that Observers are registered in the same order

* Run observers in fixed order

So the tests can be reproducible - iterating a map made the order of
measurements random.

* Ensure the proper alignment of the delegates

This wasn't checked at all. After adding the checks, the test-386
failed.

* Small tweaks to the global meter test

* Ensure proper alignment of the callback pointer

test-386 was complaining about it

* update docs

* update a TODO

* address review issues

* drop SetCallback

Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-03-05 12:15:30 -08:00
Joshua MacDonald
148c9ce5ba
Make the default label encoding unique (#508)
* Make the default label encoding unique

* More tests

* Cleanup
2020-03-04 14:19:25 -08:00
Liz Fong-Jones
ffdbc05665
update to v0.2.3 (#512)
Promote everything to v0.2.3, golang 1.14, and give everything a nice go get -u ./... and go mod tidy along the way too.
2020-03-04 16:12:25 -05: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
Rebecca Pruim
7a0e1c8eda
Add configurable push frequency for exporters (#504)
* Add configurable push frequency for exporters

* Standardize on minute push frequency
2020-02-28 17:08:30 -08:00
Anthony Mirabella
ca3f74d976
Add Span#RecordError method to simplify adding error events to spans (#473)
* Add `Span#Error` method to simplify setting an error status and message.

* `Span#Error` should no-op on nil errors

* Record errors as a span event rather than status/attributes.

The implementation in the SDK package now relies on existing API methods.

* Add WithErrorStatus() ErrorOption to allow setting span status on error.

* Apply suggestions from code review

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

* Address code review feedback

* Clean up RecordError tests

* Ensure complete and unique error type is recorded for defined types
* Avoid duplicating logic under test in tests

* Move TestError to internal/testing package, improve RecordError test scenarios

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-02-28 13:44:53 -08:00
Anthony Mirabella
f0c70ffde0
Add StartOptions to Tracer.WithSpan() (#472)
Tracer.WithSpan() will now accept StartOptions as a variadic final parameter `opts`
that will be passed to the Tracer.Start() invocation that creates the Span
wrapping the user-provided function.
2020-02-10 21:07:32 -05:00
Bogdan Drutu
2584c3e7c4
Call Gosched if load an unmapped record (#469)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-10 16:20:29 -08:00
Bogdan Drutu
69df67d449
Refactor metric records logic (#468)
* Refactor metric records logic.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Fix lint errors

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Fix a bug that we try to readd the old entry instead of a new one.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Update comments in refcount_mapped.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Remove the need to use a records list, iterate over the map.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Fix comments and typos

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Fix more comments

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Clarify tryUnmap comment

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>

* Fix one more typo.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-06 14:45:56 -08:00
Krzesimir Nowak
cab6b28263
Fix URL to opentelemetry.io (#464)
Looks like a fallout from adding the `otel` part to the package
names. Spotted by Matej Gera.
2020-02-05 07:18:40 -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
Amr Hanafi
6051c81493
Add AlwaysParentSample sampler (#455)
* Add AlwaysParentSample

* Update sampler doc

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

* Address PR comments

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-03 10:22:52 -08:00
Gustavo Silva Paiva
2c460f0d97 Adds Histogram Aggregator (#433)
* histogram aggregator draft

* add tests for buckets

* naming stuffs

* docs

* add tests for buckets

* fix doc

* update year

* adds docs for Histogram

* docs for boundaries.

* addresses review comments
Change to less-than buckets. Add offset checks. Unexport fields that don't need to be exported. Fix tests when running on profile with int64 number kind.

* sort boundaries

* remove testing field

* fixes import order

* remove print 🙈
2020-01-21 09:15:09 -08:00
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