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

784 Commits

Author SHA1 Message Date
David Ashpole
ec03021ff0
add exemplar support to the OTLP HTTP and gRPC exporters (#4900) 2024-02-12 07:31:18 -08:00
Robert Pająk
dd5d05472c
sdk/metrics: Move experimental docs to x package (#4895) 2024-02-09 09:15:18 +01:00
Robert Pająk
69b252178e
Support Go 1.22 (#4890) 2024-02-08 09:44:35 +01:00
Tyler Yahn
c5b112f31b
Release v1.23.1/v0.43.2 (#4892)
* Bump versions.yaml

* Prepare stable-v1 for version v1.23.1

* Prepare experimental-metrics for version v0.45.2

* Add changes to changelog
2024-02-07 12:41:47 -08:00
Tyler Yahn
11ebd19c46
Fix callback registration bug (#4888)
* Fix cback reg bug

Register all callbacks not just the last passed.

* Add changelog entry
2024-02-07 11:59:58 -08:00
Tyler Yahn
e3eb3f7538
Release v1.23.0/v0.45.1 (#4885)
* Bump versions.yaml

* Prepare stable-v1 for version v1.23.0

* Prepare experimental-metrics for version v0.45.1

* Update changelog

* Update CHANGELOG.md
2024-02-06 07:50:39 -08:00
Tyler Yahn
eabcef4c2d
Return merged Resource on schema conflict (#4876)
* Return merged Resource on schema conflict

* Add changes to changelog

* Doc returned resource to have no schema URL

* Refactor Merge based on feedback

* Add the schema URLs to the returned error

* Ensure no schema URL when merge conflict on detect

* Replaced isErr with wantErr in TestNew

* Update sdk/resource/auto_test.go

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

* Update TestDetect based on feedback

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2024-02-05 07:33:29 -08:00
Michał Posłuszny
569854e1d1
sdk/metric/metricdata: Add MarshalJSON for Extrema (#4827)
* json marshal for Extrema type, makefile typo fix

* MarshalText implementation, cleanup

* update changelog

* changelog fix

* Update CHANGELOG.md

* MarshalText behavior update on invalid Extrema

* Fix Marshal outputs json text representation of nil

* Updated mockData to include example with Min and Max values.

* null value test, changelog fix

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2024-02-01 09:58:42 -08:00
Tyler Yahn
fecb92e366
Add the experimental exemplar feature (#4871)
* Add the experimental exemplar feature

* Add exemplars to EXPERIMENTAL.md

* Add changelog entry

* Fix hist buckets > 1 detection

* Collect instead of Flush res about to be deleted

* Add e2e test

* Do not pre-alloc ResourceMetrics

This only has a single use.

* Fix grammatical error in comment

* Add test cases

Default and invalid OTEL_METRICS_EXEMPLAR_FILTER.

Test sampled and non-sampled context for trace_based.

* Comment nCPU

* Doc OTEL_METRICS_EXEMPLAR_FILTER
2024-01-31 13:15:35 -08:00
Robert Pająk
bf1ae8cb04
[chore] Fix changelog entry for #4754 (#4874) 2024-01-31 09:17:42 +01:00
David Ashpole
1978044c55
Cache instruments so repeatedly creating identical instruments doesn't leak memory (#4820)
* cache instruments to avoid leaking memory

* add cacheWithErr to simplify error handling

* add wanring on repeated obserbable instrument creation with callbacks

* documentation for new behavior

* address feedback

---------

Co-authored-by: Damien Mathieu <damien.mathieu@elastic.co>
2024-01-24 07:42:43 -08:00
Tyler Yahn
cef39a1e17
Fix changelog entry (#4848)
Move #4449 entry to unreleased.
2024-01-23 14:15:04 -08:00
Baptiste Girard-Carrabin
71d13ffc2a
Fix ContainerID detector on systemd with colon in cgroup path (#4449)
Co-authored-by: David Ashpole <dashpole@google.com>
2024-01-23 13:04:46 -08:00
Damien Mathieu
33f5cf460b
Add WithEndpointURL option to OTLP over HTTP exporters (#4808)
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2024-01-19 15:25:10 +01:00
Tyler Yahn
1e2555f380
Release v1.23.0-rc.1 (#4832)
* Update versions.yaml

Move experimental-metrics modules that are stbilizing to the stable-v1
module-set.

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

* Update changelog
2024-01-18 12:26:17 -08:00
Aaron Clawson
279c549cab
Release v1.22.0/v0.45.0 (#4821)
* Update to v1.22.0

* Prepare stable-v1 for version v1.22.0

* Prepare experimental-metrics for version v0.45.0
2024-01-17 13:24:10 -06:00
Liz Fong-Jones
4491b39db2
sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818)
* sdk/trace: use slices.Grow() to avoid excessive runtime.growslice()

* go1.20 compat

* update go.mod/sum

* Update CHANGELOG.md

* Revert "update go.mod/sum"

This reverts commit 1e4fcfa86c.

* inline slices.Grow as ensureAttributesCapacity

* fix comment

* add bench

* fix inlining

* Apply suggestions from code review

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

* add ReportAllocs

* add benchmark variations with lower limit

* bugfix: we always want to set cap, just the value is a min()

* lint

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2024-01-12 13:42:36 -08:00
CZ
7fa7d1b252
sdk/metric: Fix observable not registered error when the asynchronous instrument has a drop aggregation (#4772)
* Fix observable instrument not registered on drop aggregation

* Add TestObservableDropAggregation

* Add testcase for dropping unregistered observable

* Update CHANGELOG

* Add observable name const + suggestions

* Add suggestions

* Only error if the instrument is not dropped

* Decrease indentation

* Revert "Decrease indentation"

This reverts commit 9e7e7729bf.

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2024-01-11 15:27:40 -08:00
Robert Pająk
01472db75f
Upgrade use of semconv to v1.24.0 (#4754) 2024-01-11 12:56:07 +01:00
Robert Pająk
259143a662
baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804) 2024-01-10 14:02:57 +01:00
Tyler Yahn
deddec38ac
Optimize (attribute.Set).Filter for no filtered case (#4774)
* Optimize Set.Filter for no filtered case

When all elements of the Set are kept during a call to Filter, do not
allocate a new Set and the dropped attributes slice. Instead, return the
immutable Set and nil.

To achieve this the functionality of filterSet is broken down into a
more generic filteredToFront function.

* Apply suggestions from code review

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

* Rename run to benchFn based on review feedback

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2024-01-08 07:49:45 -08:00
CZ
27f70a3350
bridge/opentracing: fix baggage item key is canonicalized (#4776)
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
2023-12-28 18:46:17 +01:00
Robert Pająk
08b856faeb
baggage: Member.String encodes only when necessary (#4775) 2023-12-28 18:21:44 +01:00
Robert Pająk
885210bf33
baggage: Fix escaping in Member.String (#4756)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-12-21 09:16:13 +01:00
Tyler Yahn
e3bf787c21
Add cardinality limiting to the metric SDK as an experimental feature (#4457)
* Add agg limiting func

* Add unit test for limitAttr

* Add limiting to aggregate types

* Add internal x pkg for experimental feature-flagging

* Connect cardinality limit to metric SDK

* Replace limitAttr fn with limiter type

The Attribute method is still inlinable.

* Use x.CardinalityLimit directly

* Simplify limiter test

* Add limiter benchmark

* Document the AggregationLimit field

* Test sum limits

* Test limit for last value

* Test histogram limit

* Refactor expo hist test to use existing fixtures

The tests for the exponential histogram create their own testing
fixtures. There is nothing these new fixtures do that cannot already be
done with the existing testing fixtures used by all the other aggregate
functions. Unify the exponential histogram testing to use the existing
fixtures.

* Test the ExponentialHistogram limit

* Fix lint

* Add docs

* Rename aggregation field to aggLimit

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-12-19 07:53:01 -08:00
Robert Pająk
cb8cb2d269
Add semconv v1.24.0 (#4770) 2023-12-19 14:44:32 +01:00
Robert Pająk
43bd47de6e
baggage: Fix Parse to validate member value before percent-decoding (#4755) 2023-12-19 14:38:58 +01:00
Robert Pająk
8e756513a6
sdk/metric: Record measurements when context is done (#4671) 2023-12-15 19:14:16 +01:00
Cristian Velazquez
057f897096
baggage: Improve performance (#4743) 2023-12-14 16:48:28 +01:00
Robert Pająk
0c1c434c70
Add semconv/v1.23.1 (#4749)
* Add semconv/v1.23.1

* Update changelog

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-12-10 08:04:52 -08:00
David Ashpole
b5afa704f1
Fix multi-reader observable counter double-counting bug (#4742)
* fix Fix a bug where using multiple readers resulted in incorrect asynchronous counter values

* move addCallback to inserter

* restore comment
2023-12-08 14:21:30 -08:00
Robert Pająk
214d5e075f
Add semconv/v1.23.0 (#4746) 2023-12-07 07:29:21 +01:00
Tyler Yahn
6cee2b4a4c
Add semconv v1.22.0 (#4735) 2023-12-04 21:21:49 +01:00
xiehuc
88da778ba2
improve tracestate performance (#4722)
* improve tracestate performance

* use string.Builder to directly construct the result

* reduce the redundant copying during Insert

* avoid using regex

* fix lint

* revert changelog

* update comment

* refine code

* fix lint

* fix unittest

* Update trace/tracestate.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-12-02 08:58:20 -08:00
Alex Boten
6027c1ae76
add option for resource attributes in metrics for prometheus exporter (#4733)
* add option for resource attributes in metrics for prometheus exporter

This PR adds the `WithResourceAsConstantLabels` option to the Prometheus exporter to allow users to configure resource attributes to be applied on every metric.

Fixes #4732

Signed-off-by: Alex Boten <aboten@lightstep.com>

* add test, changelog

Signed-off-by: Alex Boten <aboten@lightstep.com>

* add test for including only a subset of tags, dont use a ptr

Signed-off-by: Alex Boten <aboten@lightstep.com>

* Update exporters/prometheus/config.go

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

* include feedback from review

Signed-off-by: Alex Boten <aboten@lightstep.com>

* cache results

Signed-off-by: Alex Boten <aboten@lightstep.com>

* removed map in favour of single keyVals

Signed-off-by: Alex Boten <aboten@lightstep.com>

* Update exporters/prometheus/config.go

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

* move check outside the createResourceAttributes and rename func

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: David Ashpole <dashpole@google.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-12-01 07:34:05 -08:00
xiehuc
04054929f1
improve trace_context performance (#4721)
* improve trace_context performance

* using strings.Builder instead of fmt.Sprint

* using strings.Cut instead of strings.Split

* using hex.Decode instead of hex.DecodeString

* avoid use regexp

* fix code style

* fix build

* update changelog

* refine code

* update comment

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-11-29 09:32:27 -08:00
Robert Pająk
98b32a6c3a
Release 1.21.0/0.44.0 (#4724) 2023-11-16 21:11:06 +01:00
Robert Pająk
a27c53b9b5
Remove example/fib (#4723) 2023-11-16 19:51:04 +01:00
Robert Pająk
8ceba1368a
otlpmetrichttp otlptracehttp: Do not parse non-protobuf reponses (#4719) 2023-11-16 18:33:54 +01:00
Tyler Yahn
a2cb6044b2
Remove the deprecated otlpmetric module (#4707)
* Remove the deprecated otlpmetric module

* Add changelog entry

* Update versions.yaml

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-11-13 09:20:05 -08:00
Tyler Yahn
c8e60d1357
Remove the deprecated view example (#4708)
* Remove the deprecated view example

* Update PR number in changelog

* Update versions.yaml

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-11-13 08:40:40 -08:00
Tyler Yahn
27c5c7347b
Remove the deprecated NewTracer from OC bridge (#4706)
* Remove the deprecated NewTracer from OC bridge

* Update PR number in changelog

* Remove example test for NewTracer

---------

Co-authored-by: David Ashpole <dashpole@google.com>
2023-11-13 07:27:07 -08:00
Robert Pająk
85e4c467da
Release v1.20.0/v0.43.0 (#4705) 2023-11-10 17:42:33 +01:00
Michael Blum
be5064a387
Use url.PathUnescape rather than url.QueryUnescape when parsing OTLP headers and resource attributes env vars (#4698) (#4699) 2023-11-09 12:51:59 -06:00
Robert Pająk
0c5ebd5856
otlp: Refine documentation (#4695) 2023-11-08 17:18:12 +01:00
Robert Pająk
0f5179f4f1
Deprecate otlpmetric (#4693) 2023-11-06 19:01:10 +01:00
David Ashpole
163573775b
Add summary support in the OpenCensus bridge (#4668)
* support summaries in the OpenCensus bridge

* divide quantiles by 100
2023-11-02 15:07:41 -05:00
Nathan J Mehl
bdb9322ebd
Use url.PathUnescape rather than url.QueryUnescape in baggage parsing (#4667)
* Use url.PathUnescape rather than url.QueryUnescape

I believe this addresses the majority of the cases described in
https://github.com/open-telemetry/opentelemetry-go/issues/3601

Golang's url.QueryUnescape will render url _path_ elements (e.g. /, +)
as spaces: `foo+bar` is rendered as `foo bar`.  Path elements are (as I
read the spec) legal W3C baggage values, and replacing them with spaces
fails the value validation regex.

url.PathEscape allows path elements through unmolested.

Signed-off-by: Nathan J. Mehl <n@oden.io>

* Update CHANGELOG.md

address comments

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

---------

Signed-off-by: Nathan J. Mehl <n@oden.io>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2023-10-31 15:02:17 -07:00
David Ashpole
b2bb2ad00f
Implement WithExplicitBucketBoundaries option in the metric SDK (#4605) 2023-10-31 08:41:27 +01:00
Robert Pająk
5ec67e83df
otlptracehttp, otlpmetrichttp: Retry temporary HTTP request failures (#4679) 2023-10-31 08:06:25 +01:00