The current logtest.Recorder implementation is wrong. We have a single
`Recorder`, which acts as both a `LoggerProvider`, and a `Logger`,
making it possible to emit a log entry with the root recorder, which
shouldn't be possible with the API.
This change introduces a new private struct, `logger` that acts as the
recording logger, while `Recorder` becomes only a LoggerProvider and not
a Logger anymore.
Closes#5357.
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* record links with empty span context
* add global trace state
* fix test comments and changelog
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* emit slices as their json representation
* add changelog
* fix resource tests
* indicate invalid slice if we couldn't turn them into json
* move changelog entry to the unreleased section
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Bump versions in versions.yaml
* Prepare stable-v1 for version v1.26.0
* Prepare experimental-metrics for version v0.48.0
* Prepare experimental-logs for version v0.2.0-alpha
* Prepare experimental-schema for version v0.0.9
* Update CHANGELOG
* Unbump experimental-schema
* 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>
* Revert "otlpmetrichttp: Use go.opentelemetry.io/proto/slim/otlp (#5222)"
This reverts commit 6e92163d6a.
* Revert "otlploghttp: Use go.opentelemetry.io/proto/slim/otlp (#5216)"
This reverts commit fe3de7059e.
* Remove slim dep
* Fix CI
* Add sdk/log, stdoutlog, and otlploghttp to next release
Include go.opentelemetry.io/otel/sdk/log,
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp, and
go.opentelemetry.io/otel/exporters/stdout/stdoutlog in the
experimental-logs module set.
* Add releases to changelog
* Remove unreleased module changes
* Replace Record lim methods with DroppedAttributes
* Add changelog entry
* Add TestRecordDroppedAttributes
* Add TestRecordCompactAttr
* Add an indexPool
* Fix gramatical error
* Apply feedback
Reduce indentation level.
* Apply feedback
Comment compactAttr and deduplicate.
* Deduplicate all attributes when added
* Comment why head is not used
* Clarify comments
* Move TestAllocationLimits to new file
Do not run this test when the race detector is on.
* Comment follow-up task
* add trace flags to OTLP export
* add changelog entry
* add span flags to links too
* rely on the parent span context for span flags
* test BuildSpanFlags, not with an actual span
* Update exporters/otlp/otlptrace/internal/tracetransform/span.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* upgrade the generated otlp proto to 1.2.0
* add changelog entry
* mod tidy in collector example
* fix changelog entry
* 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>
* introduce in-memory log exporter
* add changelog entry
* move logtest into a recorder within the api
* rename GetRecords to Result
* rename InMemoryRecorder to Recorder
* name the struct r
* ensure Logger creates a struct copy
* replace severity with enabledFn
* Update CHANGELOG.md
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* kUpdate log/logtest/config.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* store all scope records, so we can retrieve everything with `Result()`
* store child loggers instead of all scope records
* no need to explicitly create a new slice
* add concurrent safe test
* handle default enabled function if the struct was manually created
* rename WithEnabledFn to WithEnabledFunc
* test result/reset with child loggers
* add enabled to concurrent safe
* fix lint missing period
* rename defaultEnabledFn to defaultEnabledFunc
* merge recorder.go and config.go
* Update log/logtest/recorder_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* create empty recorder in concurrent safe test
* Update log/logtest/recorder_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* fix lint
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update log/logtest/recorder.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* make enabledFunc callable from outside the package
* replace expected with want
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Sam Xie <sam@samxie.me>
* Bump versions in versions.yaml
* Prepare stable-v1 for version v1.25.0
* Prepare experimental-metrics for version v0.47.0
* Prepare experimental-logs for version v0.1.0-alpha
* Prepare experimental-schema for version v0.0.8
* Update changelog
* Run go mod tidy
* Update CHANGELOG.md
---------
Co-authored-by: Damien Mathieu <damien.mathieu@elastic.co>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Adds some basic constants for metrics utilizing a new jinja template
* Updates generated comments with more explicit nomenclature; Adds Unit and Description consts for each metric; append 'Name' to metric const instead of 'Key'
* Update CHANGELOG
* fix overlooked merge conflict
* change the types of generated consts to string; format generation to handle empty stability and descriptions
* trim trailing (repeated) periods in the description
* manual formatting of some proper nouns; simplify the license header
* update metrics file with concise generated license header
* revert special formatting logic for JVM and ASPNETCore
* Update CHANGELOG.md
* Update CHANGELOG.md
Co-authored-by: Damien Mathieu <42@dmathieu.com>
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Sam Xie <sam@samxie.me>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Bump Go versions used in CI systems
The latest releases of Go 1.22 and 1.21 contain security fixes for
`net/http`. Explicitly set the CI system to not use vulnerable versions
when testing so our vulnerable checker does not fail (and we aren't
vulnerable).
* Upgrade golang.org/x/net to v0.23.0
* Add changelog entry
* try running compatibility tests on arm64 with actuated
* try nested matrix
* setup vmmeter
* try less cpu and less gb with actuated
* add comment about vmmeter
* Update .github/workflows/ci.yml
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update .github/workflows/ci.yml
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update .github/workflows/ci.yml
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update .github/workflows/ci.yml
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update .github/workflows/ci.yml
* update compatibility matrix
* use linux name for arm builds
* add changelog entry
* add link to actuated doc
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Add the Enabled method to the Logger
* Add a changelog entry
* Rename enabled.go to min_sev.go
* Remove MinSeverityProcessor
* Document lack of interaction between OnEmit and Enabled
* Update sdk/log/processor.go
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update README.md
* Remove 1.20 support from CI workflows
* Update all go mod
* Add changelog entry
* Update go mod tidy target
* Run go mod tidy
* Replace sliceEqualFunc with slices.EqualFunc
* Replace grow with slices.Grow
* Replace ensureAttributesCapacity with slices.Grow
* Replace conditional with min
* Use slices module for slice comparison in metricdatatest
* Bump versions
* Prepare stable-v1 for version v1.24.0
* Prepare experimental-metrics for version v0.46.0
* Prepare experimental-logs for version v0.0.1-alpha
* Update changelog
* Fix changelog entry
Include the go.opentelemetry.io/otel/log module in the new module set.
Use the version v0.0.1-alpha for the new module. This follows the
go.opentelemetry.io/auto projects use of the alpha suffix to communicate
extra clear the alpha state of the module.
* 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>
* 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
* 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
* 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>