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

451 Commits

Author SHA1 Message Date
Anthony Mirabella
f0c70ffde0
Add StartOptions to Tracer.WithSpan() (#472)
Tracer.WithSpan() will now accept StartOptions as a variadic final parameter `opts`
that will be passed to the Tracer.Start() invocation that creates the Span
wrapping the user-provided function.
2020-02-10 21:07:32 -05:00
Tyler Yahn
0f1771f374
Add @MrAlias as an approver (#471) 2020-02-10 19:36:04 -05:00
Bogdan Drutu
2584c3e7c4
Call Gosched if load an unmapped record (#469)
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-10 16:20:29 -08:00
Bogdan Drutu
69df67d449
Refactor metric records logic (#468)
* Refactor metric records logic.

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

* Fix lint errors

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

* Fix a bug that we try to readd the old entry instead of a new one.

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

* Update comments in refcount_mapped.

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

* Remove the need to use a records list, iterate over the map.

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

* Fix comments and typos

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

* Fix more comments

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

* Clarify tryUnmap comment

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

* Fix one more typo.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-06 14:45:56 -08:00
Junki Kaneko
4818358f94
Move dependencies of tools package to a tools directory (#466)
* Move dependencies of tools package to a tools directory

* remove TOOLS_MOD_DIR from ALL_GO_MOD_DIRS in a Makefile.
then run 'go mod tidy' on ALL_GO_MOD_DIRS and TOOLS_MOD_DIR.

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-06 10:51:00 -08:00
Krzesimir Nowak
cab6b28263
Fix URL to opentelemetry.io (#464)
Looks like a fallout from adding the `otel` part to the package
names. Spotted by Matej Gera.
2020-02-05 07:18:40 -08:00
Krzesimir Nowak
5d6654dab1
Use latest version of golang 1.13 in CI (#465)
CircleCI has golang images without the patch versions which contain
the latest patch version of golang. That way we do not need to
remember to update the CI config on every patch release.
2020-02-04 21:21:15 -08:00
Tyler Yahn
493e13f834
Update metric types to not use pointer receivers (#462)
The methods on the `Float64Gauge`, `Int64Gauge`, `Float64Counter`,
`Int64Counter`, `Float64Measure`, and `Int64Measure` `struct`s do not
need to mutate the internal state of the `struct` and can therefore be
defined with value receivers instead. This aligns closer to the function
signatures of each instruments constructor function. Additionally, this
change means calls to these methods do not need an allocation to the
heap.

Resolves #440

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-04 10:27:03 -08:00
Krzesimir Nowak
942713a02d
Replace span relationship with a potentially remote parent context (#451)
This PR removes the non-compliant ChildOf and FollowsFrom interfaces
and the Relation type, which were inherited from OpenTracing via the
initial prototype. Instead allow adding a span context to the go
context as a remote span context and use a simple algorithm for
figuring out an actual parent of the new span, which was proposed for
the OpenTelemetry specification.

Also add a way to ignore current span and remote span context in go
context, so we can force the tracer to create a new root span - a span
with a new trace ID.

That required some moderate changes in the opentracing bridge - first
reference with ChildOfRef reference type becomes a local parent, the
rest become links. This also fixes links handling in the meantime. The
downside of the approach proposed here is that we can only set the
remote parent when creating a span through the opentracing API.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-02-04 08:55:03 -08:00
Krzesimir Nowak
574463c9ef
Allow dropping items from correlations + docs + cleanups (#454)
* Drop entry from correlation map

Entry used to contain stuff like TTL, but right now the notion of
entry was dropped from the spec.

* Compute exact size of the correlations map

The map will be immutable, so spend some more time to ensure that we
will not unnecessarily waste some memory on a basically read-only map.

* Allow dropping keys from correlations map

This is to follow the spec. Before this change it was possible in an
awkward way by using Foreach to gather and filter the key-value pairs,
and then calling NewMap with a MultiKV MapUpdate.

* Document the correlation package

* Add missing license blurbs in correlation package

* Add tests for deleting items in correlations

* Factor out getting map size and test it

This is an implementation detail that can't be tested in a black-box
manner.

* Fix copyright dates

* Simplify/disambiguate keySet function parameters/return values

* Fix typo in Apply docs

* Fix test names

* Explain the nonsense of dropping keys from new map
2020-02-03 13:07:53 -08:00
Amr Hanafi
6051c81493
Add AlwaysParentSample sampler (#455)
* Add AlwaysParentSample

* Update sampler doc

Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>

* Address PR comments

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-03 10:22:52 -08:00
Cheng-Lung Sung
32489ddae9
make trace.TraceContext as default context propagator (#456)
* make trace.TraceContext as default context propagator

* Update api/trace/trace_context_propagator.go

Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>

* Update plugin/othttp/handler.go

* Update DefaultPropagator in plugin/{http,grpc}trace

* update DefaultPropagator as method instead of var

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-02-03 09:28:39 -08:00
Amr Hanafi
8fcdf8be73
Send span.kind to jaeger and overwrite grpc metadata instead of using append (#441)
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
2020-01-31 14:03:04 -08:00
Krzesimir Nowak
405a92ab3e
Misc fixes from PR 381 (#443)
* Remove Vendor constants from tracing plugins

Unused. And confusing, since "ot" may mean "opentracing" as well.

* Simplify current span key declaration

No need for a block.

* Fix typo

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-30 10:25:53 -08:00
Krzesimir Nowak
6b4acf47b8 Reorganize propagation code (shrink PR 381) (#444)
* Rename distributedcontext package to correlation

Correlation is the name we agreed upon.

* Move trace propagators to api/trace

The trace propagators tests had to be moved to a testtrace subpackage
to avoid import cycles between api/trace and internal/trace.

Needed to shut up golint about stutter in trace.TraceContext -
TraceContext is a name of a W3C spec, so this stutter is
expected. It's certainly still better than golint's suggestion of
having trace.Context.

* Rename api/propagators to api/propagation

This package will not contain any propagators in the long run, just
the interface definitions.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-28 10:13:46 -08:00
Krzesimir Nowak
437d9af9ab Reword some function documentation in grpc plugin (#446)
Fixes #435.
2020-01-27 10:39:21 -08:00
Liz Fong-Jones
7200bb943f
finish adding krnowak to approvers (#445)
- [x] >10 substantive contributions
- [x] Active >1mo
- [x] add to `CODEOWNERS` (done already in #313)
- [x] Maintainer nomination (done already in #313)
- [ ] Add to @open-telemetry/go-approvers 
- [x] Add to `CONTRIBUTING.md` (done in this pull)
2020-01-24 13:05:29 -08:00
Krzesimir Nowak
027855962b Some makefile fixes (#442)
* Generate and build before linting

Generated files may require some formatting that happens during
linting. Also missing generated files may result in linter failures.

Building can shake out any syntax/semantic errors and report them in a
much nicer way than the linter does. Which is exactly the reason the
build was running before linters before the Makefile simplification.

* Make stringer tool a dep of generate target, not lint

Lint target does not use the stringer utility - it is being used by go
generate.
2020-01-24 12:06:24 -08:00
Rebecca Pruim
20bb650b2d Improve detail in stdout exporter (#436)
* Switch stdout exporter to use ungrouped batcher

* Add unspecified keys to name without equals signs

* Fix tests for stdout exporter

* Add test for unspecified keys

* Move test to stdout_test.go
2020-01-24 05:51:58 -08:00
Gustavo Silva Paiva
2c460f0d97 Adds Histogram Aggregator (#433)
* histogram aggregator draft

* add tests for buckets

* naming stuffs

* docs

* add tests for buckets

* fix doc

* update year

* adds docs for Histogram

* docs for boundaries.

* addresses review comments
Change to less-than buckets. Add offset checks. Unexport fields that don't need to be exported. Fix tests when running on profile with int64 number kind.

* sort boundaries

* remove testing field

* fixes import order

* remove print 🙈
2020-01-21 09:15:09 -08:00
Tyler Yahn
dcd0a10493 Rename the sdk/export/metric package name (#432)
Rename the package from "export" to "metric". Note that all the existing
imports of this package use an explicit name of `export` and, therefore,
no import declaration changes are included.

Rename the `MetricKind` to `Kind` to not stutter in the type usage. Note
this does not include a method name change for the `Descriptor` method
`MetricKind`.
2020-01-16 10:05:12 -08:00
Damien Mathieu
3a32a19c9a fix aggregator.go import package (#431)
This import package doesn't match the tests file, preventing imports of
the project from master with tests (without go modules).

The package path matches the test file version, so this moves
aggregator.go to match too.
2020-01-15 09:17:18 -05:00
Tyler Yahn
2d5ba32f4f Remove Tracer name prefix for Span names (#430)
Spans should not have the Tracer name as a prefix for their names. This
removes the `spanNameWithPrefix` function and instead passes through the
span name unmodified wherever this had been called.

Tests that checked Span names are updated to have the non-prefix
expected names.
2020-01-14 04:54:48 -08:00
Gustavo Silva Paiva
d85178b63b use stateful batcher on prometheus exporter (#428) 2020-01-10 20:21:59 -05:00
Liz Fong-Jones
ea67a56427
go module update for release v0.2.1 (#413) 2020-01-08 09:41:58 -05:00
Martin Garton
8b0f7ef5f4 Fix aggregator import path (#421)
When this was moved, the import path was not updated to match.  This
fixes it to avoid a message like "code in directory foo expects import
bar"
2020-01-07 10:30:41 -05:00
Johannes Liebermann
d4557c3dfa Refactor current span check (#419)
- Simplify conditionals.
- Remove unnecessary nil check.

Go type assertions return a bool value indicating whether the
assertion succeeded. When the assertion is performed on a nil value,
the bool becomes false without a panic, therefore the nil check is
unnecessary.
2020-01-06 14:24:51 -05:00
Liz Fong-Jones
4a8667986b
module tag script for releng (#414) 2020-01-06 13:20:43 -05:00
Cheng-Lung Sung
723639600d Refine CONTRIBUTING.md: make test is included in `make precomm… (#416) 2020-01-06 13:16:27 -05:00
Tyler Yahn
91091b44eb Add comments and test for 64-bit field alignment (#418)
* Add comments on needed filed alignment

Add comment about alignment requirements to all struct fields who's
values are passed to 64-bit atomic operations.

Update any struct's field ordering if one or more of those fields has
alignment requirements to support 64-bit atomic operations.

* Add 64-bit alignment tests

Most `struct` that have field alignment requirements are now statically
validated prior to testing. The only `struct`s not validated that have
these requirements are ones defined in tests themselves where multiple
`TestMain` functions would be needed to test them. Given the fields are
already identified with comments specifying the alignment requirements
and they are in the test themselves, this seems like an OK omission.

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-06 13:08:40 -05:00
Liz Fong-Jones
aefc49cfe6
Update CONTRIBUTING.md (#417)
@paivagustavo's affiliation is wrong
2020-01-05 22:00:45 -05:00
Liz Fong-Jones
4c9bf78ab3 s/options/config/ (#410)
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-01-03 09:48:45 -08:00
Luis
71f38454c8 fixed typo (#408)
this is a small fix of a single typo that triggered my OCD ;-)

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-03 09:38:05 -08:00
Tyler Yahn
bb4f7facfb Global trace forwarding implementation (#406)
* Global trace forwarding implementation according to https://github.com/open-telemetry/oteps/pull/74
2020-01-02 16:20:38 -05:00
Liz Fong-Jones
b80b336eb8
Update owners/approvers list in CONTRIBUTING.md (#409) 2020-01-02 13:59:42 -05:00
Matej Gera
067aa9e142 [metrics] standardize/simplify export pipeline setup (#395)
* Introduce simplified export pipeline setup for stdout

* Standardize dogstatsd,stdout,prometheus calling.

* Creates NewRawExporter, NewExportPipeline, InstallNewPipeline methods.
* Uses Options rather than Config throughout for options.

* fix merge conflicts.

Co-authored-by: Liz Fong-Jones <elizabeth@ctyalcove.org>
2020-01-02 10:41:21 -08:00
Cheng-Lung Sung
5eb457a119 [trace] add option.Writer for stdout output (#404)
* add option.File for stdout output

* Unify the naming of `Writer` field (io.Writer) in Options
2020-01-02 11:40:37 -05:00
Liz Fong-Jones
501cd75de6
Document compatible exporters in a neutral fashion (#405) 2019-12-31 13:48:24 -05:00
Joshua MacDonald
dd781560d4
Rename handle to bound instrument (@sircelsius) (#400)
* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* chore(meter): renamed from *BoundInstrument to Bound*, renamed AcquireBoundInstrument to Bind

* chore(meter): renamed Release to Unbind

* Self feedback in doc.go

* Rename confusing method name

Co-authored-by: Marc Bramaud <sircelsius@users.noreply.github.com>
2019-12-27 16:30:19 -08:00
Letian Zhang
4f88422aa7 initialize checkpoint when creating ddsketch aggregator to prevent panic when merging into a empty one (#402) (#403) 2019-12-26 08:31:41 -08:00
Joshua MacDonald
1414d363de
Global meter forwarding implementation (#392)
* Initial skeleton

* Revert noop provider removal

* Checkpoint

* Checkpoint

* Implement Bound instrument and LabelSet

* Add test

* Add a benchmark

* Add a release test

* Document LabelSetDelegator

* Lint and comments

* Add a second Meter test; fix typo; add a panic

* Add a test for the builtin SDK

* Address feedback
2019-12-23 23:03:04 -08:00
Joshua MacDonald
11f67cea8e Comments in the metrics SDK (#399)
* Comments from walkthrough

* Update
2019-12-23 16:38:35 -08:00
huikang
225b466428 [#396] Remove http.request span in httptrace (#397)
Signed-off-by: Hui Kang <kangh@us.ibm.com>

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2019-12-23 10:40:02 -08:00
Gustavo Silva Paiva
6f04903876 Change prometheus to not aggregate metrics and only export them. (#385)
* draft using stop aggregating on prometheus client (counters)

* remove prometheus client aggregations

Measures are being exported as summaries since histograms doesn't
exist on OpenTelemetry yet.

Better error handling must be done.

* make pre commit

* add simple error callback

* remove options from collector

* refactor exporter to smaller methods

* wording

* change to snapshot

* lock collection and checkpointset read

* remove histogram options and unexported fields from the Exporter

* documenting why prometheus uses a stateful batcher

* add todo for histograms

* change summaries objects to summary quantiles

* remove histogram buckets from tests

* wording

* rename 'lockedCheckpoint' to 'syncCheckpointSet'

* default summary quantiles should be defaulted to no buckets.

* add quantiles options

* refactor test.CheckpointSet and add docs

* flip aggregators merge

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2019-12-23 09:47:51 -08:00
Tyler Yahn
99cb01b246 Correct http-stackdriver example module name (#394)
Fix misspelling of opentelemetry.
2019-12-20 11:55:31 -05:00
Cheng-Lung Sung
09ae5378b7 rename Message in Event to Name (#389)
implements #387
2019-12-18 10:13:05 -08:00
Vineeth Pothulapati
b863b8f6ab Rename CurrentSpan to SpanFromContext & SetCurrentSpan to ContextWithSpan (#379)
Signed-off-by: vineeth <vineethpothulapati@outlook.com>
2019-12-11 08:51:32 -08:00
rghetia
658dd7d1b9
update release schedule. (#378)
- fixes #367
2019-12-09 15:31:25 -08:00
Jonas-Taha El Sesiy
1ab645fedb Consistently use pointer receivers for core.Number (#375)
Change all occurrences of value to pointer receivers
Add meta sys files to .gitignore
Code cleanup e.g.
- Don't capitalize error statements
- Fix ignored errors
- Fix ambiguous variable naming
- Remove unnecessary type casting
- Use named params

Fix #306
2019-12-09 13:03:11 -08:00
Dan Miller
30795ef58c readme: fix quick start example (#374)
Fixes #257, #305
2019-12-07 09:26:41 +11:00