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

2342 Commits

Author SHA1 Message Date
Robert Pająk
b8e8e5eb8b
metric: Recommend defining units in UCUM (#4418)
* metric: Recommend defining units in UCUM

* Update metric/instrument.go

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

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-08-08 14:16:58 +02:00
Damien Mathieu
10099bb876
Handle 2xx as success for OTLP HTTP trace and metric exporters (#4365)
* handle no content responses for otlpmetric exporter

* handle no content responses for otlptraces http exporter

* add changelog entry

* add a ResponseStatus attribute rather than using error

* accept any status code between 200 and 299

* rename i to code

* switch require to assert

* shutdown the client in defer

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-08-07 10:32:44 -07: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
David Ashpole
e1e6b96647
do not append _total if the metric already ends in _total (#4373) 2023-08-07 10:12:57 -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
Tyler Yahn
196c1f0a83
Fix rendered envconfig_test.go file name in otlpmetricgrpc (#4419) 2023-08-07 17:58:27 +02:00
Tyler Yahn
d1f33f19b4
Decouple otlp/otlpmetric/otlpmetrichttp from otlp/internal and otlp/otlpmetric/internal using gotmp (#4407)
* Generate otlpmetrichttp/internal with gotmpl

* Use local internal pkg for otlpmetrichttp

* Add changes to changelog

* Fix rendered envconfig_test.go file name
2023-08-07 08:50:30 -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
Tyler Yahn
f67ecb35dc
Decouple otlp/otlpmetric/otlpmetricgrpc from otlp/internal and otlp/otlpmetric/internal using gotmp (#4404)
* Add shared otlpmetric templates

* Generate otlpmetricgrpc/internal with gotmpl

* Use local internal in otlpmetricgrpc

* Add decoupling change to changelog
2023-08-03 17:08:49 -07:00
Tyler Yahn
2e6ca0af0c
Decouple otlp/otlptrace/otlptracegrpc from otlp/internal and otlp/otlptrace/internal using gotmpl (#4400)
* Use template retry pkg in otlpconfig

* Template out all otlptrace internal

* Add envconfig pkg to otlptrace/internal

* Generate otlptrace/internal/otlpconfig

* Revert templatizing otlptracegrpc

* Add changes to changelog

* Add partialsuccess to internal shared

* Use gotmpl to generate otlptracegrpc/internal

* Add changes to changelog
2023-08-03 13:51:45 -07:00
Tyler Yahn
58c9cf65d6
Decouple otlp/otlptrace/otlptracehttp from otlp/internal and otlp/otlptrace/internal using gotmpl (#4401)
* Use template retry pkg in otlpconfig

* Template out all otlptrace internal

* Add envconfig pkg to otlptrace/internal

* Generate otlptrace/internal/otlpconfig

* Revert templatizing otlptracegrpc

* Add changes to changelog

* Fix lint

* Add partialsuccess to internal shared

* Use gotmpl to generate otlptracehttp/internal

* Add change to changelog
2023-08-03 13:34:48 -07:00
George Kontridze
9ec9cead50
Fix typo in exporters/README.md (#4402) 2023-08-02 13:53:35 -07:00
Tyler Yahn
4928282877
Decouple otlp/otlptrace/internal from otlp/internal using gotmpl (#4397)
* Add gotmpl

* Add shared retry pkg

* Use template retry pkg in otlpconfig

* Update license-check to look at first 4 lines

* Template out all otlptrace internal

* Add envconfig pkg to otlptrace/internal

* Generate otlptrace/internal/otlpconfig

* Revert templatizing otlptracegrpc

* Add changes to changelog

* Fix lint

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-08-02 12:28:35 -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
378e51e365
Do not block Temporality/Aggregation on OTLP metric export (#4395)
* otlpmetricgrpc - no block temp/agg selection with export

* otlpmetrichttp - no block temp/agg selection with export

* Add test Export doesn't block Temporality or Aggregation

* Deprecate internal New and Exporter

* Add changes to changelog

* Apply suggestions from code review
2023-08-02 07:38:04 -07:00
David Ashpole
528a0cb34f
Expand the set of units supported by the prometheus exporter (#4374) 2023-08-02 08:34:28 +02:00
Tyler Yahn
2899fcfdca
Document the Reader and Exporter concurrent safe requirements (#4381) 2023-07-30 22:26:17 +02:00
OpenTelemetry Bot
bf29fc6f68
dependabot updates Sun Jul 30 14:33:02 UTC 2023 (#4393)
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlptrace
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /bridge/opentracing/test
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /example/otel-collector
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlpmetric
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlptrace/otlptracegrpc
Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc
Bump go.opentelemetry.io/build-tools/crosslink from 0.9.0 to 0.10.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/multimod from 0.9.0 to 0.10.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/semconvgen from 0.9.0 to 0.10.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/dbotconf from 0.9.0 to 0.10.0 in /internal/tools
2023-07-30 07:40:04 -07: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
830fae8d70
Add semconv/v1.21.0 (#4362)
* Update tooling to point to new repository
* Update changelog
* Remove leftovers
* generate semconv/v1.21.0
2023-07-26 17:09:04 +02:00
Robert Pająk
d5d631852a
Remove redundant TestBatchSpanProcessorForceFlushCancellation (#4367) 2023-07-26 13:51:21 +02:00
Robert Pająk
85afa3d8fe
Fix typo in README.md (#4366) 2023-07-26 13:34:15 +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
Aaron Clawson
a5c82bf26e
Add otlpmetric Temporality Preference env var (#4287)
* Add otlp metrics env vars

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-07-20 10:50:12 -05: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
OpenTelemetry Bot
fdbcb9ac28
dependabot updates Sun Jul 16 15:03:07 UTC 2023 (#4329)
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace/otlptracegrpc
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric/otlpmetrichttp
Bump go.opentelemetry.io/build-tools/dbotconf from 0.8.0 to 0.9.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/semconvgen from 0.8.0 to 0.9.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/crosslink from 0.8.0 to 0.9.0 in /internal/tools
Bump go.opentelemetry.io/build-tools/multimod from 0.8.0 to 0.9.0 in /internal/tools
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace/otlptracehttp
Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc
2023-07-16 08:08:50 -07:00
Robert Pająk
3e203acae3
Fix changelog entry number for #4306 (#4314) 2023-07-14 21:13:51 +02:00
David Ashpole
03b8c47770
Add WithoutCounterSuffixes option in go.opentelemetry.io/otel/exporters/prometheus to disable addition of _total suffixes (#4306) 2023-07-14 17:52:35 +02:00