Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge metric SDK development branch "new_sdk/main" into "main" #3175

Merged
merged 81 commits into from
Sep 16, 2022

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Sep 15, 2022

Closes #2818

Replaces #3173 with a non-protected branch merge.

Notable issues addressed in merge conflict resolution:

  • Rename the example/prometheus/go.mod module name back to what is on main (go.opentelemetry.io/otel/example/prometheus)
  • Keep project README.md listing the added back Prometheus exporter
  • Keep the revert of scope attribute addition that happened in Revert Changes that add attributes to scope. #3154

MrAlias and others added 30 commits April 20, 2022 07:50
* Remove prometheus example code

* Remove prometheus exporter code

* Remove stdoutmetric code

* Remove sdk/metric/* packages

* Remove opencensus example code

* Remove otlpmetric exporter code

* Remove OpenCensus bridge code

* go mod tidy

* Remove empty modules
* Remove prometheus example code

* Remove prometheus exporter code

* Remove stdoutmetric code

* Remove sdk/metric/* packages

* Remove opencensus example code

* Remove otlpmetric exporter code

* Remove OpenCensus bridge code

* go mod tidy

* Remove empty modules

* Add MeterProvider/meter structure to new SDK

* Add vanity imports

* go mod tidy

* Add MeterProvider Flush/Shutdown required by spec

* Cast nil ptr instead of alloc for comp time check

* Apply suggestions from code review

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>

* Apply suggested Shutdown comment

* Apply fixes from feedback

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
* Add sdk/metric/view package structure

* Vanity import
…ry#2885)

* Add the manual reader to the sdk.

* Incoperate feedback from PR.

* additional PR comments

* Fix lint

* Fixes for PR.

* Unexport ManualReader
fix a few comments
* Refactor reader testing into a harness

* Run lint
* Add the metric.Exporter interface

* Move the reader errors to reader.go

* Update Reader.Collect docs

Remove TODO being addressed in this PR and restate purpose of method.

* Initial draft of the periodic reader

* Refer to correct config in periodic reader opts

* Refactor reader testing into a harness

* Move wait group handling out of run

* Refactor ticker creation to allow testing

* Honor export timeout in run

* Fix wait group wait bug

* Add periodic reader tests

* Fix lint

* Update periodic reader comments

* Add concurrency test for readers

* Simplify the ticker stop deferral

* Only register once

* Restrict build of metric sdk to Go>1.16

* Clean up ShutdownBeforeRegister test
The specification requires the SDK prevent duplicate registrations for
readers. This adds a test for that and fixes this for the manualReader.
* Add WithReader and WithResource Options

* Run lint

* Update WithReader fn signature based on feedback

* crosslink

* Remove zero-len check in unify

* Restrict build to Go > 1.16
* Unify reader implementations

Use an atomic.Value to manage concurrency without a lock.

* Lint
* Use already enabled revive linter and add depguard (open-telemetry#2883)

* Refactor golangci-lint conf

Order settings alphabetically.

* Add revive settings to golangci conf

* Check blank imports

* Check bool-literal-in-expr

* Check constant-logical-expr

* Check context-as-argument

* Check context-key-type

* Check deep-exit

* Check defer

* Check dot-imports

* Check duplicated-imports

* Check early-return

* Check empty-block

* Check empty-lines

* Check error-naming

* Check error-return

* Check error-strings

* Check errorf

* Stop ignoring context first arg in tests

* Check exported comments

* Check flag-parameter

* Check identical branches

* Check if-return

* Check increment-decrement

* Check indent-error-flow

* Check deny list of go imports

* Check import shadowing

* Check package comments

* Check range

* Check range val in closure

* Check range val address

* Check redefines builtin id

* Check string-format

* Check struct tag

* Check superfluous else

* Check time equal

* Check var naming

* Check var declaration

* Check unconditional recursion

* Check unexported return

* Check unhandled errors

* Check unnecessary stmt

* Check unnecessary break

* Check waitgroup by value

* Exclude deep-exit check in example*_test.go files

* Move the minimum version to go 1.17 (open-telemetry#2917)

* Move the minimum version to go 1.17

* Update readme and changelog

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>

* Make lint

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* WIP views public

* Add attribute filters and comments.

* Fixes for lint

* Address comments

* Fix lint

* Changed view matching to expand end

Removed the dscriptor, it was moved in previous patch

* change wildcards into regex

* Update comments

* address comments.

* Address more PR comments

* renamed WithDescription to WithSetDescription.

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* Implement stubbed meter create method

* Rename return value to avoid comment

* Encapsulate meterRegistry tests with identifying name

* Run lint fix

* Comment meterRegistry being concurrent safe

* Remove ordered meter tracking in the meterRegistry

* Test range completeness instead of order

* Remove provider field from meter
…ind (open-telemetry#2949)

* Introduce Temporality and InstrumentKind

Because Temporality is the responsibility of the Reader additional methods
are added to the Reader interface.  And New options are created to
configure the temporality selector.

* Addresses comments, and adds tests.

* Fix addition PR comment
* Add aggregation pkg and options

* Update documentation for the aggregation pkg

* Test Aggregation.Err

* Fix aggregation pkg comment

* Add WithAggregation comment

* Add default aggregation

* Rename WithAggregation and add AggregationSelector

* Fix DefaultAggregationSelector use and decl

* Replace Aggregation struct with iface

* Add Copy method to hist and fix Err method

* Additional test for monotonic bounds

* Add aggregation method to Reader

* Use AggregationSelector instead of inline func type

* Switch RecordMinMax to NoMinMax

* Deep copy and validate in options

* Test the DefaultAggregationSelector

* nolint for import-shadow of method

* Fix Default aggregation comment

* Test the explicit bucket histogram deep copy
Match the WithAggregationSelector option pattern: define a
TemporalitySelector type, export the DefaultTemporalitySelector
function, and name the option with a Selector suffix.
* Add the aggtor package

* Restrict to Go 1.18

* Add missing build block to view_test.go

* Comment Aggregator iface

* Use Go 1.18 as the default ci version

* Update Aggregator iface from feedback

* Accept hist conf

* Flatten aggtor into just internal

* Add Cycler interface

Separate the duties of aggregation and maintaining state across
aggregation periods.

* Remove build flags for doc.go

* Clarify Cycler documentation

* Remove aggregation fold logic

* Rename Number to Atomic

* Add tests for Atomic impls

* Remove unneeded Atomic implementation

Add back when filling in structures.

* Fix article in Float64 docs

* Remove Atomic

This is an implementation detail.

* Add aggregator_example_test

* Fix hist example

* Add issue numbers to all TODO and FIXME

* Remove zero parameter comment

* Combine the cycler into the aggregators

* Remove the drop aggregator

* Fix lint

* Use attribute.Set instead of ptr to it

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Use already enabled revive linter and add depguard (open-telemetry#2883)

* Refactor golangci-lint conf

Order settings alphabetically.

* Add revive settings to golangci conf

* Check blank imports

* Check bool-literal-in-expr

* Check constant-logical-expr

* Check context-as-argument

* Check context-key-type

* Check deep-exit

* Check defer

* Check dot-imports

* Check duplicated-imports

* Check early-return

* Check empty-block

* Check empty-lines

* Check error-naming

* Check error-return

* Check error-strings

* Check errorf

* Stop ignoring context first arg in tests

* Check exported comments

* Check flag-parameter

* Check identical branches

* Check if-return

* Check increment-decrement

* Check indent-error-flow

* Check deny list of go imports

* Check import shadowing

* Check package comments

* Check range

* Check range val in closure

* Check range val address

* Check redefines builtin id

* Check string-format

* Check struct tag

* Check superfluous else

* Check time equal

* Check var naming

* Check var declaration

* Check unconditional recursion

* Check unexported return

* Check unhandled errors

* Check unnecessary stmt

* Check unnecessary break

* Check waitgroup by value

* Exclude deep-exit check in example*_test.go files

* Move the minimum version to go 1.17 (open-telemetry#2917)

* Move the minimum version to go 1.17

* Update readme and changelog

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>

* Use ByteSliceToString from golang.org/x/sys/unix (open-telemetry#2924)

Use unix.ByteSliceToString to convert Utsname []byte fields to strings.

This also allows to drop the charsToString helper which serves the same
purpose and matches ByteSliceToString's implementation.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

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

* docs: fix typo (open-telemetry#2935)

* add timeout to grpc connection in otel-collector example (open-telemetry#2939)

* Closes: open-telemetry#2951 (open-telemetry#2952)

This PR updates the example listed in the getting started doc
so that it will compile without error.  It also makes this
example consistent with the code found in
https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go

Signed-off-by: Brad Topol <btopol@us.ibm.com>

* fix data-model link (open-telemetry#2955)

* Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (open-telemetry#2960)

* Move to using Instrumentation Scope (open-telemetry#2976)

* Move to using Instrumentation Scope

* Use type alias, not definition

* Add a changelog entry

* docs(website_docs): fix exporting_data.md and getting-started.md toc (open-telemetry#2930)

* docs(website_docs): fix toc

* docs(website_docs): fix toc

* update exporting_data.md for rerun check-links

* update exporting_data.md for rerun check-links

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update getting-started.md (open-telemetry#2984)

grammar edit for line 175 of readme

* fix typo (open-telemetry#2986)

* fix typo

* spell fix

* typo fix (open-telemetry#2991)

* added traces.txt to gitignore for fib (open-telemetry#2993)

* Deprecate Library and move all uses to Scope (open-telemetry#2977)

* Deprecate Library and move all uses to Scope

* Add PR number to changelog

* Don't change signatures in stable modules

* Revert some changes

* Rename internal struct names

* A bit more renaming

* Update sdk/trace/span.go

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

* Update based on feedback

* Revert change

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

* Feat/bridge support text map (open-telemetry#2911)

* feat: support TextMap

* doc: add comment

* test: support for ot.TextMap

* Retrieve lost code due to merge

* fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders

* go mod tidy

* Optimized code style, add changelog

* doc: Restore comments

* wip: add test cases

* test: fix args error

* delete empty line

* Fix syntax and changelog errors

* Fix formatting errors

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Add a release template (open-telemetry#2863)

* Add a release template

* Update the about field

Co-authored-by: Damien Mathieu <42@dmathieu.com>

* Fix linting Issues

* Add ignore for template link

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Fix merge of CHANGELOG.md

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tobias Klauser <tobias.klauser@gmail.com>
Co-authored-by: petrie <244236866@qq.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Brad Topol <btopol@us.ibm.com>
Co-authored-by: Craig Pastro <pastro.craig@gmail.com>
Co-authored-by: Kshitija Murudi <kmurudi@ncsu.edu>
Co-authored-by: Petrie Liu <lpfvip2008@gmail.com>
Co-authored-by: Guangya Liu <gyliu513@gmail.com>
Co-authored-by: Craig Pastro <craig.pastro@auth0.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: ttoad <qq530901331@outlook.com>
@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #3175 (8e980ca) into main (0e6f9c2) will increase coverage by 1.0%.
The diff coverage is 72.0%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3175     +/-   ##
=======================================
+ Coverage   76.3%   77.3%   +1.0%     
=======================================
  Files        180     158     -22     
  Lines      12009   11082    -927     
=======================================
- Hits        9167    8575    -592     
+ Misses      2600    2310    -290     
+ Partials     242     197     -45     
Impacted Files Coverage Δ
...orters/otlp/otlpmetric/internal/oconf/envconfig.go 100.0% <ø> (ø)
...xporters/otlp/otlpmetric/internal/oconf/options.go 81.3% <ø> (ø)
exporters/otlp/otlpmetric/internal/oconf/tls.go 35.7% <ø> (ø)
sdk/metric/instrument.go 83.3% <ø> (ø)
sdk/metric/instrument_provider.go 80.0% <ø> (ø)
sdk/metric/internal/filter.go 100.0% <ø> (ø)
sdk/metric/internal/histogram.go 97.8% <ø> (ø)
sdk/metric/internal/lastvalue.go 100.0% <ø> (ø)
sdk/metric/internal/sum.go 100.0% <ø> (ø)
sdk/metric/manual_reader.go 84.6% <ø> (ø)
... and 35 more

Copy link
Member

@hanyuancheung hanyuancheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great news! Looking forward to seeing release version!

CHANGELOG.md Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics Part of OpenTelemetry Metrics pkg:SDK Related to an SDK package
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Merge the new_sdk/main branch into main
9 participants