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

245 Commits

Author SHA1 Message Date
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
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
dengliming
f8ed8332d6 Fix review. 2020-08-17 00:45:21 +08:00
dengliming
d94143ee13 Rename Callback Function. 2020-08-15 11:56:19 +08:00
Joshua MacDonald
b7df5543e3
Add support for filtering metric label sets (#1047)
* Add support for filtering label sets

* Restore test

* Fix Value() bug

* Pass kv.KeyValue

* Apply suggestions from code review

Thank you @MrAlias.

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-11 11:00:23 -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
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
Tyler Yahn
96a5f8ff46
Rename api/standard package to semconv (#1016)
* Rename api/standard package to semconv

* Update `api/standard` package dependencies to `semconv`

* Update Changelog

* Add PR number to Changelog
2020-08-04 07:51:09 -07:00
Bogdan Drutu
4b96967571
Remove deadcode, and confusing sampler interface from API (#999)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-30 15:53:07 -07:00
Rey Abolofia
fa883d426b
testtrace.Span tracks and returns its SpanKind. (#987)
* Span tracks and returns its SpanKind.

* Include SpanKind addition in CHANGELOG.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-29 16:06:20 -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
c9c8137954
Remove IndexedAttribute from api/label (#970)
* Remove IndexedAttribute from api/label

IndexedAttribute is a synonym for IndexedLabel and a hold over from when
this iterator pattern had multiple implementations. Given it no longer
is uses, remove it to avoid introducing confusion to users.

* Update Changelog

* Update Changelog PR number
2020-07-24 21:09:19 -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
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
Liz Fong-Jones
b2b23e15e5
supports marshaling values as json (#948) 2020-07-17 16:10:19 -04:00
Tyler Yahn
d979977a40
Add semantic conventions for OS process as resource attributes (#919)
* Add sem-conv for OS process as resource attr keys

Resolves #891

* Add PR number to Changelog

* Apply suggestions from code review

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

* Update comments to Linux

Co-authored-by: ET <evantorrie@users.noreply.github.com>
2020-07-09 15:02:03 -07:00
Anthony Mirabella
c719588733
Avoid replacing existing correlation map data in context when correlation context extractor does not find any valid data (#923)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-09 12:02:49 -07:00
Tyler Yahn
fab431e455
Fix api/standard constant names and documentation (#920)
* Update spec version sem-conv implement in doc.go

* Update FaaS key const names to match convention

* Add PR number to Changelog
2020-07-09 11:56:47 -07:00
Sam Xie
03cd779f0e
Add http content size semantic conventions (#905)
* Add http content size to standard package

Signed-off-by: Sam Xie <xsambundy@gmail.com>

* Include `http.request_content_length` in HTTP request basic attributes

Signed-off-by: Sam Xie <xsambundy@gmail.com>

* Add test for api.standard package

Signed-off-by: Sam Xie <xsambundy@gmail.com>

* Update CHANGELOG

Signed-off-by: Sam Xie <xsambundy@gmail.com>

* Fix http content size naming

Signed-off-by: Sam Xie <xsambundy@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-08 10:39:15 -07:00
Matej Gera
1c9aab619d
Extend semantic convetions for RPC (#900)
* Extend semantic convetions for RPC

* Update changelog

* make service attribute conform to spec

* Update api/standard/trace.go

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-08 08:26:09 -07:00
Tyler Yahn
c506e99b01
Fix B3 propagator and add tests (#882)
* Correct B3 propagators and add tests

* Break up external integration and internal unit tests

* Add changes to Changelog.

* Update Changelog with PR number

* Fix lint issues

* Update trace flags

Add a new "not sampled" mask to complement the existing "sampled" one.

Rename `FlagsUnused` to `FlagsUnset`.

Add documentation for each of the flags to help understand their
purpose.

* Update extractSingle to support unset sampling

* Update existing tests to appropriately use FlagsUnset

* Remove bogus debug flag test

The B3 specification states "Debug is encoded as `X-B3-Flags: 1`. Absent
or any other values can be ignored", so testing of other values should
not result in an error.

* B3 Extract now supports parsing both headers

Remove test cases that would fail if the fallback header format was
expected to not be used.

* Feedback

* Switch to bitmask inject encoding field

Add the B3Encoding and valid HTTP based values. Change the B3 propagator
to use these bitmask fields to specify the inject encoding it will
propagate.

* Add comments

* Migrate B3 integration tests to existing testtrace

* Update comment

* Benchmark invalid B3 injects as well

* Update trace flags

Add a FlagsDebug and FlagsDeferred to track the B3 trace state.

Add helper methods to the SpanContext to check the debug and deferred
bit of the trace flags.

Update SpanContext.IsSampled to return if the sampling decision is to
sample rather than if the sample bit is set. This means that if the
debug bit is also set it will return true.

* Revert SpanContext.IsSampled back

* Add comment to b3 test data generation

* Update Changelog

* Fix trace flag name in Changelog

* Fix Changelog formatting

* Update Changelog

* Remove valid check at start of B3 injectg

This check makes sample only headers not propagate.

* Update B3 inject integration tests

Use the passed SpanContext and check directly the span ID.

* Update B3 integration tests

Run update checked SpanID to match sent.

Add tests to validate sample only transmissions and debug flag support.

* Rename injectTest parentSc to sc

This is no longer the parent.

* Update GetAllKeys for B3

* Un-Export the B3 headers

The B3SingleHeader name will conflict with the upcoming change to prefix
the SingleHeader encoding with "B3". There are a few options to address
this conflict, but in the end we do not need to be exporting these
values. They are duplicates of the OpenZipkin package and users should
use those.

* Rename B3 encodings and move support method to B3Encoding

Include a `B3` prefix to scope the encoding names.

Move the related support method to the B3Encoding itself, instead of the
B3 propagator.

Add tests to provide a sanity check for encoding bitmasks.

* Update span_context_test tests

Update test name to better describe how unused bits have no affect on
the sampling decision. Include the inverse of this test as well: not
sampled but has unused bits.

* Use named const for Single Header decoding widths

* Update api/trace/b3_propagator.go

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

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-07-07 16:38:52 -07:00
ET
463c458daf
Add more database-specific semantic attributes (#899)
* Adds Database-specific semantic attributes.

* Add CHANGELOG

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-07 09:22:26 -07:00
Matej Gera
5a4b68c7bf
Add semantic convention for faas.coldstart and container.id (#909)
* Add semantic convention for faas coldstart and container ID

* Update Changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-07 09:05:30 -07:00
ET
bd1e174e60
Add "peer.service" semantic to standard attributes (#898)
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
2020-07-06 11:36:49 -04:00
Tyler Yahn
8205b0b1e0
Update B3 header names (#881)
* Update B3 header names

Correct the B3 single header name from `X-B3` to `b3`.

Use the lowercase version of the B3 multiple headers. This is based on
the fact that HTTP headers are case-insensitive, however, other
protocols may not be.

* Update Changelog
2020-06-30 18:21:13 -07:00
Andrew
e8226c4e1d
Add default metrics to othttp instrumentation Fixes #542 (#861)
* Add default metrics to othttp instrumentation

* Changed metrics names, add tests, add standard labels to metrics

* Initialization global error handling, remove requests count metric, tuneup test

* Apply suggestions from code review

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

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-26 12:19:57 -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
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
0382850707
Rename AggregationSelector to AggregatorSelector (#859) 2020-06-23 10:51:15 -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
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
b2b914984d
Delay the sends to not overload 2020-06-09 17:21:01 -07:00
Tyler Yahn
388dbc785f
Update global handler_test.go
On slower VMs (like the CI VMs), this test was timing out in 2ms and
failing. Additionally, in the process of failing, the suite tear-down
function would reset the globalHandler and cause a race with the spawned
goroutine that was abandoned.

This increases the pause from 2ms to 10ms, unifies and simplifies the
wait logic, and stops the child goroutine on failure.
2020-06-09 12:07:23 -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
c50803d259
Update global Handler delegate to atomic value 2020-06-01 11:50:35 -07:00
Tyler Yahn
57e65fe7f8
Fix tests
Old tests were masking the underlying function they were trying to test.
2020-06-01 10:38:05 -07:00
Tyler Yahn
7967e53fd9
Fix spelling in handler_test.go 2020-06-01 09:28:27 -07:00
Tyler Yahn
e70d9092b1
Update global Handle
Move delegate call outside of lock to avoid deadlock.
2020-06-01 09:13:30 -07:00
Tyler Yahn
f736b8b0e2
Merge remote-tracking branch 'upstream/master' into oterror 2020-06-01 09:12:10 -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
Tyler Yahn
61f51b4f0e
Update Handler comments 2020-05-29 15:53:42 -07:00
Tyler Yahn
ec6512f656
Lint 2020-05-29 15:49:58 -07:00