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

661 Commits

Author SHA1 Message Date
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
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
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
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
Robert Pająk
7ebfa8abf9
Add otlpmetricgrpc.Expoter and otlpmetrichttp.Exporter (#4272)
* Add otlpmetricgrpc.Expoter and otlpmetrichttp.Exporter

* Update changelog
2023-07-01 07:20:35 -07:00
Robert Pająk
d57569379f
otlpmetric: Fix serialization of time.Time zero values (#4271) 2023-06-30 09:19:59 +02:00
Max Chechel
457029232d
Prometheus exporter: concurrent collect bugfix (#3899)
* Concurrent collect bugfix

* Used sync.Mutex and code cleanup

* Revert "Concurrent collect bugfix"

This reverts commit 1a30f233b6.

* Used sync.Mutex and re-grouped protected members

* Added test and updated changelog

* Updated changelog

* Take care of potential panic in otel.Handle

* Extracted critical section in a separate method and fixed nil scope info

* Lock the whole scope of the func

* Moved otel.Handle out of the critical section

* Fixed calling createScopeInfoMetric twice and updated changelog

* Fixed markdown linter errors

* Added test for nil scopeinfo

* Fix merge artifacts

* Fixed linter errors

* Protect the whole validateMetrics method wity mutex

* Update CHANGELOG.md

* Update exporters/prometheus/exporter.go

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

* Update CHANGELOG.md

* Document that Collect is concurrent-safe

* Update exporter_test.go

* Update exporters/prometheus/exporter_test.go

* Update exporters/prometheus/exporter.go

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

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: David Ashpole <dashpole@google.com>
2023-06-29 13:31:20 +02:00
Tyler Yahn
1b02c9122d
Format log message before logging with logr (#4143)
* Format log message before logging with logr

Fixes #4141

The logr calling convention does not support fmt semantics for message
formatting. Format the message before it is sent to logr for logging.

* Add change to changelog

* Fix lint

Don't shadow the log pkg.

* Replace buflogr with funcr

* Run make

* Update exporters/zipkin/zipkin_test.go

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

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-06-26 09:54:35 -07: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
6b262b44ac
sdk/metric: Reader factories return structs (#4244) 2023-06-22 09:09:00 +02:00
Aaron Clawson
12138c9444
Add Exponetial Histograms to otlp transforms (#4222) 2023-06-21 20:57:49 +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
Damien Mathieu
be82610b44
Return noop meters once the provider has been shutdown (#4154) 2023-06-05 09:51:21 +02:00
Robert Pająk
b4faa3dfdb
semconv: Stop generating httpconv.go, netconv.go, http.go (#4145) 2023-06-05 09:33:03 +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
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
Robert Pająk
8445f21305
Add semconv/v1.20.0 (#4078)
* Add semconv/v1.20.0

* Update changelog

* Change http.flavor to net.protocol.(name|version)

* Update comments in httpconv

* Fix vanity import

* Update CHANGELOG.md

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-05-16 11:17:28 -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
Tristan Sloughter
b243b6e819
Add semconv/v1.19.0 (#3848)
* Add semconv/v1.19.0

Includes adding semconv/internal/v3/ to support the move of
the semantic convention HTTPUserAgentKey to the new key
UserAgentOriginalKey

* Update CHANGELOG.md

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

* format http.go.tmpl using tabs instead of spaces

* update http.go.tmpl to use v3 of semconv/internal

* Generate attribute_group.go

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-05-08 09:02:10 -07:00
Tyler Yahn
4f4edec5e2
Remove the deprecated metric/instrument package (#4055)
* Remove deprecated `metric/instrument`

* Apply suggestions from code review

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-05-08 07:39:50 -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
5814858e4e
Revert "Move the metric API back to experimental-metrics (#3987)" (#4038)
* Revert "Move the metric API back to experimental-metrics (#3987)"

This reverts commit 51345570a0.

* Add change to changelog
2023-05-02 11:00:42 -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
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
Kaushal Shah
86f325839c
Added methods for SpanID and TraceID on bridgeSpanContext (#3966)
* Added methods for SpanID and TraceID on bridgeSpanContext

* changed test name

* Added entry in changelog, updated readme, added comments on methods and fixed test case

* updated CHANGELOG.md

* promoted all methods from SpanContext to bridgeSpanContext

* fixed readme and removed redudant IsSampled() from bridgeContext

* fixed readme lint

* Apply suggestions from code review

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

* addressed code review comment

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-04-25 10:11:03 -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
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
Luke Stoward
1bc9b56a17
[exporters/otlp/otlpmetric] Wrap upload metrics error to provide additional context (#3974)
* Wrap upload metrics error to provide additional context

* Add PR number to CHANGELOG

* Update CHANGELOG.md

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

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-04-10 07:29:01 -07:00
Gustavo Paiva
1c05d9c0b7
prometheus: add WithNamespace option to prefix metrics (#3970)
* prometheus: add WithNamespace option to prefix metrics

* sanitize namespace, add config test

* Update CHANGELOG.md

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

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-04-06 13:44:13 -05: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
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
Tyler Yahn
63a0f51c2d
Move metric No-Op to metric/noop (#3941)
* Revert "Revert "Move metric No-Op to metric/noop (#3893)" (#3921)"

This reverts commit 795ad97119.

* Add PR number

* Move example_test back to `otel/metric`

* Update CHANGELOG.md

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

* Remove redundant panic tests

* Update noop pkg docs

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-03-29 08:05:07 -07:00
Mikhail Mazurskiy
c4940f3b43
TracerProvider allows calling Tracer() while it's shutting down (#3924) 2023-03-27 17:05:44 -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
Tyler Yahn
795ad97119
Revert "Move metric No-Op to metric/noop (#3893)" (#3921)
* Revert "Move metric No-Op to `metric/noop` (#3893)"

This reverts commit 3c75a44f84.

* Persist removal of NewNoopMeter
2023-03-22 14:41:28 -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
Sinan Ülker
1eab60f714
Enhance internal logging (#3900)
* Introduce `Warn` function in global package

* Cover log levels with tests

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-03-21 14:33:37 -05:00
Tyler Yahn
3c75a44f84
Move metric No-Op to metric/noop (#3893)
* Move metric No-Op to noop pkg

* Remove the unneeded embedded ifaces

* Update CHANGELOG.md

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

---------

Co-authored-by: Peter Liu <lpfvip2008@gmail.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2023-03-21 14:25:23 -05:00