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

858 Commits

Author SHA1 Message Date
Tyler Yahn
b7f634a4fe
Decouple use of otel/internal/internaltest (#4424)
* Add internaltest templates

* Generate internaltest using gotmpl

* Generate the sdk/internal/internaltest pkg

* Use sdk/internal/internaltest in sdk module

* Generate exporters/jaeger/internal/internaltest pkg

* Use exporters/jaeger/internal/internaltest in jaeger exporter

* Generate the exporters/zipkin/internal/internaltest pkg

* Use local internaltest in zipkin exporter

* Fix import path name in trace test
2023-08-09 09:15:47 +02:00
Robert Pająk
663151966d
Minor refactoring (#4417) 2023-08-08 14:26:44 +02:00
Jared Jenkins
b221025a4c
sdk/resource: Fix data race with emptyAttributes (#4409)
* Fix ASAN bug with emptyAttributes.

If mutliple instantiations of a Resources struct are happening
in parallel, they can end up modifying the same underlying resource.

* Capture literal

* add test

* remove unwanted change

* Update sdk/resource/resource_test.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update sdk/resource/resource_test.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update sdk/resource/resource_test.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update sdk/resource/resource_test.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Add changelog.

* Update CHANGELOG.md

Co-authored-by: Robert Pająk <pellared@hotmail.com>

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-08-07 10:22:48 -07:00
Tyler Yahn
9452b93012
Upgrade all use of semconv to v1.21.0 (#4408)
* Upgrade all use of semconv to v1.21.0

* Add change to changelog

* Add AIX and ZOS OS support

* Upgrade semconv for merged changes

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-08-07 09:30:40 -07:00
OpenTelemetry Bot
ac6cd49ae2
dependabot updates Sun Aug 6 09:27:21 UTC 2023 (#4416)
Bump golang.org/x/sys from 0.10.0 to 0.11.0 in /sdk
Bump golang.org/x/tools from 0.11.0 to 0.11.1 in /internal/tools
Bump go.opentelemetry.io/build-tools/crosslink from 0.10.0 to 0.11.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/semconvgen from 0.10.0 to 0.11.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/dbotconf from 0.10.0 to 0.11.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/multimod from 0.10.0 to 0.11.0 in /internal/tools
2023-08-06 11:37:32 +02:00
Aaron Clawson
248413d654
Add the Exponential Histogram Aggregator. (#4245)
* Adds Exponential Histograms aggregator

* Added aggregation to the pipeline.

Adjust to new bucket

* Add no allocation if cap is available.

* Expand tests

* Fix lint

* Fix 64 bit math on 386 platform.

* Fix tests to work in go 1.19.
Fix spelling error

* fix codespell

* Add example

* Update sdk/metric/aggregation/aggregation.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update sdk/metric/aggregation/aggregation.go

* Update sdk/metric/aggregation/aggregation.go

* Changelog

* Fix move

* Address feedback from the PR.

* Update expo histo to new aggregator format.

* Fix lint

* Remove Zero Threshold from config of expo histograms

* Remove DefaultExponentialHistogram()

* Refactor GetBin, and address PR Feedback

* Address PR feedback

* Fix comment in wrong location

* Fix misapplied PR feedback

* Fix codespell

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-08-04 11:57:44 -07:00
Robert Pająk
c4d2d7c9b8
sdk/metric: Add unit tests for Shutdown WithTimeout (#4379)
* sdk/metric: Improve WithTimeout doc

* Add tests
2023-08-02 07:52:04 -07:00
Tyler Yahn
2899fcfdca
Document the Reader and Exporter concurrent safe requirements (#4381) 2023-07-30 22:26:17 +02:00
Tyler Yahn
9418aca877
Use PeriodicReader timeout for ForceFlush (#4377)
* Use PeriodicReader timeout for ForceFlush

Prioritize the user passed context deadline if it has one.

* Update changelog
2023-07-29 07:33:48 -07:00
Tyler Yahn
859a87098c
Simplify the histogram implementation (#4370) 2023-07-27 14:06:22 -07:00
Robert Pająk
4f0d73cbc2
sdk/trace: Refine context cancellation in batchSpanProcessor.ForceFlush (#4369) 2023-07-27 10:05:52 +02:00
Tyler Yahn
b4264c53bc
Simplify the sum aggregators (#4357)
* Simplify the sum aggregators

* Comment how memory reuse misses are handled
2023-07-26 13:32:45 -07:00
Robert Pająk
d5d631852a
Remove redundant TestBatchSpanProcessorForceFlushCancellation (#4367) 2023-07-26 13:51:21 +02:00
Robert Pająk
e557e74cc2
Improve readers Collect docs (#4361) 2023-07-26 12:14:44 +02:00
Aaron Clawson
d423bd4cf2
Add tests for malformed selectors in readers (#4350) 2023-07-25 11:25:38 +02:00
David Ashpole
c1a644a10c
PeriodicReader.Shutdown now applies the periodic reader's timeout by default (#4356) 2023-07-25 11:00:16 +02:00
Robert Pająk
d8d3502efc
sdk/metric: Fix goroutine leaks in tests (#4352) 2023-07-25 10:54:08 +02:00
Robert Pająk
088ac8e179
Fix panic, deadlock and race in BatchSpanProcessor (#4353) 2023-07-25 10:13:45 +02:00
Tyler Yahn
e26d8bd8f8
Remove benchmark dev files mistakenly added in #4349 (#4358) 2023-07-24 11:03:09 -07:00
Tyler Yahn
ab61991465
Log a view suggestion for duplicate instrument conflicts (#4349)
* Log a view suggestion for duplicate instrument conflicts

* Add change to changelog

* Update changelog entry
2023-07-24 07:47:56 -07:00
Robert Pająk
fd5284f75c
styleguide: tests goroutine leaks and naming (#4348)
* internal/global: Fix goroutine leaks in tests
2023-07-24 09:35:06 +02:00
Tyler Yahn
cbc5890d9c
Simplify the last-value aggregate (#4343)
Instead of treating the returned *lastValue as an aggregator from
newLastValue, just use the type directly to construct the Measure and
ComputeAggregation functions returned from the Builder.

Accept a destination type for the underlying computeAggregation. This
allows memory reuse for collections which adds a considerable
optimization.

Simplify the integration testing of the last-value aggregate.

Update benchmarking.
2023-07-21 08:30:11 +02:00
Tyler Yahn
a37cb0504a
Replace filter aggregator with direct filter on measure (#4342)
* Replace filter aggregator with direct filter on measure

Part of #4220

Instead of using an aggregator to filter measured attributes, directly
filter the attributes in the constructed Measure function the Builder
creates.

Include unit and integration testing of new filtering.

* Update sdk/metric/internal/aggregate/aggregate.go

Co-authored-by: David Ashpole <dashpole@google.com>

---------

Co-authored-by: David Ashpole <dashpole@google.com>
2023-07-20 13:53:50 -07:00
Tyler Yahn
e08359f30c
Detect duplicate instruments for case-insensitive names (#4338)
* Detect dup inst for case-insensitive names

Resolve #3835

Detect duplicate instrument registrations for instruments that have the
same case-insensitive names. Continue to return the instruments with
different names, but log a warning. This is the solution proposed in
https://github.com/open-telemetry/opentelemetry-specification/pull/3606.

* Add changes to changelog

* Reset global logger after test
2023-07-19 10:17:38 -07:00
Tyler Yahn
84b2e54671
Use inst ID for agg cache key (#4337)
* Use inst ID for agg cache key

Resolve #4201

The specification requires the duplicate instrument conflicts to be
identified based on the instrument identifying fields:

- name
- instrument kind
- unit
- description
- language-level features such as the number type (int64 and float64)

Currently, the conflict detection and aggregation caching are done based
on the stream IDs which include an aggregation name, monotonicity, and
temporality instead of the instrument kind.

This changes the conflict detection and aggregation caching to use the
OpenTelemetry specified fields. This is effectively a no-op given there
is a 1-to-1 mapping of aggregation-name/monotonicity/temporality to
instrument kind (they are all resolved based on the instrument kind).

Additionally, this adds a stringer representation of the
`InstrumentKind`. This is needed for the logging of duplicate instrument
conflicts.

* Add changes to changelog
2023-07-19 09:59:07 -07:00
David Ashpole
c197fe9305
Metric SDK: Sum duplicate async observations regardless of filtering (#4289)
* Metric SDK: Remove the distinction between filtered and unfiltered attributes.
2023-07-19 10:52:11 -05:00
Tyler Yahn
f2a9f2f2be
Restrict Meters to only register and collect instruments it created (#4333)
* Add acceptance test

* Update Meter Register and collect only inst from itself

* Add change to changelog

* Fix spelling error

* Update changelog entry wording

* Simplify the partial success code path
2023-07-19 07:31:11 -07:00
Tyler Yahn
f194fb0c6c
Allow histogram for all instruments (#4332)
* Allow histogram for all instruments

Any instrument that can record negative values, do not include a sum in
the produced aggregation (like the specification recommends).

Resolves #4161

* Add changes to changelog

* Fix TestBucketsSum
2023-07-19 07:12:00 -07:00
Matthew Wear
9b0c4d2caf
Fix empty host.id (#4317) 2023-07-18 17:37:20 +02:00
Aaron Clawson
f6a658c6c2
Remove out of date example of internal usage. (#4334) 2023-07-18 10:10:34 +02:00
Tyler Yahn
63dfc4c2f1
Update the instrument agg comp table (#4330)
Use a check mark to indicate compatible instead of an "X" which can be
misinterpreted as incompatible.
2023-07-17 11:17:35 -07:00
Tyler Yahn
7467923a51
Add info/debug logging to the metric SDK (#4315)
* Add debug logging to the metric SDK

Resolves #3722

* Log MeterProvider and Meter setup at info level

* Add changelog entry

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-07-17 07:57:01 -07:00
Tyler Yahn
d18f20179e
Replace internal aggregate Aggregator with Measure/ComputeAggregation and a Builder (#4304) 2023-07-17 16:15:50 +02:00
Tyler Yahn
55fb2bb57b
Log an error for an empty view criteria (#4307)
* Log an error for an empty view

Resolves #4149

* Add changelog entry
2023-07-12 15:10:40 -07:00
Tyler Yahn
fcc67096b5
Add test for multi-inst view error (#4308) 2023-07-12 15:01:14 -07:00
David Ashpole
de26aaa52e
Metric SDK: Do not export non-observed attribute sets for async instruments (#4290)
* drop non-observed attribute sets

* fix test comment

* add documentation for async callbacks dropping unobserved attributes
2023-07-11 07:19:38 -07:00
OpenTelemetry Bot
8b7bffc8b9
dependabot updates Sun Jul 9 14:40:56 UTC 2023 (#4301)
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /bridge/opentracing/test
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlptrace/otlptracegrpc
Bump golang.org/x/tools from 0.10.0 to 0.11.0 in /internal/tools
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlptrace
Bump benchmark-action/github-action-benchmark from 1.17.0 to 1.18.0
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /example/otel-collector
Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlpmetric
Bump golang.org/x/sys from 0.9.0 to 0.10.0 in /sdk
2023-07-09 20:25:46 +02:00
Tyler Yahn
1633c74aea
Replace Stream.AttributeFilter with AllowAttributeKeys (#4288)
* Replace Stream AttributeFilter with AttributeKeys

* Rename Stream field AttributeKeys to AllowAttributeKeys

Ensure forward compatibility if a deny-list of attribute keys is ever
added.

* Add change to changelog

* Update PR number in changelog

* Update CHANGELOG.md

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

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2023-07-08 08:01:47 -07:00
Tyler Yahn
10c3445543
Move aggs to internal/aggregate (#4283) 2023-07-03 10:53:00 +02:00
Tyler Yahn
97273da7c9
Use newPipeline instead of direct construction (#4285)
* Use newPipeline instead of direct construction

The newPipeline function exists to create a new pipeline, but it is not
currently used. This switches to using that as the default creation
method and removes the test for construction of a pipeline directly.

* Update sdk/metric/pipeline.go
2023-07-02 07:17:46 -07:00
Damien Mathieu
64e76f8be4
Document and test honoring context in metric readers Collect (#4267) 2023-06-29 13:20:47 +02:00
Damien Mathieu
3b124b39d1
Count the Collect duration towards the PeriodicReader timeout, and document the behavior (#4221) 2023-06-26 08:47:39 +02:00
Robert Pająk
0396b9b7ac
sdk/metric: Document concurrent safety (#4252) 2023-06-23 16:25:54 +02:00
Robert Pająk
6b262b44ac
sdk/metric: Reader factories return structs (#4244) 2023-06-22 09:09:00 +02:00
OpenTelemetry Bot
e3f547fedd
dependabot updates Tue Jun 20 09:20:10 UTC 2023 (#4240)
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /bridge/opentracing/test
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /example/view
Bump github.com/golangci/golangci-lint from 1.53.2 to 1.53.3 in /internal/tools
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /exporters/prometheus
Bump golang.org/x/tools from 0.9.3 to 0.10.0 in /internal/tools
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlpmetric
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlptrace/otlptracegrpc
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlptrace
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /example/prometheus
Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /example/otel-collector
Bump golang.org/x/sys from 0.8.0 to 0.9.0 in /sdk
2023-06-20 11:38:28 +02:00
Aaron Clawson
b757c7083b
Exponential Histogram Datatypes (#4165)
* Adds the Exponential histogram data type.

* Changelog

* Updated comments

* Apply suggestions from code review

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Split Exponential Buckets into it's own type

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-06-14 07:36:13 -07:00
Damien Mathieu
844b107e98
Validate instrument names when creating them (#4210)
* validate instrument names when creating them

* add changelog entry

* remove now invalid instrument name from prometheus test

* fix invalid names in meter_test

* keep returning the instrument even if its name is invalid

* make invalid instrument name a known error

* bring back prometheus invalid instrument name test

* remove warning

* fix lint

* move name validation into the lookup method

* fix lint again

* Revert "move name validation into the lookup method"

This reverts commit ec8ccc5fa0.

* rename ErrInvalidInstrumentName to ErrInstrumentName

* switch to explicit validations, instead of a regexp

* Update CHANGELOG.md

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

* remove double check for empty name

* test validation shortcut with a single character

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-06-09 08:32:56 -07:00
Tyler Yahn
ce46eb5f85
Warn instead of Info log instrument conflict (#4202)
* Warn instead of Info log instrument conflict

* Add change to changelog
2023-06-06 15:22:34 -07:00
OpenTelemetry Bot
135c64f289
dependabot updates Mon Jun 5 09:32:52 UTC 2023 (#4198)
Bump go.opentelemetry.io/build-tools/crosslink from 0.7.0 to 0.8.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/dbotconf from 0.7.0 to 0.8.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/multimod from 0.7.0 to 0.8.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/semconvgen from 0.7.0 to 0.8.0 in /internal/tools
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/zipkin
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace/otlptracehttp
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opentracing/test
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/internal/retry
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric/otlpmetrichttp
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace/otlptracegrpc
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/jaeger
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/stdout/stdouttrace
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/stdout/stdoutmetric
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /schema
Bump github.com/itchyny/gojq from 0.12.12 to 0.12.13 in /internal/tools
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /metric
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /trace
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/prometheus
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opencensus
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /sdk/metric
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opentracing
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /sdk
2023-06-05 11:41:23 +02:00
Damien Mathieu
be82610b44
Return noop meters once the provider has been shutdown (#4154) 2023-06-05 09:51:21 +02:00
Robert Pająk
8cddf8cf1f
sdk/metric: Log empty meter name (#4153)
* sdk/metric: Log empty meter name

* Avoid magic numbers

* Lint

* Apply suggestions from code review

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

* Update log message

* Apply suggestion

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-06-01 09:56:17 +02:00
Robert Pająk
f9565872df
sdk/metrics: Fix MeterProvider.Meter Go doc (#4152) 2023-06-01 09:28:29 +02:00
Tyler Yahn
e0852d609c
Release v1.16.0/v0.39.0 -- Stable Metric API (#4100)
* Update versions

* Prepare stable-v1 for version v1.16.0

* Prepare experimental-metrics for version v0.39.0

* Update changelog
2023-05-22 12:06:21 -07:00
OpenTelemetry Bot
3fca55af7a
dependabot updates Sun May 21 15:20:04 UTC 2023 (#4126)
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/zipkin
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opentracing/test
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /schema
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/internal/retry
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/prometheus
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/stdout/stdoutmetric
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric/otlpmetrichttp
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace/otlptracegrpc
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/stdout/stdouttrace
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace/otlptracehttp
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /metric
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /trace
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/jaeger
Bump codecov/codecov-action from 3.1.3 to 3.1.4
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /sdk/metric
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opencensus
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opentracing
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /sdk
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
2023-05-21 08:45:32 -07:00
Andrew Womeldorf
987422d55f
sdk/metric: Fix import comments (#4086)
* Resolve inconsistent import comments in sdk/metric

* update changelog

* Apply suggestions from code review

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

* Update CHANGELOG.md

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-05-19 09:25:11 -07:00
Mikhail Mazurskiy
f95bee22b9
Use strings.Cut() instead of string.SplitN() (#4049)
strings.Cut() generates less garbage as it does not allocate the slice to hold parts.
2023-05-17 09:28:44 -07:00
Chen Xu
fadd3d6a63
[SDK][Trace] Add tests for default id generator (#4043)
Signed-off-by: Chen Xu <chen.x@uber.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-05-15 07:18:43 -07:00
Robert Pająk
24e8d2e574
sdk/resource: Add Telemetry Stability label (#4080)
* Add Telemetry Stability label

* Update sdk/resource/doc.go

* Update doc.go

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-05-11 07:25:32 -07:00
Robert Pająk
7dea2225a2
sdk/resource: Fix build for BSD OSes (#4077)
* sdk/resource: Fix build for BSD OSes

* Add changelog

* Update header in changelog

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-05-10 07:47:41 -07:00
Robert Pająk
4d473d105a
[chore] Pin otel-specification hyperlinks (#4033)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-05-09 08:45:39 -07:00
Rakshit Parashar
c338d8eb8a
added version.go and test file for issue 2143 (#3677)
* added version.go and test file for issue 2143

* added license in metric versiont_test

* goimport file linting

* update trace version to v.1.13.0 and metric to 0.36.0

* Update sdk/metric/version.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* using asser.Regxp

* changing regex string as per recommendations

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* changing regex string as per recommendations

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* reverting go mod and go sum changes

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* trace and metric version bump up

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* version update in sdk/metric , sdk/trace

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* doc typo fix

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>

* Apply suggestions from code review

---------

Signed-off-by: ChillOrb <rakshitparashar1@gmail.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-05-09 08:29:19 -07:00
OpenTelemetry Bot
1b04bbc681
dependabot updates Sun May 7 14:59:33 UTC 2023 (#4072)
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /bridge/opentracing/test
Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /example/view
Bump github.com/prometheus/client_model from 0.3.0 to 0.4.0 in /exporters/prometheus
Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /exporters/prometheus
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlptrace
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlptrace/otlptracegrpc
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlpmetric
Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /example/otel-collector
Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /example/prometheus
Bump golang.org/x/sys from 0.7.0 to 0.8.0 in /sdk
2023-05-07 08:11:23 -07:00
Tyler Yahn
e6839571d2
Release v1.16.0-rc.1/v0.39.0-rc.1 (#4048)
* Bump versions

* Prepare stable-v1 for version v1.16.0-rc.1

* Prepare experimental-metrics for version v0.39.0-rc.1

* Update changelog

* Update CHANGELOG.md
2023-05-03 19:39:01 -07:00
Tyler Yahn
17903bcdb6
Revert "Move global metric back to otel/metric/global for minor release (#3986)" (#4039)
* Revert "Move global metric back to `otel/metric/global` for minor release (#3986)"

This reverts commit 8dba38e02f.

* Add changes to changelog

* Fix versions and go mod tidy

* Run go-mod-tidy
2023-05-02 11:15:39 -07:00
Tyler Yahn
fc96138629
Release v1.15.1/v0.38.1 (#4046)
* Bump versions

* Prepare stable-v1 for version v1.15.1

* Prepare experimental-metrics for version v0.38.1

* Update changelog
2023-05-02 10:18:20 -07:00
Ashvitha
dde1930477
Remove unused imports in host_id_bsd.go (#4041)
* remove unused imports in host_id_bsd.go

* Add changelog entry

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-05-01 08:07:05 -07:00
Tyler Yahn
8e76ab23b4
Release v1.15.0/v0.38.0 (#4035)
* Bump versions

* Prepare stable-v1 for version v1.15.0

* Prepare experimental-metrics for version v0.38.0

* Fix otlpmetric tests

Check pre 1.0 as well

* Update the chagelog
2023-04-28 07:48:08 -07:00
Robert Pająk
180b35513a
Move readFile and execCommand to seperate files (#4015)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-04-27 11:39:09 -07:00
Tyler Yahn
15d6ba2921
Unify metric API into the one otel/metric package (#4018)
* Move instrument into metric

* Update metric docs to include instrument

* Update package names

* Update all imports of sdk/metric/instrument

* Rename Option to InstrumentOption

* Deprecate otel/metric/instrument

* Add changelog entry
2023-04-27 11:25:48 -07:00
Tyler Yahn
f8fcfda872
Add options to measurement methods (#3971)
* Add options to measurement methods

* Update noop

* Update global impl

* Update SDK impl

* Fix metric API example

* Update prometheus exporter tests

* Update examples

* WithAttributes and WithAttributeSet

* Add changes to changelog

* Accept slice instead of variadic to new conf funcs

* Clarify WithAttributes performance in docs

* Address feedback about WithAttributes comment

* Add changelog entry for WithAttribute{s,Set}

* Remove number scope from measure opts

* Update changelog

* Remove left-over test cases

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-04-18 07:16:06 -07:00
Tyler Yahn
4b5abe06d2
Refactor the metric SDK benchmarks (#3992)
Benchmark all instruments, not just an int64 counter.

Include benchmarks for all synchronous measurement methods.

Include benchmarks for all collections.
2023-04-14 07:51:10 -07:00
Remy Chantenay
cf8367f711
Fix Version test in otel/sdk (#3994)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-04-14 07:41:27 -07:00
Kaushal Shah
37388599eb
Fixed race condition in OnEnd and added a unit test (#3951)
* Fixed race condition in OnEnd and added a test

* fixed code review comments

* fixed lint

* Update CHANGELOG.md

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update sdk/trace/simple_span_processor_test.go

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

* Update sdk/trace/simple_span_processor_test.go

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

* Update sdk/trace/simple_span_processor_test.go

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

* fixed panic check

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-04-14 07:23:47 -07:00
Tyler Yahn
8dba38e02f
Move global metric back to otel/metric/global for minor release (#3986)
* Revert "Remove the deprecated `otel/metric/global` pkg (#3829)"

This reverts commit 60f7d42d1e.

* Revert "Support a global MeterProvider in `go.opentelemetry.io/otel` (#3818)"

This reverts commit 813936187e.

* Remove top level metric global

* Add change to changelog
2023-04-13 07:39:39 -07:00
Charlie Le
1b55281859
docs(typos): Run codespell to fix typos (#3980)
* docs(typos): Run codespell to fix typos

There were a lot of typos through the repository, so I ran
[codespell][], a tool for automatically fixing typos, to fix them.

```console
make codespell
```

There's already a tool called [misspell][] that's supposed to take care
of this, but misspell hasn't been updated for 6 years, and it doesn't
seem to be catching any of the typos that codespell can.

[codespell]: https://github.com/codespell-project/codespell
[misspell]: https://github.com/client9/misspell

* Revert and ignore spelling for Consequentially

* Add GH workflow for codespell

* Revert GH Workflow and Makefile for codespell

Per @pellared, since there's no instructions for setting up codespell,
it was suggested that the changes for setting up a workflow and section
in Makefile include instructions for setting up codespell as well.

* Revert spelling on consequently

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-04-11 17:28:13 -07:00
Remy Chantenay
1b97d78324
Add Version func to otlpmetric and otlptrace (#3956)
* Add Version func to otel/exporters/otlp/otlpmetric

* Add Version func to otel/exporters/otlp/otlptrace

* Remove Version func from otel/exporters/otlp/internal

* Update CHANGELOG.md

* Add nolint rule to hostid readFile

* Move GetUserAgentHeader to internal packages

* Update exporters/otlp/otlpmetric/version.go

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

* Update exporters/otlp/otlptrace/version.go

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

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-04-10 14:19:49 -07:00
OpenTelemetry Bot
a261a0f869
dependabot updates Sun Apr 9 14:31:33 UTC 2023 (#3979)
Bump golang.org/x/tools from 0.7.0 to 0.8.0 in /internal/tools
Bump golang.org/x/sys from 0.6.0 to 0.7.0 in /sdk
2023-04-09 07:43:00 -07:00
Damien Mathieu
02fa1e2a8d
Fix aggregation.Default to properly return the default one (#3967)
* fix aggregation.Default to properly return the default one

* add changelog entry

* default aggregation does not error anymore

* test all instrument kinds
2023-04-05 07:44:48 -07:00
Tyler Yahn
65ebe5e50f
Add embedded private method interfaces in metric API (#3916)
* PoC of embedded private method ifaces

* Rename embed to embedded

* Add an embedded iface for all instruments

* Fix metric/instrument tests

* Fix global and otel

* Fix SDK

* Comment the embedded pkg types

* Update the embedded pkg docs

* Update otel/metric docs about impls

* Update otel/metric type docs on impl

* Update docs in otel/metric/instrument on default

* Add changes to changelog

* Apply suggestions from code review

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Apply feedback on URLs

* Reword based on feedback

* Make it clear we only recommended embedding noop

* Ignore links with godot linter

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-04-03 07:33:19 -07:00
OpenTelemetry Bot
5f13db5ca6
dependabot updates Sun Apr 2 15:32:08 UTC 2023 (#3963)
Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /exporters/zipkin
Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /exporters/jaeger
Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /sdk/metric
Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /sdk
Bump github.com/go-logr/logr from 1.2.3 to 1.2.4
2023-04-02 12:10:19 -04:00
Mikhail Mazurskiy
22fd10447d
Unify TracerProvider span processor lookups (#3942)
* Pre-allocate spanProcessorStates slice

* Make sync.Once a non-pointer

It doesn't need to be a pointer, can be part of the struct to avoid allocating a separate object for it

* getSpanProcessors() helper

* Add tests for UnregisterSpanProcessor()
2023-04-01 07:57:35 -07:00
Tyler Yahn
271df1dc01
Add Version func to otel/sdk (#3949)
* Add Version func to otel/sdk

* Update sdk/resource to use sdk version

* Remove unused UserAgent from sdk/internal

* Add changes to changelog

* Update CHANGELOG.md

Co-authored-by: Robert Pająk <pellared@hotmail.com>

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-03-30 12:49:39 -07:00
Tyler Yahn
f4a9d78e7f
Update Histogram Extrema and Sum to be generic (#3870)
* Update Histogram Extrema and Sum to be generic

* Update metric SDK

* Update exporters

* Add changes to changelog
2023-03-29 11:24:25 -07:00
Mikhail Mazurskiy
c4940f3b43
TracerProvider allows calling Tracer() while it's shutting down (#3924) 2023-03-27 17:05:44 -07:00
Damien Mathieu
ae90c4402e
switch atomic.Value to atomic.Pointer for spanProcessorStates (#3926)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-03-27 09:38:47 -07:00
Eduardo Bonzi da Conceição
b73a33c487
Warn on intitialization of Simple SpanProcessor (#3854)
* add warning log about using simpleSpanProcessor in production

* add changelog entry

* fix changelog

* switch to using the new Warn logging function

* revert alignment formatting in changelog

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-03-24 08:29:52 -07:00
Tyler Yahn
7ad0ae4da1
Release v1.15.0-rc.2/v0.38.0-rc.2 (#3923)
* Bump versions

* Prepare stable-v1 for version v1.15.0-rc.2

* Prepare experimental-metrics for version v0.38.0-rc.2

* Update changelog

* Update CHANGELOG.md

Co-authored-by: Robert Pająk <pellared@hotmail.com>

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-03-23 07:47:46 -07:00
Mikhail Mazurskiy
e4cc478c02
TracerProvider doesn't allow to register a SpanProcessor after shutdown (#3845) 2023-03-22 09:47:42 -07:00
Matthew Wear
282a47e3d3
add host.id to resource auto-detection (#3812)
* add platform specific hostIDReaders

* add WithHostID option to Resource

* add changelog entry

* Apply suggestions from code review

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

* linting

* combine platform specific readers and tests

This allows us to run tests for the BSD, Darwin, and Linux readers
on all platforms.

* add todo to use assert.AnError after resource.Detect error handling is updated

* move HostID test utilities to host_id_test

* return assert.AnError from mockHostIDProviderWithError

* use assert.ErrorIs

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

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-03-21 14:45:30 -05:00
Tyler Yahn
90df52586b
Split metric configuration down to instrument (#3895)
* Split metric configuration down to instrument

* Rename *ObserverOptions to *ObservableOption

* Update option docs with links
2023-03-21 08:16:57 -05:00
Tyler Yahn
b7b53bba40
Remove Synchronous and rename Asynchronous (#3892)
* Remove the Synchronous interface

* Rename Asynchronous to Observable

* Update PR number
2023-03-20 13:26:17 -07:00
Sinan Ülker
7fc24d2b14
Update the metric Export interface to accept a *ResourceMetrics instead of ResourceMetrics (#3853)
* Change the signature of Export method

* Pass tests for otlp exporter

* Pass tests for otlp grpc and http packages

* Update opencensus bridge

* Refactor and pass tests for stdoutmetric package

* Update periodic reader tests

* Update changelog

* Apply suggestions

* Apply suggestions

* Update CHANGELOG.md

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-03-16 10:58:43 -07:00
Mori
3a40e65a38
Update go directive value in go.mod files to 1.19 (#3850)
* remove go 1.18 in go.mod, add go 1.19

* revert //+build directives

* remove +build directives

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-03-15 09:52:04 -07:00
Tyler Yahn
01b8f15a72
Add Exemplar to metricdata package (#3849)
* Add Exemplar to metricdata pkg

* Update histogram Aggregator

* Update opencensus bridge

* Update prometheus exporter

* Update OTLP exporter

* Update stdoutmetric exporter

* Add changes to changelog

* Update fail tests

* Add tests for IgnoreExemplars

* Fix merge
2023-03-14 07:56:18 -07:00
Tyler Yahn
b62eb2ca88
Pool sortables used to create attribute sets (#3832)
* Pool sortables used to create attribute sets

* Move sync pool to attribute pkg

* Add change to changelog

* Fix comment

* Apply suggestions from code review

Co-authored-by: Peter Liu <lpfvip2008@gmail.com>

* Update sdk/metric/instrument.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Update comment based on feedback

* Apply feedback

---------

Co-authored-by: Peter Liu <lpfvip2008@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-03-13 11:19:28 -07:00
Aaron Clawson
e463505da7
Reuse memory in metric pipelines (#3760)
* Have pipelines reuse memory

* truncate Metric slice

* Apply suggestions from code review

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

* Use rm pool on periodic shutdown.

* zero out RM on ctx error

* Update sdk/metric/pipeline.go

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

* Apply suggestions from code review

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

* Fix lint

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Peter Liu <lpfvip2008@gmail.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2023-03-09 09:43:16 -08:00
Tyler Yahn
7dc7b30405
Remove unneeded type argument from metric SDK (#3831)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-03-09 07:33:18 -08:00
Tyler Yahn
1626ff746f
Wrap errors returned from Detect and New in sdk/resource (#3844)
* Update Detect and New to wrap errors

* Add TestNewWrapedError

Test that New returns an error that can be unwrapped.

* Add changes to changelog

* Clarify and simplify errors
2023-03-08 15:15:27 -08:00
OpenTelemetry Bot
3df561e644
dependabot updates Mon Mar 6 15:33:46 UTC 2023 (#3840)
Bump github.com/itchyny/gojq from 0.12.11 to 0.12.12 in /internal/tools
Bump golang.org/x/sys from 0.5.0 to 0.6.0 in /sdk
2023-03-06 07:40:41 -08:00
Tyler Yahn
34aacd95ff
Release v1.15.0-rc.1 (#3825)
* Bump module set versions

* Prepare stable-v1 for version v1.15.0-rc.1

* Prepare experimental-metrics for version v0.38.0-rc.1

* Update changelog
2023-03-02 07:43:27 -08:00
Tyler Yahn
813936187e
Support a global MeterProvider in go.opentelemetry.io/otel (#3818)
* Move ErrorHandler impl to internal

To avoid the import cycle, the otel/metric package needs to not import
otel. To achieve this, the error handling implementation is moved to the
otel/internal/global package where both can import the needed
functionality.

* Add global metric to go.opentelemetry.io/otel

* Crosslink and update to global metric in otel

* Add changes to changelog

* Set PR number in changelog

* Add global metric unit tests

* Rename MeterProivder() to GetMeterProivder()

* Add TODO to remove nolint comments
2023-03-01 11:16:03 -08:00
Robert Pająk
d0e4a438ef
Handle empty env vars as it they were not set (#3764)
* Handle empty env vars as it they were not set

* Add changelog entry

* Add missing unit test
2023-02-28 12:43:48 -08:00
Tyler Yahn
2e54fbb3fe
Release v1.14.0/v0.37.0/v0.0.4 (#3810)
* Bump mod versions

* Add bridge/opentracing/test to versions.yaml

* Prepare stable-v1 for version v1.14.0

* Prepare experimental-metrics for version v0.37.0

* Prepare experimental-schema for version v0.0.4

* Update changelog
2023-02-27 13:57:23 -08:00
Tyler Yahn
fe6856e804
Deprecate metric/unit and use a string for units in the metric API/SDK (#3776)
* Replace Unit from metric/unit with string

Deprecate the units package. This package will not be included in the
metric GA.

* Add changes to changelog
2023-02-27 08:10:56 -08:00
Aaron Clawson
17e5d0f549
Do not wrap error if multierror does not have one. (#3772) 2023-02-27 09:10:55 -06:00
OpenTelemetry Bot
0a75c5bd8a
dependabot updates Sun Feb 26 15:49:13 UTC 2023 (#3804)
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opentracing/test
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/internal/retry
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /schema
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric/otlpmetrichttp
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/prometheus
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /metric
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/jaeger
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/zipkin
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /trace
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/stdout/stdouttrace
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace/otlptracegrpc
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace/otlptracehttp
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/stdout/stdoutmetric
Bump github.com/golangci/golangci-lint from 1.51.1 to 1.51.2 in /internal/tools
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /sdk/metric
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opencensus
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /sdk
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
Bump golang.org/x/sys from 0.0.0-20220919091848-fb04ddd9f9c8 to 0.5.0 in /sdk
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opentracing
Bump lycheeverse/lychee-action from 1.5.4 to 1.6.1
2023-02-26 07:58:24 -08:00
Robert Pająk
1d6704c8fc
Support OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT (#3763)
* Support OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT

* Fix non-positive duration error log


Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-02-24 09:26:47 -06:00
Tyler Yahn
f78f72d66c
Merge instrument cache to inserter (#3724)
* Merge instrument cache to inserter

The current pipeline resolution path will only add the resolved
aggregators to the pipeline when it creates one (cache miss). It will
not add it if there is a cache hit. This means (since we cache
instruments at the meter level, not the pipeline level) the first reader
in a multiple-reader setup is the only one that will collect data for
that aggregator. All other readers will have a cache hit and nothing is
added to the pipeline. This is causing #3720.

This resolves #3720 by moving the instrument caching into the inserter.
This means aggregators are cached at the reader level, not the meter.

* Rename aggCV to aggVal

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-02-21 08:07:37 -08:00
Aaron Clawson
cc8bdaaad4
Change the Reader.Collect Signature. (#3732)
* Changes the signature of Collect().

This DOES NOT make the SDK reuse memory, but it does enable it to be added.
2023-02-21 09:04:27 -06:00
Tyler Yahn
0252734309
Rename instrumentID to streamID in metric SDK (#3735)
An instrument is defined by a name, description, unit, and kind. The
instrumentID contains more identifying information than these fields.
The additional information it contains relate to what the OTel metric
data-model calls a stream. Match the terminology and remove using the
instrumentID name in case we want to use it for something else (say,
when caching instruments).
2023-02-16 13:33:56 -08:00
Anthony Regeda
441a173514
No memory leakage in attributes filter (#3695)
The attributes filter collects seen attributes in order to avoid
filtration on the same attribute set. However, the `attribute.Set` is
not comparable type and new allocations of sets with same attributes will be
considered as new sets.

Metrics with a high cardinality of attributes consume a lot of memory
even if we set a filter to reduce that cardinality.

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-02-13 08:07:06 -08:00
Mackenzie
e9bdda0e68
WithContainerID: Document ECS limitation. (#3639)
* WithContainerID: Document ECS limitation.

WithContainerID is not able to extract the correct container id in an ECS environment. The ECS resource detector should be used instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs).
See #3633.

* fix lint

* Update sdk/resource/config.go

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-02-09 11:03:39 -08:00
Tyler Yahn
ddf393886c
Use semconv creation functions (#3683) 2023-02-07 13:42:47 -08:00
Anthony Mirabella
f2fd476f43
Prepare v1.13.0/v0.36.0 release (#3688)
* update versions.yaml for release

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

* Prepare stable-v1 for version v1.13.0

* Prepare experimental-metrics for version v0.36.0

* Update CHANGELOG

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

---------

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2023-02-07 14:34:41 -05:00
Aaron Clawson
5e8eb855bf
Add a benchmark for histogram allocations (#3635)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-02-02 10:16:25 -08:00
Tyler Yahn
6cb5718eaa
Release v1.12.0/v0.35.0 (#3623)
* Update module versions

* Prepare stable-v1 for version v1.12.0

* Prepare experimental-metrics for version v0.35.0

* Prepare experimental-schema for version v0.0.4

* Update the CHANGELOG

* Undo bump to experimental-schema

Revert to original version as nothing has changed.

* Fix PR number in changelog

* Move change from #3497 into current release
2023-01-29 07:41:22 -08:00
Tyler Yahn
7f4d76ab7a
Use Extrema type for Histogram min/max (#3550)
* Use Extrema type for Histogram min/max

* Add case for Extrema in AssertHasAttributes

* Add changes to changelog

* Add NewExtrema

* Add metricdatatest tests

* Use getter for Extrema

* Fix Extrema doc language

* Correct dataset to be one word

* Ensure multiple extrema are tested in a dataset
2023-01-26 10:49:58 -08:00
Tyler Yahn
c0fb8dec4c
Remove the unneeded Observe method from the async instruments (#3586)
* Update RegisterCallback and Callback decls

RegisterCallback accept variadic Asynchronous instruments instead of a
slice.

Callback accept an observation result recorder to ensure instruments
that are observed by a callback.

* Update global impl

* Update noop impl

* Update SDK impl

* Fix prometheus example

* Fix metric API example_test

* Remove unused registerabler

* Rename ObservationRecorder to MultiObserver

* Update Callback documentation about MultiObserver

* Remove the Observe method from async inst

* Revert to iface for Observers

* Fix async inst docs

* Update global async delegate race test

* Restore removed observe doc

* Remove TODO

* Remove stale comment

* Update changelog
2023-01-25 12:58:09 -08:00
Tyler Yahn
c7e2679529
Generate the semconv/v1.17.0 package (#3599)
* Generate semconv/v1.17.0

* Update all semconv use to v1.17

* Add changes to changelog
2023-01-24 08:10:41 -08:00
Tyler Yahn
828892954b
Update the RegisterCallback of the SDK meter (#3604) 2023-01-24 07:56:11 -08:00
Tyler Yahn
a1ce7e5f0d
Combine precomputed values of filtered attribute sets (#3549)
* Combine spatially aggregated precomputed vals

Fix #3439

When an attribute filter drops a distinguishing attribute during the
aggregation of a precomputed sum add that value to existing, instead of
just setting the value as an override (current behavior).

* Ignore false positive lint error and test method

* Add fix to changelog

* Handle edge case of exact set after filter

* Fix filter and measure algo for precomp

* Add tests for precomp sums

* Unify precomputedMap

* Adds example from supplimental guide

* Fixes for lint

* Update sdk/metric/meter_example_test.go

* Fix async example test

* Reduce duplicate code in TestAsynchronousExample

* Clarify naming and documentation

* Fix spelling errors

* Add a noop filter to default view

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-01-20 09:54:42 -08:00
Tyler Yahn
88f6000318
Remove the unused produceKey and callbackKey (#3602)
Following #3584, this value and type are no longer used.
2023-01-20 09:44:25 -08:00
Tyler Yahn
69b18e62a7
Redesign RegisterCallback API (#3584)
* Update RegisterCallback and Callback declerations

RegisterCallback accepts variadic Asynchronous instruments instead of a
slice.

Callback accepts an observation result recorder to ensure instruments
that are observed by a callback.

* Update global, noop, SDK implementations
* Fix examples
* Add changes to changelog
* Test RegisterCallback for invalid observers
* Test callbacks from foreign sources not collected
* Support registering delegating instruments
2023-01-19 08:18:26 -06:00
Tyler Yahn
f941b3a8df
Restructure RegisterCallback method (#3587)
* Restructure RegisterCallback method

Instead of accepting instruments to register the callback with as a
slice, accept them as variadic arguments.

* Add changes to changelog

* Add PR number to changes
2023-01-13 08:31:14 -08:00
Tyler Yahn
36904e4463
Deprecate the syncint64/syncfloat64/asyncint64/asyncfloat64 packages (#3575)
* Dep async/sync pkgs for new inst in instrument pkg

* Replace use of deprecated instruments

* Add changelog entry

* Update changelog entry PR number
2023-01-10 15:06:24 -08:00
Tyler Yahn
78a55822f8
Upgrade all semconv dependencies to v1.16.0 (#3581)
* Upgrade all semconv ref to v1.16.0

* Add changes to changelog
2023-01-10 10:57:28 -08:00
Tyler Yahn
82882dfbd3
Have multi-instrument callback return an error (#3576)
* Have multi-inst callback return an error

* Update PR number in changelog entry

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-01-08 07:53:07 -08:00
Tyler Yahn
1f9cc3036b
Add single instrument callback and split metric instrument configuration (#3507)
* Split metric inst config

Instead of having the same configuration for both the Synchronous and
Asynchronous instruments, use specific options for both.

* Use Async/Sync opt for appropriate inst

* Update noop inst providers

* Update internal global impl

* Update sdk

* Remove unused method for callbackOption

* Test instrument configuration

* Lint imports

* Add changes to changelog

* Refactor callbacks and further split opts

Define callbacks to return the value observed. Because of the different
types returned for different observables, the callbacks and options are
move to the sync/async packages.

* Update noop impl

* Fix example_test.go

* Fix internal impl

* Update Callbacks

Return observations for distinct attr sets.

* Refactor common code in sdk/metric inst provider

* Update examples and prom exporter

* Generalize callback

* Update changelog

* Add unit tests for callback

* Add meter tests for cbacks on creation

* Rename Observations to Measurements

* Update Callback to accept an Observer

* Update SDK impl

* Move conf to instrument pkg

* Apply suggestions from code review
2023-01-06 09:20:49 -08:00
Tyler Yahn
e368276257
Create metric API Callback type (#3564)
* Create metric API Callback type

Document the type according the OTel specification requirements.

* Update all impls of the metric API with new type

* Add changes to changelog

* Update PR number in changelog entry
2023-01-05 14:22:06 -08:00
Tyler Yahn
4607516316
Rename metric SDK instrument kind to match API (#3562)
* Rename metric SDK instrument kind to match API

Follow up to #3530.

* Update CHANGELOG

Fix trailing spaces and update PR number.
2023-01-04 12:47:18 -08:00
Tyler Yahn
a54167d2c9
Remove metric instrument provider API (#3530)
* Remove all InstrumentProvider APIs

* Fix noop impl

* Fix metric/example_test.go

* Update global impl

* Update sdk/metric impl

* Fix examples

* Fix prometheus exporter

* Add changes to changelog

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-01-03 10:34:10 -08:00
Ziqi Zhao
c82dbddc31
TracerProvider shutdown release resources (#3551)
* TracerProvider shutdown release resources

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* add changelog

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* Update CHANGELOG.md

Co-authored-by: David Ashpole <dashpole@google.com>

* prevent registered span processors after shutdown

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: David Ashpole <dashpole@google.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-01-03 09:51:56 -08:00
Tyler Yahn
ad4d54e0f1
Warn metric Exporters of ResourceMetrics reuse (#3556)
To potentially optimize the collection code path (#3047) ResourceMetrics
sent to the Exporter may be reused in the future. Warn users of this.

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-01-03 08:15:07 -08:00
Daniel Metz
9d633d2ed5
traceIDRatioSampler: use rightmost bits (#3557)
* use bottom bits

* add changelog entry

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-12-30 14:06:06 -05:00
darkfeline
69e44a337b
Fix ParentBased comment formatting (#3553)
godoc doesn't have an unordered list syntax
2022-12-24 10:16:11 -08:00
Tyler Yahn
4014204d42
Allow multi-instrument callbacks to be unregistered (#3522)
* Update Meter RegisterCallback method

Return a Registration from the method that can be used by the caller to
unregister their callback.

Update documentation of the method to better explain expectations of
use and implementation.

* Update noop impl

* Update global impl

* Test global Unregister concurrent safe

* Use a map to track reg in global impl

* Update sdk impl

* Use a list for global impl

* Fix prom example

* Lint metric/meter.go

* Fix metric example

* Placeholder for changelog

* Update PR number in changelog

* Update sdk/metric/pipeline.go

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

* Add test unregistered callback is not called

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2022-12-16 12:02:42 -08:00
David Ashpole
14a17b3ad6
Add Metric Producer as a new interface, which returns scope metrics (#3524)
* add RegisterProducer method and metric.Producer interface

* rename testProducer to testSDKProducer

* rename testMetrics to testResourceMetrics

* add testExternalProducer for testing bridges

* add test data for testing external producers

* clean up help text

* unit tests for external Producer

* changelog

* improve test coverage

* Update CHANGELOG.md

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

* support partial errors

* fix lint

* add additional test

* unallocate producers on shutdown

* don't register Producers after shutdown

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-12-15 07:50:45 -08:00
Tyler Yahn
9c61547163
Remove the deprecated view package (#3520)
* Remove the deprecated view package

* Add change to changelog

* Fix changelog header
2022-12-07 11:38:22 -08:00
Aaron Clawson
bc5cf7eb26
Release v1.11.2/v0.34.0 (#3512)
* Update Versions

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

* Prepare stable-v1 for version v1.11.2

* Prepare experimental-metrics for version v0.34.0

* Update Changelog

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

* Update CHANGELOG version.md

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

Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-12-05 13:43:20 -06:00
Aaron Clawson
e97704c1ec
Fix a typo in the manual reader (#3509)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-12-05 07:56:48 -08:00
Aaron Clawson
289a612e6a
Adds an Attribute assertion to metric data test (#3487)
* Adds an Attribute assertion to metric data test

Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2022-11-29 14:32:15 -06:00
Tyler Yahn
c4333a9687
Deprecate the sdk/metric/view package (#3476)
* Deprecate the sdk/metric/view package

* Add deprecation to changelog
2022-11-21 08:05:07 -08:00
Tyler Yahn
dbf960c8e1
Add view example tests (#3460)
* Add the InstrumentKind type and vars to sdk/metric

* Add the Instrument type to sdk/metric

* Add the Stream type to sdk/metric

* Add the View type to sdk/metric

* Add NewView to create Views matching OTel spec

* Add unit tests for NewView

* Add changes to changelog

* Apply suggestions from code review

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

* Update CHANGELOG.md

* Update match and mask comments of Instrument

* Explain wildcard logic in NewView with comment

* Drop views that replace name for multi-inst match

* Comment how users are expected to match zero-vals

* Remove InstrumentKind and Scope from Stream

* Fix redundant word in NewView comment

* Add view example tests

* Update comments to examples

* Fix broken English

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-11-21 07:45:47 -08:00
Tyler Yahn
037719b646
Replace view use from sdk/metric/view to sdk/metric (#3461)
* Replace view usage in sdk/metric

* Replace view use in stdoutmetric

* Replace view use in prometheus exporter

* Replace view use in otlpmetric exporters

* Replace view use in view example
2022-11-19 09:05:20 -08:00
Tyler Yahn
2e780d8e39
Add View, NewView, Instrument, Stream, and InstrumentKind to sdk/metric with unit tests (#3459)
* Add the InstrumentKind type and vars to sdk/metric

* Add the Instrument type to sdk/metric

* Add the Stream type to sdk/metric

* Add the View type to sdk/metric

* Add NewView to create Views matching OTel spec

* Add unit tests for NewView

* Add changes to changelog

* Apply suggestions from code review

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

* Update CHANGELOG.md

* Update match and mask comments of Instrument

* Explain wildcard logic in NewView with comment

* Drop views that replace name for multi-inst match

* Comment how users are expected to match zero-vals

* Remove InstrumentKind and Scope from Stream

* Fix redundant word in NewView comment

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-11-16 08:18:02 -08:00
Tyler Yahn
308d0362e6
Only registers callbacks if non-drop aggregation is used (#3408)
* Do not return an error for Drop aggs

The async instruments currently return an error if and only if there are
no aggregators returned from a resolve. Returning no aggregators means
the instrument aggregation is drop. Do not include this in the error
reporting decision.

* Only registers callbacks if non-drop agg is used

The instruments passed to RegisterCallback need to have some aggregation
defined otherwise it is implied they have a Drop aggregation. Check that
at least one instrument passed has an aggregation other than Drop before
registering the callback with the pipelines.

Also, return an error if the user passed another API implementation of
an asynchronous instrument.

* Remove unneeded TODO from pipeline

* Add changes to changelog

* Test callback not called for all drop instruments

* Test RegisterCallback returns err for non-SDK inst

* Fail gracefully for non-SDK instruments

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-11-11 09:10:59 -08:00
Tyler Yahn
d091ba88e4
Do not export aggregations without any data points (#3436)
* Return empty nil aggs if no meas

* Update tests with new expected behavior

* Add change to changelog

* Set PR number in changelog

* Run lint

* Fix pipeline_test

* Scope change in changelog to pkg

* Clean up init of agg types
2022-11-11 07:22:27 -08:00
Tyler Yahn
acd87773e2
Restructure instrument creation code paths (#3256)
* Add BenchmarkInstrumentCreation

* Unify instrument provider

* Resolve import shadow

* Update sdk/metric/pipeline.go

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

* Punctuate to fix lint

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-11-10 16:04:53 -08:00
Aaron Clawson
c21b6b6bb3
Adds attribute filter logic (#3396)
* Adds attribute filter logic

* Apply PR feedback

* Use updated MP options

* Update Changelog and TODO numbers

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-11-08 07:45:23 -08:00
Joshua MacDonald
49b62aef66
New benchmark derived from otel-launcher-go (#3395)
* New benchmark derived from otel-launcher-go

* edit

* refactoring from PR feedback

* refactoring from PR feedback

* update for upstream main

* revert view change

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-11-01 08:50:49 -07:00