Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the Sampler via environment variables #2517

Merged
merged 39 commits into from
Mar 21, 2022
Merged

Allow setting the Sampler via environment variables #2517

merged 39 commits into from
Mar 21, 2022

Conversation

vibhavp
Copy link
Contributor

@vibhavp vibhavp commented Jan 17, 2022

Fixes #2305

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 17, 2022

CLA Signed

The committers are authorized under a signed CLA.

@pellared
Copy link
Member

@vibhavp
Copy link
Contributor Author

vibhavp commented Jan 17, 2022

@pellared Thanks, I have signed the CLA.

@pellared pellared changed the title Allow setting the Sampler via environment variables (#2305) Allow setting the Sampler via environment variables Jan 17, 2022
@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #2517 (7c25f9f) into main (421d686) will increase coverage by 0.1%.
The diff coverage is 93.7%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2517     +/-   ##
=======================================
+ Coverage   75.8%   75.9%   +0.1%     
=======================================
  Files        173     174      +1     
  Lines      11684   11748     +64     
=======================================
+ Hits        8864    8926     +62     
- Misses      2610    2612      +2     
  Partials     210     210             
Impacted Files Coverage Δ
sdk/trace/sampler_env.go 91.4% <91.4%> (ø)
sdk/trace/provider.go 85.5% <100.0%> (+1.1%) ⬆️
sdk/trace/batch_span_processor.go 82.1% <0.0%> (+0.9%) ⬆️

sdk/trace/provider.go Outdated Show resolved Hide resolved
pellared
pellared previously approved these changes Jan 19, 2022
sdk/trace/provider.go Show resolved Hide resolved
Copy link
Contributor

@MadVikingGod MadVikingGod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this work. It looks good.

sdk/trace/provider.go Outdated Show resolved Hide resolved
sdk/trace/provider.go Show resolved Hide resolved
sdk/trace/sampler_env.go Outdated Show resolved Hide resolved
sdk/trace/sampler_env.go Outdated Show resolved Hide resolved
sdk/trace/sampler_env.go Outdated Show resolved Hide resolved
sdk/trace/provider_test.go Outdated Show resolved Hide resolved
@pellared pellared dismissed their stale review January 19, 2022 17:06

I agree with MadVikingGod comments.

@vibhavp
Copy link
Contributor Author

vibhavp commented Jan 20, 2022

@MadVikingGod Thanks for the comments, I'll address them.

@MrAlias
Copy link
Contributor

MrAlias commented Feb 4, 2022

This appears to be stalled. @vibhavp do you still have time to address the issues identified in the comments?

@MrAlias MrAlias added this to the Release v1.4.0/v0.27.0 milestone Feb 4, 2022
@vibhavp
Copy link
Contributor Author

vibhavp commented Feb 4, 2022

Sorry for the delay! I've been a little busy, but I should be able to address the comments this weekend.

sdk/trace/provider.go Outdated Show resolved Hide resolved
sdk/trace/sampler_env.go Show resolved Hide resolved
sdk/trace/provider_test.go Show resolved Hide resolved
@MrAlias
Copy link
Contributor

MrAlias commented Feb 9, 2022

Please be sure to fix the lint issue reported by the CI system.

@MrAlias MrAlias removed this from the Release v1.4.0/v0.27.0 milestone Feb 10, 2022
@MrAlias MrAlias added this to the Release v1.5.0 milestone Mar 2, 2022
MadVikingGod and others added 25 commits March 20, 2022 14:38
…2545)

* update go-cmp to 0.5.7

* fixes go.sums

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
* un-escape url coding when parsing baggage.

* Added changelog

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update go.opentelemetry.io/proto/otlp to v0.12.0

* Changelog

* Update CHANGELOG.md

Fix's md linting

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

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
…porters/prometheus (#2541)

* Bump github.com/prometheus/client_golang in /exporters/prometheus

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* go mod tidy

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Optimize evictedQueue impl and use

Avoid unnecessary allocations in the recordingSpan by using an
evictedQueue type instead of a pointer to one.

Lazy allocate the evictedQueue queue to prevent unnecessary operations
for spans without any use of the queue.

Document the evictedQueue

* Fix grammar
* Add env support for batch span processor

* Update changelog

* lint
* Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.8 to 0.1.9.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.1.8...v0.1.9)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
…rnal/tools (#2567)

* Bump github.com/golangci/golangci-lint in /internal/tools

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.43.0...v1.44.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
…porters/prometheus (#2570)

* Bump github.com/prometheus/client_golang in /exporters/prometheus

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.12.0...v1.12.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Fix TestBackoffRetry in otlp retry pkg

The delay of the retry is within two times a randomization factor (the
back-off time is delay * random number within [1 - factor, 1 + factor].
This means the waitFunc in TestBackoffRetry needs to check the delay is
within an appropriate delta, not equal to configure initial delay.

* Fix delta value

* Fix delta

Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
…otlptrace (#2568)

* Bump google.golang.org/grpc in /exporters/otlp/otlptrace

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.43.0...v1.44.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
…llector (#2565)

* Bump google.golang.org/grpc in /example/otel-collector

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.43.0...v1.44.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
…otlpmetric (#2572)

* Bump google.golang.org/grpc in /exporters/otlp/otlpmetric

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.43.0...v1.44.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
* Change trace options to accept type not pointer

Add benchmark to show allocation improvement.

* Update CONTRIBUTING.md guidelines

* Update all Option iface

* Fix grammar in CONTRIBUTING
)

* Do not store TracerProvider fields in span

Instead of keeping a reference to the span's Tracer, and therefore also
it's TracerProvider, and the associated resource and spanLimits just
keep the reference to the Tracer. Refer to the TracerProvider fields
when needed instead.

* Make span refer to the inst lib via the Tracer

Instead of holding a field in the span, refer to the field in the parent
Tracer.
* use NewMember, or specify if the member is not validated when creating new ones

* expect members to already be validated when creating a new package

* add changelog entry

* add an isEmpty field to member and property for quick validation

* rename isEmpty to hasData

So by default, an empty struct really is marked as having no data

* Update baggage/baggage_test.go

Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>

* don't validate the member in parseMember, we alredy ran that validation

We also don't want to use NewMember, as that runs the property
validation again, making the benchmark quite slower

* move changelog entry to the fixed section

* provide the member/property data when returning an invalid error

Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
Currently it is linked to the old package that was moved.
* Move BSP env support to internal

* Use pkg name

* Update env test

* Use internal/env in sdk/trace
CHANGELOG.md Outdated Show resolved Hide resolved
@MrAlias MrAlias merged commit fdbcf71 into open-telemetry:main Mar 21, 2022
@MrAlias MrAlias mentioned this pull request Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the OTEL_TRACES_SAMPLER* environment variables