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

275 Commits

Author SHA1 Message Date
darkfeline
69e44a337b
Fix ParentBased comment formatting (#3553)
godoc doesn't have an unordered list syntax
2022-12-24 10:16:11 -08:00
Ziqi Zhao
a8b9ddc7f6
attribute: fix slice related function bug (#3252)
* attribute: fix slice related function bug

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-10-13 09:34:02 -05:00
Bogdan Drutu
e4bdfe7b56
Fix sdktrace.TraceProvider Shutdown/ForceFlush when no processor register (#3268)
* Fix sdktrace.TraceProvider Shutdown/ForceFlush when no processor register

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-10-12 13:44:18 -07:00
wdullaer
b369e59ba1
Improve trace status handling (#3214)
* Implement specification compliant trace status handling

* Update trace/trace.go

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

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* chore: Make linter happy

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-09-23 11:39:53 -07:00
Joshua MacDonald
49a653682f
Safely truncate over-length string attributes (#3156)
* Safely truncate over-length string attributes

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-09-12 09:54:58 -05:00
Aaron Clawson
7aba25d651
Revert Adding attributes to the instrumentation scope.
Revert "Add instrumentation scope attributes (#3131)" (#3154)

This reverts commit 0078faeb0e.

Revert "Add WithScopeAttributes MeterOption to metric API package (#3132)"

This reverts commit 81a9bab814.
2022-09-09 09:06:58 -05:00
Mikhail Mazurskiy
13ddf7d31e
Shut down all processors even on error (#3091) 2022-09-02 11:50:44 -05:00
Tyler Yahn
0078faeb0e
Add instrumentation scope attributes (#3131)
* Add WithScopeAttributes TracerOption to trace API

* Add Attributes field to instrumentation Scope

* Use scope attributes for new Tracer

* Fix stdouttrace expected test output

* Allow unexported Set fields in sdk/trace test

* Export instrumentation scope attrs in OTLP

* Add changes to the changelog

* Fix imports with make lint

* Add unit tests for WithScopeAttributes

* Fix English in Scope documentation
2022-08-31 15:19:50 -07:00
Mitch Usher
55b49c407e
Update tracer to guard for a nil ctx (#3110)
* Update tracer to guard for a nil ctx

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-08-26 08:53:33 -05:00
Aaron Clawson
8423364f5a
Update golangci-lint to v1.48.0 (#3105)
* Update golangci-lint to v1.48.0

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2022-08-24 21:42:28 -05:00
Tyler Yahn
5568a30723
Add semconv/v1.12.0 (#3010)
* Add semconv/v1.12.0

* Update all semconv use to v1.12.0

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2022-07-13 09:55:43 -04:00
Craig Pastro
575e1bb270
Deprecate Library and move all uses to Scope (#2977)
* Deprecate Library and move all uses to Scope

* Add PR number to changelog

* Don't change signatures in stable modules

* Revert some changes

* Rename internal struct names

* A bit more renaming

* Update sdk/trace/span.go

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

* Update based on feedback

* Revert change

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-07-06 14:55:46 -04:00
Tyler Yahn
1f5b159161
Use already enabled revive linter and add depguard (#2883)
* Refactor golangci-lint conf

Order settings alphabetically.

* Add revive settings to golangci conf

* Check blank imports

* Check bool-literal-in-expr

* Check constant-logical-expr

* Check context-as-argument

* Check context-key-type

* Check deep-exit

* Check defer

* Check dot-imports

* Check duplicated-imports

* Check early-return

* Check empty-block

* Check empty-lines

* Check error-naming

* Check error-return

* Check error-strings

* Check errorf

* Stop ignoring context first arg in tests

* Check exported comments

* Check flag-parameter

* Check identical branches

* Check if-return

* Check increment-decrement

* Check indent-error-flow

* Check deny list of go imports

* Check import shadowing

* Check package comments

* Check range

* Check range val in closure

* Check range val address

* Check redefines builtin id

* Check string-format

* Check struct tag

* Check superfluous else

* Check time equal

* Check var naming

* Check var declaration

* Check unconditional recursion

* Check unexported return

* Check unhandled errors

* Check unnecessary stmt

* Check unnecessary break

* Check waitgroup by value

* Exclude deep-exit check in example*_test.go files
2022-05-19 15:15:07 -05:00
Tyler Yahn
fdfc821bac
Add godot linter to golangci (#2845)
Comment should be complete sentences outside of lists with sentence
fragments. This adds the godot linter to check these complete sentences
end with punctuation. If they do not, running fix will append a period.
2022-04-25 13:22:49 -07:00
Tyler Yahn
c05c3e237d
Add semconv/v1.10.0 (#2842)
* Add the semconv/v1.10.0 package

* Upgrade semconv used to v1.10.0

* Add changes to changelog
2022-04-22 07:41:28 -07:00
Brad Topol
8574d43509
Add semconv/v1.9.0 package (#2792)
* Add semconv/v1.9.0 package
Closes: #2756

Signed-off-by: Brad Topol <btopol@us.ibm.com>

* Updated PR number in CHANGELOG

Signed-off-by: Brad Topol <btopol@us.ibm.com>
2022-04-18 10:38:55 -07:00
Tyler Yahn
1884de2b4b
Add semconv/v1.8.0 (#2763)
* No wrap RELEASING Semantic Convention Generation section

* Initial generator

* Update template render

* Add exception and schema templates

* Add semconv/internal http unification

* Add http template

* Add licenses header

* Embed the templates

* Update static version in schema tmpl

* Add semconv-generate target to Makefile

Use this target to generate versions of the semconv packages.

* Generate semconv packages

* Update RELEASING to use make semconv-generate

* Add comments to semconvkit

* Generate semconv/v1.8.0

* Use new version of semconv

* Add changes to changelog

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-04-16 01:58:24 -04:00
Vibhav Pant
fdbcf71c8f
Allow setting the Sampler via environment variables (#2517)
* Allow setting the Sampler via environment variables (#2305)

* Add changelog entry.

* Replace t.Setenv with internaltest/SetEnvVariables for Go <= 1.6.

* Handle the lack of a sampler argument without logging errors.

* Add additional test cases and error checks.

* Refactor documentation.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>

* emitBatchOverhead should only be used for splitting spans into batches (#2512)

* emitBatchOverhead should only be used for splitting spans into batches (#2503)

* limit max packet size parameter

* Add additional errors types, simplify abstractions and error handling

* Make error comparisons less fragile.

* Fix typo in jaeger example (#2524)

* Fix some typos in docs for Go libraries (#2520)

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

* Fix getting-started.md Run function (#2527)

* Fix getting-started.md Run function, it assigns this new context to a variable shared between connections in to accept loop. Thus creating a growing chain of contexts. so every calculate fibonacci request, all spans in a trace.

* add a comment explaining the reason for that new variable

* update example fib

* Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 across the project (#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. (#2529)

* 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>

* Bump go.opentelemetry.io/proto/otlp from 0.11.0 to 0.12.0 (#2546)

* 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>

* Remove unused sdk/internal/santize (#2549)

* Add links to code examples and docs (#2551)

* Bump github.com/prometheus/client_golang from 1.11.0 to 1.12.0 in /exporters/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](https://github.com/prometheus/client_golang/compare/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 implementation and use (#2556)

* 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 (#2515)

* 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 (#2566)

* 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](https://github.com/golang/tools/compare/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>

* Bump github.com/golangci/golangci-lint from 1.43.0 to 1.44.0 in /internal/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](https://github.com/golangci/golangci-lint/compare/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>

* Bump github.com/prometheus/client_golang from 1.12.0 to 1.12.1 in /exporters/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](https://github.com/prometheus/client_golang/compare/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/internal/retry package (#2562)

* 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>

* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/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](https://github.com/grpc/grpc-go/compare/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>

* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /example/otel-collector (#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](https://github.com/grpc/grpc-go/compare/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>

* Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/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](https://github.com/grpc/grpc-go/compare/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 Options to accept type not pointer (#2558)

* 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 or Tracer fields in SDK recordingSpan (#2575)

* 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.

* [website_docs] fix page meta-links (#2580)

Contributes to https://github.com/open-telemetry/opentelemetry.io/issues/1096

/cc @cartermp @austinlparker

* Validate members once, in `NewMember` (#2522)

* 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>

* Fix link to Zipkin exporter (#2581)

Currently it is linked to the old package that was moved.

* Unexport EnvBatchSpanProcessor* constants (#2583)

* Move BSP env support to internal

* Use pkg name

* Update env test

* Use internal/env in sdk/trace

* Avoid an extra allocation in applyTracerProviderEnvConfigs.

* Add additional errors for ratio > 1.0.

* Add test cases for ratio > 1.0.

* Update CHANGELOG.md

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: jaychung <ken8203@gmail.com>
Co-authored-by: Ben Wells <b.v.wells@gmail.com>
Co-authored-by: Jeremy Kaplan <jeremy@stytch.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: thinkgo <49174849+thinkgos@users.noreply.github.com>
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com>
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Chao Weng <19381524+sincejune@users.noreply.github.com>
Co-authored-by: Patrice Chalin <chalin@users.noreply.github.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2022-03-21 09:39:30 -07:00
Tyler Yahn
0d0a7320e6
Update span limits to comply with specification (#2637)
* PoC for span limit refactor

* Rename config.go to span_limits.go

* Add unit tests for truncateAttr

* Add unit tests for non-string attrs

* Add span limit benchmark tests

* Fix lint

* Isolate span limit tests

* Clean span limits test

* Test limits on exported spans

* Remove duplicate test code

* Fix lint

* Add WithRawSpanLimits option

* Add test for raw and orig span limits opts

* Add changes to changelog

* Add tests for span resource disabled

* Test unlimited instead of default limit

* Update docs

* Add fix to changelog

* Fix option docs

* Do no mutate attribute

* Fix truncateAttr comment

* Remake NewSpanLimits to be newEnvSpanLimits

Update and unify documentation accordingly.

* Update truncateAttr string slice update comment

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-03-03 07:56:07 -08:00
Aaron Clawson
a1fff3c258
Add Marshaling implementations for exporters (#2578)
* Add Marshaling implementations for exporters

* Changelog

* Fix changelog

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-02-25 10:28:28 -08:00
Aaron Clawson
8eb376615e
Update BatchSpanProcessor debug message (#2640)
* update debug message

* update changelog

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-02-25 07:55:50 -08:00
Will Li
98c2c9d96c
Add env support for span limits configuration (#2606)
* add env support for otel_span configuration

Signed-off-by: Cuichen Li <cuichli@cisco.com>

* update changelog

* update changelog and some logic based on comment

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* add document about retrieve value from environment variable

Signed-off-by: Cuichen Li <cuichli@cisco.com>

* remove trailing whitespace

Signed-off-by: Cuichen Li <cuichli@cisco.com>

* parse environment variable before apply the options

* Update CHANGELOG.md

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

* Update sdk/trace/provider_test.go

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

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-02-17 08:21:13 -08:00
Bogdan Drutu
2a9cedf5fe
Fix race condition in reading the dropped spans number (#2615)
* Fix race condition in reading the dropped spans number

As any race condition this should be consider an undefined behavior, and a patch release should be done.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update CHANGELOG.md

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2022-02-16 09:00:31 -08:00
Tyler Yahn
98bb1056c0
Replace recordingSpan attributes implementation with slice of attributes (#2576)
* Replace recordingSpan attributes implementation

Instead of an LRU strategy for cap-ing span attributes, comply with the
specification and drop last added. To do this, the attributesmap is
replaced with a slice of attributes.

* Remove attributesmap files

* Refine addition algorithm

Unify duplicated code.

Fix deduplication algorithm.

Fix droppedAttributes to always be returned, even if the span has no
attributes.

* Unify span SetAttributes tests

* Doc fix to attr drop order in changelog

* Test span and snapshot attrs

* fix lint

* Add tests for recordingSpan method defaults

* Comment why pre-allocation is not done

* Correct grammar in recordingSpan allocation comment

* Update sdk/trace/tracer.go

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-02-07 12:58:05 -08:00
Tyler Yahn
b60d53d316
Unexport EnvBatchSpanProcessor* constants (#2583)
* Move BSP env support to internal

* Use pkg name

* Update env test

* Use internal/env in sdk/trace
2022-02-07 07:57:44 -08:00
Tyler Yahn
d5292e3cd1
Do not store TracerProvider or Tracer fields in SDK recordingSpan (#2575)
* 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.
2022-02-01 15:20:35 -08:00
Tyler Yahn
bd817df68c
Change Options to accept type not pointer (#2558)
* 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
2022-02-01 15:51:23 -06:00
Chao Weng
3cf35bdad6
Add env support for batch span processor (#2515)
* Add env support for batch span processor

* Update changelog

* lint
2022-01-28 10:07:21 -06:00
Tyler Yahn
d3bb03883b
Optimize evictedQueue implementation and use (#2556)
* 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
2022-01-27 13:55:21 -08:00
Aaron Clawson
f24f52aa06
Debug Logging for sdk/trace (#2500)
* Debug Logging for sdk/trace

* Fixes spelling, adds marshaling to attribute sets

Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2022-01-10 19:58:01 -05:00
Aaron Clawson
7e76cd8dd3 Merge remote-tracking branch 'upstream/main' into internal_logging 2021-12-02 19:59:57 +00:00
Aaron Clawson
0f2b54b746 Minor PR fixes 2021-12-01 16:47:46 +00:00
Aaron Clawson
d467ac529a Fixes race, moved into global 2021-11-24 20:06:39 +00:00
Aaron Clawson
051227c9ed
Added Benchmarks around events (#2405)
* Added Benchmarks around events

Also fixed the attribute benchmarks to reflect the # of attributes in the test

* Fix test txt, and too new a version of time

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-11-22 07:59:41 -08:00
Aaron Clawson
0081b5ef09 Merge branch 'main' into internal_logging 2021-11-19 15:31:04 +00:00
Aaron Clawson
8b210d20d4 simplifies error handling, uses internal logger by default 2021-11-17 16:17:04 +00:00
Tyler Yahn
3811e3449f
Handle nil testSpanProcessor (#2400)
Remove nil check on return from NewTestSpanProcessor as it can never be
nil, addressing #2396. Also, add nil checks for testSpanProcessor
methods to prevent panics.
2021-11-16 08:57:10 -08:00
Bogdan Drutu
4d9d882c38
Fix imports in all files except generated files in jaeger exporter (#2383)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-11-13 08:35:04 -08:00
Aaron Clawson
8d0b098602 Creates a internal facing logging interface
This is a simple loggin interface to be used interally for the sdk.
Included is an exmaple in `namedtracer` run:
```
cd example/namedtracer
go run . >/dev/null
```
2021-11-12 15:23:18 +00:00
Philip K. Warren
6d2aeb0dc3
Empty queued spans when ForceFlush called (#2335)
* Empty queued spans when ForceFlush called

Update the implementation of ForceFlush() to first ensure that all spans
which are queued are added to the batch before calling export spans.
Create a small ReadOnlySpan implementation which can be used as a marker
that ForceFlush has been invoked and used to notify when all spans are
ready to be exported.

Fixes #2080.

* Add a changelog entry.

* Update CHANGELOG.md

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

* Update sdk/trace/batch_span_processor.go

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

* Improve test case to verify multiple flushes.

* Refactor code to use enqueue.

* Be more defensive on waiting for queue.

Update the handling of the force flush span so we only wait on the
channel if we were able to enqueue the span to the queue.

* Fix linter.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-11-05 11:34:57 -04:00
Tyler Yahn
c4ba4811a2
Add semconv/v1.7.0 package (#2320)
* Add semconv/v1.7.0 package

Generated from the v1.7.0 release of the specification using the
semconvgen tool manually. This also updates the project to use this
version of the semconv package.

This does not include the prior, and missing, v1.5.0 and v1.6.0 versions
of the semconv package. They are planned to be added in a follow-on PR.

* Update CHANGELOG.md
2021-10-22 08:43:47 -07:00
Tyler Yahn
23a33739e9
Fix flaky test TestSimpleSpanProcessorShutdownHonorsContextCancel (#2290)
* Fix flaky test TestSimpleSpanProcessorShutdownHonorsContextCancel

* Add changes to changelog

* Prioritize return of exporter error

* Update changelog description

* Fix deadlock bug
2021-10-19 08:13:37 -07:00
Srikanth Chekuri
8ba6da8f3e
Skip links with invalid span context (#2275)
* Skip links with invalid span context

* Add CHANGELOG entry

* Review suggestions
2021-10-12 07:45:10 -07:00
José Carlos Chávez
099df58e4e
chore: adds vanity import check. (#2255)
* chore: adds vanity import check.

* chore: runs vanity import check on ci.

* fix: set right target on CI.

* fix: fixes install for porto.

* fix: install right proto bin.

* chore: list all files insides the tools directory.

* fix: fixes vanity import target

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

* chore(vanity-imports): adds vanity import support.

* fix: fixes internal generation.

* chore: runs go mod tidy in tools.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-09-27 22:37:26 -04:00
Tyler Yahn
92551d3933
Prerelease v1.0.0 (#2250)
* Update versions file for 1.0.0 release

* Prepare stable-v1 for version v1.0.0

* Update trace signal status in documentation

* Update changelog

* Update CHANGELOG.md

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

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2021-09-20 13:02:46 -07:00
Tyler Yahn
c7ae470a16
Refactor SDK span creation and implementation (#2213)
* Refactor startSpanInternal into a tracer method

The span creation and configuration process is split across the tracer
Start method and the startSpanInternal function, each living in
different files. This adds confusion when developing. It requires the
developer to remember certain parts of the configuration happen in one
place or the other.

This unifies the creation and configuration of a new span. It makes this
unification by creating a newSpan method on the tracer. This method will
do all the configuration needed for a new span other than setting the
execution task tracker. This remains a part of the Start method to
preserve any existing timing and tracing the already exists.

* Add a non-recording span to the SDK

* Assign returned context from runtime trace task

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-09-02 17:30:12 -04:00
Tyler Yahn
1f527a52ab
Update trace API config creation functions (#2212)
* Update trace API config creation funcs

Follow our style guide and return the config struct instead of pointers.

* Update changelog with changes

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-09-01 15:44:13 -04:00
Bhautik Pipaliya
dfc866bd03
Support capturing stack trace (#2163)
* capturing stack trace support

* added changelog entry

* remove error package stack trace support

* modified unnecessary changes to go.sum files

* added EventOption to enable stack trace capturing

* added tests

* added runtime.Stack method and minor changes

* minor changes

* remove redundant line

* fix gihub check on linter

* fix tests

* fix tests

* Update sdk/trace/trace_test.go

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Update sdk/trace/trace_test.go

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-08-13 17:44:18 -04:00
Tyler Yahn
a8bb0bf89f
Make the tracetest.SpanRecorder concurrent safe (#2178)
* Make the tracetest.SpanRecorder concurrent safe

The otelgrpc instrumentation in the contrib repository needs a
concurrent safe implementation as the stream testing is done in a
separate goroutine.

* Refactor concurrency tests
2021-08-12 09:12:31 -07:00
Tyler Yahn
11f62640ee
Add a SpanRecorder to the sdk/trace/tracetest (#2132)
* Add a SpanRecorder to the sdk/trace/tracetest

* Add changes to changelog

* Run make precommit

* Rename tests
2021-07-29 10:00:58 -07:00