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

30 Commits

Author SHA1 Message Date
Aaron Clawson
18f4cb85ec
[API EPIC 4/4] Fix tests and examples (#2587)
* Empty All of the metrics dir

* Add instrument api with documentation

* Add a NoOp implementation.

* Updated to the new config standard

* Address PR comments

* This change moves components to sdk/metrics

The Moved components are:
- metric/metrictest
- metric/number
- metric/internal/registry
- metric/sdkapi

* The SDK changes necessary to satasify the new api

* This fixes the remaing tests.

* Update changelog

* refactor the Noop meter and instruments into one package.

* Renamed pkg.Instruments to pkg.InstrumentProvider

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
2022-03-02 09:50:29 -06:00
Bogdan Drutu
4654d78104
Move Aggregator interface to aggregator package (#2444)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-12-15 08:13:48 -08:00
Bogdan Drutu
6cafa6a060
Remove sdk/export/metric module, embed into the sdk/metric (#2382)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-12-13 12:13:03 -08:00
Chester Cheung
a4f183be31
Remove metric MinMaxSumCount kind aggregation (#2423)
* remove metric MinMaxSumCount kind aggregation

* remove related files

* fix unittest

* fix changelog

* remove reference the removed aggregation type

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-12-06 11:47:40 -08:00
Joshua MacDonald
6483b5c114
Remove exact aggregator for histogram instruments (#2348)
* remove exact aggregator

* remove exact kind, including workaround in opencensus

* generate w/ go-1.16

* Apply suggestions from code review

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

* cleanup

* Apply suggestions from code review

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

Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-11-15 10:05:14 -08:00
Joshua MacDonald
478dc4fe40
Metrics: Move the non-API types into sdkapi (#2271)
* move Descriptor to sdkapi, add test

* rename Descriptor to sdkapi

* precommit

* Move the rest of the sdkapi

* use alias for Observation and Measurement

* Changelog

* pr num

* comment Measurement and Observation

* swap comments

* move->moved
2021-10-14 09:06:22 -07:00
Joshua MacDonald
3c8e1853f0
Separate InstrumentationLibrary from metric.Descriptor (#2197)
* factor instrumentation library out of the instrument descriptor

* SDK tests pass

* checkpoint work

* otlp and opencensus tests passing

* prometheus

* tests pass, working on lint

* lint applied: MetricReader->Reader

* comments

* Changelog

* Apply suggestions from code review

Co-authored-by: alrex <alrex.boten@gmail.com>

* remove an interdependency

* fix build

* re-indent one

* Apply suggestions from code review

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

* Lint&feedback

* update after rename

* comment fix

* style fix for meter options

* remove libraryReader, let Controller implement the reader API directly

* rename 'impl' field to 'provider'

* remove a type assertion

* move metric/registry into internal; move registry.MeterProvider into metric controller

* add test for controller registry function

* CheckpointSet->Reader everywhere

* lint

* remove two unnecessary accessor methods; Controller implements MeterProvider and InstrumentationLibraryReader directly, no need to get these

* use a sync.Map

* ensure the initOnce is always called; handle multiple errors

* Apply suggestions from code review

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

* cleanup locking in metrictest

* Revert "ensure the initOnce is always called; handle multiple errors"

This reverts commit 3356eb5ed0.

* Revert "use a sync.Map"

This reverts commit ea7bc599bd.

* restore the TODO about sync.Map

Co-authored-by: alrex <alrex.boten@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-09-27 08:51:47 -07:00
Joshua MacDonald
a7b9d02167
Rename metric instruments to match feature-freeze API specification (#2202)
* s/ValueRecorder/Histogram/g

* s/ValueObserver/GaugeObserver/g

* s/UpDownSumObserver/UpDownCounterObserver/g

* s/SumObserver/CounterObserver/g

* changelog

* pr num

* unstable->experimental

* Apply suggestions from code review

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

* Apply suggestions from code review

* apply feedback from @evantorrie by hand

* Apply suggestions from code review

Thanks

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

* Update sdk/export/metric/metric.go

* Apply suggestions from code review

Thank you @evantorrie !

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

* revert getting-started fix let tyler's update remove this text

* more variable name fixes

* test repair

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-09-01 16:38:37 -04:00
Joshua MacDonald
df384a9a33
Move InstrumentKind into the new metric/sdkapi package (#2091)
* Move InstrumentKind into the new metric/sdkapi package

* remove the alias

* remove the alias (everywhere)

* Changelog

* Add a test

* merge updates

* fix changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-08-11 16:02:28 -07:00
Joshua MacDonald
c56227771d
Histogram aggregator functional options (#1434)
* Add a Config/Option for histogram

* Just one option here

* Test fixes

* Support and test int64 histograms

* Changelog

* Lint

* Un-export three things.
2021-01-15 18:29:02 -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
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
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
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
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
Joshua MacDonald
0382850707
Rename AggregationSelector to AggregatorSelector (#859) 2020-06-23 10:51:15 -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
jmacd
dacebd6430 Use []float64 for boundaries 2020-05-21 10:29:03 -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
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
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
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
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
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
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
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
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
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
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