* 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>
* 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>
* 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>
* Remove the deprecated view example
* Update PR number in changelog
* Update versions.yaml
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* 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>
* 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>
* add exemplar support to OpenCensus bridge
* expand set of translated exemplar attributes
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Add WithExplicitBucketBoundaries Histogram option to the metric api
* Add note that the option is advisory
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
* add summary datatype
* support comparing summaries
* update wording based on SIG meeting feedback
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add trace/embedded
* Update trace impl to use trace/embedded
* Add noop pkg to replace no-op impl in trace pkg
* Use trace/embedded in global impl
* Use trace/embedded in SDK impl
* Update opencensus bridge
* Update opentracing bridge
* Add changes to changelog
* Update trace/doc.go
Co-authored-by: David Ashpole <dashpole@google.com>
---------
Co-authored-by: David Ashpole <dashpole@google.com>
* Add options to opencensus bridge, and install tracer instead of returning
* add unit test
* update unit tests
* fix example
* import ordering
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Bump versions
* Prepare stable-v1 for version v1.19.0
* Prepare experimental-metrics for version v0.42.0
* Prepare experimental-schema for version v0.0.7
* Update changelog
* add WithWriter and WithPrettyOptions to stdoutmetric
* add changelog
* make WithWriter a shortcut to WithEncoder
* Update exporters/stdout/stdoutmetric/config.go
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>