* Push->basic
* Repackage
* Rename away from push
* Make exporter optional; export from a separate goroutine
* Move pull_test into controller_test
* Precommit pass
* New OTLP/Prom example
* Precommit
* Fix the example
* Shorten the example
* Test starting controller w/o exporter
* Test export timeout
* Remove ancient example & lint
* go.mod revert & tidy
* Comments
* Tidy a diff
* Tidy a diff
* Move export kind selector in the new example
* Split this test into its original parts
* Reduce diff size
* Changelog
* Remove extra Add/Done pair
* Remove unused stopCh param; document the Stop behavior
* Typo
* Use ctx
* Missed v0.15
* Apply PR feedback
* Precommit pass
* 0.14 -> 0.15 in new file
* Remove diff chunk markers
* Fix OTLP example
* Upstream
* dashpole comments
* aneurysm9 feedback
* Tidy go.sum
* Add Tracestate into the SamplingResult struct
Add `trace.Tracestate` field into the SDK `trace.SamplingResult` struct.
Use ParentContext from SamplingParameters to return Tracestate in
`traceIDRatioSampler`, `alwaysOnSampler` and `alwaysOffSampler`.
Add a new test to check that Tracestate is passed.
* Updated CHANGELOG.md for #1432 PR
Added changes description for #1432.
* Update sdk/trace/sampling_test.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add TraceState to API
* Add tests for TraceState
* Update related tests
- stdout exporter test
- SDK test
* Update OTLP span transform
* Update CHANGELOG
* Change TraceState to struct instead of pointer
- Adjust tests for trace API
- Adjust adjacent parts of codebase (test utils, SDK etc.)
* Add methods to assert equality
- for type SpanContext, if SpanID, TraceID, TraceFlag and TraceState are
equal
- for type TraceState, if entries of both respective trace states are
equal
Signed-off-by: Matej Gera <matejgera@gmail.com>
* Copy values for new TraceState, adjust tests
* Use IsEqualWith in remaining tests instead of assertion func
* Further feedback, minor improvements
- Move IsEqualWith method to be only in test package
- Minor improvements, typos etc.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Call otel.Handle with non-nil errors
That's what normally happens in other call sites. Those two didn't
check it, but passed the "error" to Handle. The default, delegating
implementation of ErrorHandler was printing the error unconditionally,
which resulted in pointless lines like `2020/12/07 19:51:28 <nil>` in
demos, for example.
* Add tests
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Store span data directly in the span
- Nesting only some of a span's data in a `data` field (with the rest
of the data living direclty in the `span` struct) is confusing.
- export.SpanData is meant to be an immutable *snapshot* of a span,
not the "authoritative" state of the span.
- Refactor attributesMap.toSpanData into toKeyValue and make it
return a []label.KeyValue which is clearer than modifying a struct
passed to the function.
- Read droppedCount from the attributesMap as a separate operation
instead of setting it from within attributesMap.toSpanData.
- Set a span's end time in the span itself rather than in the
SpanData to allow reading the span's end time after a span has
ended.
- Set a span's end time as soon as possible within span.End so that
we don't influence the span's end time with operations such as
fetching span processors and generating span data.
- Remove error handling for uninitialized spans. This check seems to
be necessary only because we used to have an *export.SpanData field
which could be nil. Now that we no longer have this field I think we
can safely remove the check. The error isn't used anywhere else so
remove it, too.
* Store parent as trace.SpanContext
The spec requires that the parent field of a Span be a Span, a
SpanContext or null.
Rather than extracting the parent's span ID from the trace.SpanContext
which we get from the tracer, store the trace.SpanContext as is and
explicitly extract the parent's span ID where necessary.
* Add ReadOnlySpan interface
Use this interface instead of export.SpanData in places where reading
information from a span is necessary. Use export.SpanData only when
exporting spans.
* Add ReadWriteSpan interface
Use this interface instead of export.SpanData in places where it is
necessary to read information from a span and write to it at the same
time.
* Rename export.SpanData to SpanSnapshot
SpanSnapshot represents the nature of this type as well as its
intended use more accurately.
Clarify the purpose of SpanSnapshot in the docs and emphasize what
should and should not be done with it.
* Rephrase attributesMap doc comment
"refreshes" is wrong for plural ("updates").
* Refactor span.End()
- Improve accuracy of span duration. Record span end time ASAP. We
want to measure a user operation as accurately as possible, which
means we want to mark the end time of a span as soon as possible
after span.End() is called. Any operations we do inside span.End()
before storing the end time affect the total duration of the span,
and although these operations are rather fast at the moment they
still seem to affect the duration of the span by "artificially"
adding time between the start and end timestamps. This is relevant
only in cases where the end time isn't explicitly specified.
- Remove redundant idempotence check. Now that IsRecording() is based
on the value of span.endTime, IsRecording() will always return
false after span.End() had been called because span.endTime won't
be zero. This means we no longer need span.endOnce.
- Improve TestEndSpanTwice so that it also ensures subsequent calls
to span.End() don't modify the span's end time.
* Update changelog
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Let SynchronizedMove(nil) reset and discard
* Add common test for SynchronizedMove(nil)
* End-to-end test for the Processor and SumObserver
* Implement SynchronizedMove(nil) six ways
* Lint
* Changelog
* Test no reset for wrong aggregator type; Fix four Aggregators
* Cleanup
* imports
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Enable support for externally-defined ID generators
* Moved the SDK's `internal.IDGenerator` interface to the `sdk/trace`
package.
* Added `trace.WithIDGenerator()` `TracerProviderOption`.
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update CHANGELOG.md with PR info
* Address PR feedback:
* Fix IDGenerator godoc comment
* rename type defaultIDGenerator to randomIDGenerator
* rename defIDGenerator() to defaultIDGenerator()
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Rework trace.IDGenerator interface
* NewTraceID() -> NewIDs(ctx)
** Returns both TraceID and SpanID
* NewSpanID() -> NewSpanID(ctx, traceID)
** Returns only SpanID, has access to TraceID
* Both methods now receive a context, from which they may extract
information
* startSpanInternal() updated to receive a context to pass to the ID
generator
* Drop outdated comment from docblock
Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
* Move global code to toplevel package
* Move version function to toplevel package
* Update changelog
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add parent context to SpanProcessor.OnStart
The spec requires doing so. Right now SpanProcessor implementations
aren't doing anything with this argument.
* Update changelog
* Fix typo in test name
* Move registry package under metric
* Move Number type to the metric/number subpackage
This also renames NumberKind type to Kind.
* Update changelog
* Drop outdated comment
Remove cruft about spanStore.
Update documentation about how span.mu is used (related to #1311).
Reformat to conform with idiomatic field documentation.
* Update README
Move project status to top of project documentation and add explicit
warnings that this project may introduce breaking changes.
* Add disclaimer to public packages docs
* Use explicit warning in README
* Add a Shutdown method to api TraceProvider
- sdktraceprovider shutdown span processors
- In examples, replace processosr shutdown with
traceprovider's shutdown
Signed-off-by: Hui Kang <kangh@us.ibm.com>
* remove shutdown in the api provider interface
* Add context in parameter and return error
* handle error in shutdown
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update metric Kind to InstrumentKind
* Update all the other modules with Kind rename
* Update metric Descriptor with instrument Kind rename
* Update other modules with Descriptor method rename
* Update OTLP exporter test field name
* Rename kind filenames
* Add changes to CHANGELOG
* Fix documentation for Grouping and PrecomputedSum
* Rename meter.go to metric.go
* Move descriptor.go into metric.go
* Move must.go into metric.go
* Move instruments into metric_instrument.go
* Rename metric api_test.go to metric_test.go
* Move instrumentkind_test.go into metric_test.go
* Rename sdkapi.go metric_sdkapi.go
* Move api/metric into otel
* Update to use moved packages
* Rename otel.go to error_handler.go
* Add changes to CHANGELOG
* Fix merge conflict resolution error
* Update Span API event methods
Remove the context argument from the event methods. It is unused and can
be added back in as a passed option if needed in the future.
Update AddEvent to accept a required name and a set of options. These
options are the new EventOption type that can be used to configure a
SpanConfig Timestamp and Attributes.
Remove the AddEventWithTimestamp method as it is redundant to calling
AddEvent with a WithTimestamp option.
Update RecordError to also accept the EventOptions.
* Add changes to CHANGELOG
* Add LifeCycleOption
Use the LifeCycleOption to encapsulate the options passed to a span for
life cycle events.
* Update metric Kind to InstrumentKind
* Update all the other modules with Kind rename
* Update metric Descriptor with instrument Kind rename
* Update other modules with Descriptor method rename
* Update OTLP exporter test field name
* Rename kind filenames
* Add changes to CHANGELOG
* Fix documentation for Grouping and PrecomputedSum
* Call sampler on local child spans.
* Update CHANGELOG.md
* Adding a test for calling the sampler on local child spans
* Add clarifying comment to test
* Move trace API to otel
* Move tracetest to oteltest
* Update package documentation
* Remove old api/trace package
* Lint
* Add changes to CHANGELOG
* Add tests for rest of trace API
* Apply suggestions from code review
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Documentation fixes
Includes resolutions for review issues.
* Correct CHANGELOG post release
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Update codes to match specification
* Add changes to changelog
* go mod tidy
* Add unit tests for codes
* Update SetStatus methods to only filter Unset
* Update apitest code being tested
- Test by span attributes added by processors in the order
they were registered.
Signed-off-by: Hui Kang <kangh@us.ibm.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Rename *Provider names
There is overlap in naming with MeterProviders and TracerProviders. This
is means the specification is not implemented and these types can not
exist in the same package (#1179). This makes each type and related
functions and types explicit.
* Add changes to CHANGELOG
It is unreliable with no clear good way to make it reliable. The
ForceFlush() method is a simple passthrough to bsp.exportSpans() and the
existing tests of that method should suffice.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add ForceFlush() method to SpanProcessor interface
* Add a stub implementation to SimpleSpanProcessor
* Add a working implementation to BatchSpanProcessor
* add CHANGELOG.md entry
* Eliminate sleep from BatchSpanProcessor.ForceFlush() test
* Generating test spans serially should reduce test flakiness
* Rename ParentOrElse to ParentBased and enhance it according to the spec
- Renaming of type and sampler function
- Enhancing ParentBased with sampler options
- Set default samplers for each applicable parent-based case
- Adjust ShouldSample(...) func accordingly
* Adjust existing tests for ParentBased and add new ones
- add tests for ParentBased sampler options and description
- renaming in trace_test.go
* Update CHANGELOG.md
* PR feedback
- More clearer naming of structs; add comments where missing
- Adhere to the configuration style guide
* PR feedback - punctuation
* Convert XConfigure into constructors
Previously, we discussed the possibility of converting
the config types into internal ones. But due to the
cyclic dependencies it introduces, we are only
converting XConfigure into constructors and document that
XConfig types are most likely are not going to be directly
used by developers.
In package documents, constructors will be nicely listed
under the config types and they won't be yet another
standalone symbol developers need to learn about.
Fixes#1130.
* Add the changes to the CHANGELOG
* Update trace export interface
Move to conforming to the specification.
* Update documentation in export trace
* Update sdk trace provider to support new trace exporter
* Update SpanProcessors
Support the Provider changes and new trace exporter.
* Update the SDK to support the changes
* Update trace Provider to not return an error
* Update sdk with new Provider return
Also fix the testExporter ExportSpans method
* Update exporters with changes
* Update examples with changes
* Update Changelog
* Move error handling to end of shutdown
* Update exporter interface
Rename to SpanExporter to match specification. Add an error return value
to the Shutdown method based on feedback. Propagate these changes.
Remove the Stop method from the OTLP exporter to avoid confusion and
redundancy.
* Add test to check OTLP Shutdown honors context
* Add Jaeger exporter test for shutdown
* Fix race in Jaeger test
* Unify shutdown behavior and testing
* Update sdk/trace/simple_span_processor.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Unify API Span Start/End Options
Replace both with `SpanOption`. Add a unified `SpanConfig` to match and
a `SpanConfigure` function to parse a `SpanConfig` from `SpanOption`s.
Update all the related options to use new `SpanOption`s.
* No non-zero SpanConfig defaults
The SDK uses an internal clock for the current time that cannot be use
if it does not know the time has not been set.
* Append attributes for WithAttributes
This preserves existing behavior.
* Add unit test for SpanConfigure
* Propagate changes
* Update append option documentation
* Update testing comments
* Move comments on guarantees to appropriate function
* Add documentation for SDK methods
Include SDK implementation specific information in the Tracer Start
method and Span End method.
* Add changes to Changelog
* Apply suggestions from code review
Co-authored-by: ET <evantorrie@users.noreply.github.com>
* Update the SpanKind comment in the SpanConfig
Try for a less tautological comment.
Co-authored-by: ET <evantorrie@users.noreply.github.com>
* Change name of ProbabilitySampler to TraceIdRatioBased
* Modify behavior to ignore parent span
* Add test for inclusivity property on TraceIdRatioBased sampler
* Modify tests in `trace_test.go` to reflect change in parent
span behavior
* Add to CHANGELOG
* Satisfy golint
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update Tracer configuration.
Conform to API option design outlined in #536.
Add tests to validate new TracerConfigure function
Drop the `instrumentation` prefix.
* Stick with instrumentationVersion for now
* Propagate changes
* Add changes to Changelog
* Make metric test helpers public
* Move everything metric test related to api/metric/metrictest
* Unify metric measurement assertions
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Build on newly release version of go, go 1.15
Remove 1.13 build job per policy of supporting past two releases.
* String conversions in 1.15 require byte, rune or string.
Simply passing an integer now issues a warning.
* Move proto to OTLP exporter
* Update OTLP exporter import of proto
* Use gogo protobuf
To stop using the deprecated github.com/golang/protobuf and match what
the collector is doing, switch to generating OTLP with the
github.com/gogo/protobuf/proto instead of
github.com/golang/protobuf/proto.
* Clean dependencies
Remove all protobuf dependencies from otel package and all of its
dependencies.
* Update CHANGELOG
* Clean OTLP exporter go mod
Remove submodule beforehand to avoid unneeded direct dependencies.
* Use default ref for GitHub workflow
* Update path that triggers proto gen action
* Correct license-check exclusion for OTLP
* Update commented location of the OTLP and code
* Add otel/codes package to replace google.golang.org/grpc/codes
* Replace google.golang.org/grpc/codes with otel/codes
* Update opentracing bridge to use OTel codes
* Update semconv to use OTel codes
* Update SDK to convert from OTel codes to gRPC
* go mod tidy
* Add change to CHANGELOG
* Fix word from feedback
* Clean stale indirect dependency requirements
In the recent changes to isolate the main `otel` package there were many
indirect dependencies of the package that were removed, however, the
go.mod was not automatically cleaned of these. This removes those (and
similar ones in the otel-collector example and otel exporter) and prunes
the go.sum files accordingly.
* Run in a clean system to reproduce build
* Make opentracing bridge into own Go module
* Update dependabot config
* Clean dependencies of project
Now the bridge is a module, clean all upstream modules that no longer
implicitly depend on it.
* Update Changelog
* go mod tidy
http.ResponseWriters may implement additional interfaces
(http.CloseNotifier, http.Flusher, http.Hijacker, http.Pusher,
io.ReaderFrom) that get lost when the ResponseWriter is wrapped in
another object. This change uses the httpsnoop package to wrap the
ResponseWriter so that the resulting object implements any of the
optional interfaces that the original ResponseWriter implements as
well as using the replacement ResponseWriter methods that gather
information for tracing.
* Remove otel/sdk dependency from grpctrace
Use otel/trace/testtrace instead and cleanup testing code.
* Update httptrace to not depend on the SDK
Update testing to use api/trace/testtrace instead.
* Add changes to Changelog
* Make the SDK its own Go module
* Upgrade go.mod to 1.14 project wide
* go mod tidy
* Remove SDK from othttp instrumentation
* Remove dependency on SDK in api/kv pkg
Benchmark the kv package not the SDK here.
* Update api/global benchmarks
Move SDK related tests to SDK where applicable
* Add internal testing SDK implementation
To be used by the API for testing so it does not depend on the actual
SDK.
* Update api/global/internal to use internal/sdk
* Fix lint on sdk/metric benchmark
* Lint internal/sdk
* Merge internal/sdk into api/trace/testtrace
* Update Changelog
* Make the stdout exporter its own package
Follow the pattern of the other exporters.
* Update dependabot with stdout exporter
* Add replace directives for stdout exporter
* Remove outdated example test from metric SDK
* go mod tidy
* Update othttp example test
Remove unused stdout exporter.
* Remove tests in API that depend on stdout exporter
The global package does not need to be validated with the SDK. A more
properly constructed end-to-end integration test should be built if this
is actually needed.
* Add replace clause for otel in stdout go.mod
* Consolidate stdout exporter
* Move config to own file and match project standard
* Abstract Exporter into unified struct
* Rename trace part of the exporter
* Update import paths and configuration
* Update tests
* Update InstallNewPipeline to not return traceProvider
It is a registered global, access it that way.
* Update example_test
* Update docs
* Update example to be for whole package
* Update metric output
Closer match the span output.
* Clean up span output
Print as a batch and cleanup marshaling.
* Correct spelling error in doc
* Add Exporters README
* Update Changelog
* Propagate changes to rest of project
* Lint fixes
* Fix example test in metric SDK
* Add disable config options for trace and metric
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
* Avoid applying stale udpates; add a test
* Add Memory option to basic processor
* Always use memory in the pull controller
* Test the memory option
* Precommit
* Add a Prometheus-specific test
* More comment on Memory option
* Link to 862
* Remove sleep
* Update changelog
* Comment on stale and stateless aggregators
* Update sdk/metric/processor/basic/config.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Added support array attributes
* Changed function signature for AsArray attribute
* Fixed code comments for array attributes
* Fixed typos in comments in value.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
fixes#851
This includes all of the associated methods, such as
AsUint64, AsUint64Atomic, AsUint64Ptr, CoerceToUint64, SetUint64
SetUint64Atomic, SwapUint64, SwapUint64Atomic, AddUint64,
AddUint64Atomic, CompamreAndSwapUint64, CompareUint64
Only significant change as a result was converting the histogram
aggregator's `count` state field into an int64 from a `metric.Number`.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Support instrumentation library in metrics
* Update stdout exporter to display instrumentation info
* Fix tests that use the STDOUT exporter
* Refactor to keep SDK out of API
* Update global Meter and test Meter version
* Revert unneeded import syntax change
* Fix Unit comment
* Update comments
* Update comment
* Revert no-op change to import
* Update Tracer API with instrumentation version
Add option to the `Provider.Tracer` method to specify the
instrumentation version.
Update the global, noop, opentracing bridge, and default SDK
implementations.
This does not propagate the instrumentation library version to the
exported span. That is left for a follow-on PR.
* Revert trace_test.go
This is for the next PR.
* Support instrumentation library in SDK trace exports
* Update Jaeger exporter to export instrumentation
* Fix BatchSpanProcessor.Shutdown to wait until all spans are processed
Currently it exits too soon - before drainQueue is finished
* Check bsp.stopCh to reliably drop span when batcher is stopped
* Enable tests
* Always use WithBlocking
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* Update Tracer API with instrumentation version
Add option to the `Provider.Tracer` method to specify the
instrumentation version.
Update the global, noop, opentracing bridge, and default SDK
implementations.
This does not propagate the instrumentation library version to the
exported span. That is left for a follow-on PR.
* Revert trace_test.go
This is for the next PR.
* Update SDK to include version for default instrumentation
If the instrumentation library name is empty and the default
instrumentation is uses, include the SDK version.
* Update comments and documentation
* Remove default instrumentation version
* Name the BSP tests
* Add a drain wait group; use the stop wait group to avoid leaking a goroutine
* Lint & comments
* Fix
* Use defer/recover
* Restore the Add/Done...
* Restore the Add/Done...
* Consolidate select stmts
* Disable the test
* Lint
* Use better recover
Addresses existing TODO in the push `tick` function by added a context
timeout set to a configurable Controller timeout. This ensures that hung
collections or exports do not have runaway resource usage.
Defaults to the length of a collector period.
* Remove the push controller named Meter map
* Checkpoint
* Remove Provider impls
* Add a test
* Expose Provider() getter instead of implementing the interface
* api/metric changes from jmacd:jmacd/batch_obs_2
* Add an SDK test
* Use a single collector method
* Two fixes
* Comments; embed AsyncRunner
* Comments
* Comment fix
* More comments
* Renaming for clarity
* Renaming for clarity (fix)
* Lint
Fixes#657
With the changes in #667 and #669 to use a plain-old-mutex for
concurrent access of Histogram and MinMaxSumCount aggregators,
the StateLocker implementation is no longer used in the project.
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* Reimplement histogram using mutex instead of stateLocker
Move existing implementation to histogram_statelocker.go. Implement
benchmarks for single thread and parallel histogram updates comparing
mutex version to stateLocker version
* Drop statelocker implementation and alignment tests, benchmarks
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* Switch MinMaxSumCount to a mutex lock instead of StateLocker
With multiple values being modified for each Update(), a single mutex
lock and non-atomic operations ends up being faster than making each
value update into an atomic operation.
* Remove StateLocker implementation and comparison benchmarks
* Remove field offset tests. No longer required with no atomics.
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* New label set API
* Checkpoint
* Remove label.Labels interface
* Fix trace
* Remove label storage
* Restore metric_test.go
* Tidy tests
* More comments
* More comments
* Same changes as 654
* Checkpoint
* Fix batch labels
* Avoid Resource.Attributes() where possible
* Update comments and restore order in resource.go
* From feedback
* From feedback
* Move iterator_test & feedback
* Strenghten the label.Set test
* Feedback on typos
* Fix the set test per @krnowak
* Nit
* Point to the convenience functions in api/key package
This is to increase the visibility of the api/key package through the
api/core package, otherwise developers often tend to miss the api/key
package altogether and write `core.Key(name).TYPE(value)` and complain
at the verbosity of such a construction. The api/key package would
allow them to write `key.TYPE(name, value)`.
* Use the api/key package where applicable
This transforms all the uses of `core.Key(name).TYPE(value)` to
`key.TYPE(name, value)`. This also should help increasing the
visibility of the api/key package for developers reading the otel-go
code.
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* TraceID and SpanID implementations for Stringer Interface
* Hex encode while stringifying
* Modify format specifiers wherever SpanID is used
* comment changes
* Remove TraceIdString() and SpanIdString()
* Comments Fixes
* Update Resource
When looking at grouping telemetry in an exporter based on the Resource
it is ideal if a map can be make with the key being represented by a
Resource. However, given the Resource is not hashable, this is not
possible.
This add a `String` method that can be used as a map key during
grouping. Additionally, this means the Resource now implements the
`Stringer` interface providing human-readable info when prited.
The internal structure of the Resource is changed. A static slice
containing all key-values in a sorted order replaces the existing map.
Additionally a set of keys is added to accommodate lookup during
`Merge`. Also, the string representation is kept in an internal field so
as to save processing for the `String` method (all fields are assumed to
be static after creation).
The `Attributes` method now returns a sorted slice of the associated
key-values.
The `Merge` method has been updated to support the changed structure of
the Resource.
New tests are added to validate the `String` method.
* Update comment
* Change loop into returned append
* Update key-value less func
Keys are unique in this package, treat them that way.
* Remove unnecessary allocation on empty attributes
* Update `Merge` method
Remove incomplete sorting of merged slices. Instead use the `sort`
package.
Add tests to catch sorting failure identified.
* Apply suggestions from code review
Co-Authored-By: ET <evantorrie@users.noreply.github.com>
* Escape Resource string representation
To ensure uniqueness of the string representation, the key-value content
needs to be escaped.
* Switch to an eager evaluation for the `String` method
* Refactor `Merge` method
Leave optimization to the future and simplify the merge.
* Add AttributeIterator
Include a method for a user of the Resource to iterate over the related
attributes without needed to copy the attributes.
* Fix ineffectual
* Fix lint
* Add licenses
* keys -> keySet for Resource
Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Rahul Patel <rahulpa@google.com>
This PR adds histogram support to the prometheus exporter.
- Adds a new aggregator selector that returns a histogram for `MeasureKind`.
The selector can be constructed using `simple.NewWithHistogramMeasure`
- Adds support for histogram aggregators in prometheus collect method.
With this PR, the default selector is changed to use histograms.
In order to support the prometheus histogram, the `aggregator.Histogram`
interface is extended with the `Sum` method.
fixes#487
Co-authored-by: Rahul Patel <rahulpa@google.com>
* Remove LabelSet frmo api/metric
* SDK tests pass
* Restore benchmarks
* All tests pass
* Remove all mentions of LabelSet
* Test RecordBatch
* Batch test
* Improves benchmark (some)
* Move the benchmark to match HEAD
* Align labels for GOARCH=386
* Add alignment test
* Disable the stress test fo GOARCH=386
* Fix bug
* Move atomic fields into their own file
* Add a TODO
* Comments
* Remove metric.Labels(...)
* FTB
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Update license header to standard format for source files missed prior.
Add license header to new source files.
Add Makefile check to test all `*.go` and `*.sh` files have a copyright
notice (or comment about them being auto-generated) within the first few
lines.
* Add skeleton uniqueness checker
* Fix the build w/ new code in place
* Add sync tests
* More test
* Implement global uniqueness checking
* Set the library name
* Ensure ordered global initialization
* Use proper require statement for errors
* Comment
* Apply feedback fixes
* Comment and rename from feedback
* Temporarily opt-out export.Labels from label encoding stuff
* Stop passing label encoding stuff to export.Labels
* Drop label encoding stuff from SDK
* Dogstatd exporter does not need to implement label exporter anymore
* more dogstatd exporter fixes
* export labels get back to encoding stuff
in a lame way, but improvements are coming in following commits
* Get encoded labels through export.Labels
* make SDK to provide its own implementation of export.Labels
* drop dead code
* add noop label exporter
* make export simple labels immutable
* Move the default label encoder to export package
* Simplify the simple export labels a bit
* Reserve some label exporter IDs
* Document and shuffle the code a bit
* Prepare for bring the iterator benchmark test back
We can install a callback to the Batcher's process function - this is
the place where we can access the labels, and thus test the label
iterator.
* Bring back the iterator benchmarks
* Simplifications and docs
* Fix copyright to be consistent with the rest
* Fix typo
* Put reserved label encoder IDs into constants
We get fewer comments about magic numbers that way.
* Fix the label encoder as label exporter thinko
* Update License header for all source files
- Add Apache 2.0 header to source files that did not have one.
- Update all existing headers dated to 2019 to be 2020
- Remove comma from License header to comply with the Apache 2.0
guidelines.
* Update Copyright notice
Use the standard Copyright notices outlined by the
[CNCF](https://github.com/cncf/foundation/blob/master/copyright-notices.md#copyright-notices)
The `checkpoint` function is executed in a single thread so we can do
the encoding lazily before passing the encoded version of labels to
the exporter. This is a cheap and quick way to avoid encoding the
labels on every collection interval.
Co-authored-by: Rahul Patel <rahulpa@google.com>
* Add support for Resources in the SDK
Add `Config` types for the push `Controller` and the `SDK`. Included
with this are helper functions to configure the `ErrorHandler` and
`Resource`.
Add a `Resource` to the Meter `Descriptor`. The choice to add the
`Resource` here (instead of say a `Record` or the `Instrument` itself)
was motivated by the definition of the `Descriptor` as the way to
uniquely describe a metric instrument.
Update the push `Controller` and default `SDK` to pass down their configured
`Resource` from instantiation to the metric instruments.
* Update New SDK constructor documentation
* Change NewDescriptor constructor to take opts
Add DescriptorConfig and DescriptorOption to configure the metric
Descriptor with the description, unit, keys, and resource.
Update all function calls to NewDescriptor to use new function
signature.
* Apply suggestions from code review
Co-Authored-By: Rahul Patel <rghetia@yahoo.com>
* Update and add copyright notices
* Update push controller creator func
Pass the configured ErrorHandler for the controller to the SDK.
* Update Resource integration with the SDK
Add back the Resource field to the Descriptor that was moved in the
last merge with master.
Add a resource.Provider interface.
Have the default SDK implement the new resource.Provider interface and
integrate the new interface into the newSync/newAsync workflows. Now, if
the SDK has a Resource defined it will be passed to all Descriptors
created for the instruments it creates.
* Remove nil check for metric SDK config
* Fix and add test for API Options
Add an `Equal` method to the Resource so it can be compared with
github.com/google/go-cmp/cmp.
Add additional test of the API Option unit tests to ensure WithResource
correctly sets a new resource.
* Move the resource.Provider interface to the API package
Move the interface to where it is used.
Fix spelling.
* Remove errant line
* Remove nil checks for the push controller config
* Fix check SDK implements Resourcer
* Apply suggestions from code review
Co-Authored-By: Rahul Patel <rghetia@yahoo.com>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
* Do not expose a slice of labels in export.Record
This is really an inconvenient implementation detail leak - we may
want to store labels in a different way. Replace it with an iterator -
it does not force us to use slice of key values as a storage in the
long run.
* Add Len to LabelIterator
It may come in handy in several situations, where we don't have access
to export.Labels object, but only to the label iterator.
* Use reflect value label iterator for the fixed labels
* add reset operation to iterator
Makes my life easier when writing a benchmark. Might also be an
alternative to cloning the iterator.
* Add benchmarks for iterators
* Add import comment
* Add clone operation to label iterator
* Move iterator tests to a separate package
* Add tests for cloning iterators
* Pass label iterator to export labels
* Use non-addressable array reflect values
By not using the value created by `reflect.New()`, but rather by
`reflect.ValueOf()`, we get a non-addressable array in the value,
which does not infer an allocation cost when getting an element from
the array.
* Drop zero iterator
This can be substituted by a reflect value iterator that goes over a
value with a zero-sized array.
* Add a simple iterator that implements label iterator
In the long run this will completely replace the LabelIterator
interface.
* Replace reflect value iterator with simple iterator
* Pass label storage to new export labels, not label iterator
* Drop label iterator interface, rename storage iterator to label iterator
* Drop clone operation from iterator
It's a leftover from interface times and now it's pointless - the
iterator is a simple struct, so cloning it is a simple copy.
* Drop Reset from label iterator
The sole existence of Reset was actually for benchmarking convenience.
Now we can just copy the iterator cheaply, so a need for Reset is no
more.
* Drop noop iterator tests
* Move back iterator tests to export package
* Eagerly get the reflect value of ordered labels
So we won't get into problems when several goroutines want to iterate
the same labels at the same time. Not sure if this would be a big
deal, since every goroutine would compute the same reflect.Value, but
concurrent write to the same memory is bad anyway. And it doesn't cost
us any extra allocations anyway.
* Replace NewSliceLabelIterator() with a method of LabelSlice
* Add some documentation
* Documentation fixes
* Create MeterImpl interface
* Checkpoint w/ sdk.go building
* Checkpoint working on global
* api/global builds (test fails)
* Test fix
* All tests pass
* Comments
* Add two tests
* Comments and uncomment tests
* Precommit part 1
* Still working on tests
* Lint
* Add a test and a TODO
* Cleanup
* Lint
* Interface()->Implementation()
* Apply some feedback
* From feedback
* (A)Synchronous -> (A)Sync
* Add a missing comment
* Apply suggestions from code review
Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>
* Rename a variable
Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
* update always and never sample descriptions
* fix typo
* rename always on / off sampler files, structs and variables to match
Co-authored-by: Rahul Patel <rahulpa@google.com>
Update copyright date to when file was created (2020)
Create random numbers between 0 and 100 to more evenly match the
buckets defined in the histogram test (25, 50, 75)
* Add zipkin exporter
The zipkin exporter implements the SpanBatcher interface. It follows
the current-at-the-time-of-writing document about conversion from
OpenTelemetry span data to Zipkin spans. Which means that endpoint
information is not yet filled.
* Fix typo in docs
* Add a zipkin example
This sends span information to a locally running zipkin collector.
Currently I have a problem getting the collector to show me the spans
after accepting them with HTTP 202. Not sure if this is because of
missing endpoint information.
* Make gitignore consistent
The fixed paths should be prefixed with a slash. The "relative" paths
mean that git will ignore all the files that end with the path.
* Add tests for zipkin exporter
* Update api for Must constructors, with SDK helpers
* Update for Must constructors, leaving TODOs about global errors
* Add tests
* Move Must methods into metric.Must
* Apply the feedback
* Remove interfaces
* Remove more interfaces
* Again...
* Remove a sentence about a dead inteface
* change the histogram aggregator to have a consistent but blocking Checkpoint()
* docs
* wrapping docs
* remove currentIdx from the 8bit alignment check
* stress test
* add export and move lockfreewrite algorithm to an external struct.
* move state locker to another package.
* add todos
* minimal tests
* renaming and docs
* change to context.Background()
* add link to algorithm and grammars
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* Use an array key to label encoding in the SDK
* Comment
* Precommit
* Comment
* Comment
* Feedback from krnowak
* Do not overwrite the Key
* Add the value test requested
* Add a comment
* drop gauge instrument
* Restore the benchmark and stress test for lastvalue aggregator, but remove monotonic last-value support
* Rename gauge->lastvalue and remove remaining uses of the word 'gauge'
Co-authored-by: Krzesimir Nowak <krzesimir@kinvolk.io>
* Refactor SDK Sampler API to conform to Spec
* Sampler is now an interface rather than a function type
* SamplingParameters include the span Kind, Attributes, and Links
* SamplingResult includes a SamplingDecision with three possible values, as well as Attributes
* Add attributes retruned from a Sampler to the span
* Add SpanKind, Attributes, and Links to API Sampler.ShouldSample() parameters
* Drop "Get" from sdk Sampler.GetDescription to match api Sampler
* Make spanID parameter in API Sampler interface a core.SpanID
* Fix types and printf format per PR feedback from krnowak
* Ensure unit test error messages reflect new reality
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* wip: observers
* wip: float observers
* fix copy pasta
* wip: rework observers in sdk
* small fix in global meter
* wip: aggregators and selectors
* wip: monotonicity option for observers
* some refactor
* wip: docs
needs more package docs (especially for api/metric and sdk/metric)
* fix ci
* Fix copy-pasta in docs
Co-Authored-By: Mauricio Vásquez <mauricio@kinvolk.io>
* recycle unused recorders in observers
if a recorder for a labelset is unused for a second collection cycle
in a row, drop it
* unregister
* thread-safe set callback
* Fix docs
* Revert "wip: aggregators and selectors"
This reverts commit 37b7d05aed5dc90f6d5593325b6eb77494e21736.
* update selector
* tests
* Rework number equality
Compare concrete numbers, so we can get actual numbers in the error
message when they are not equal, not some uint64 representation. This
also uses InDelta for comparing floats.
* Ensure that Observers are registered in the same order
* Run observers in fixed order
So the tests can be reproducible - iterating a map made the order of
measurements random.
* Ensure the proper alignment of the delegates
This wasn't checked at all. After adding the checks, the test-386
failed.
* Small tweaks to the global meter test
* Ensure proper alignment of the callback pointer
test-386 was complaining about it
* update docs
* update a TODO
* address review issues
* drop SetCallback
Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
The `go.opentelemetry.io/otel/exporter/trace/jaeger` package was
mistakenly released with a `v1.0.0` tag instead of `v0.1.0`. This
resulted in all subsequent releases not becoming the default latest,
meaning that `go get`s pulled in the incompatible `v0.1.0` release of
that package when pulling in more recent packages from other otel
packages. Renaming the `exporter` directory to `exporters` fixes this
issue by consequentially renaming the package.
Additionally, this action also renames *all* exporters. This is
understood to be a disruptive action to existing users as they will need
to update any dependencies they currently have on our exporters.
However, it was decided to take this action regardless. The need to
resolve the existing issue explained above is highly important, and
given the Alpha state of this project these kinds of breaking changes
should be expected (though not without reason).
Resolves#331
Co-authored-by: Rahul Patel <rghetia@yahoo.com>
* Add `Span#Error` method to simplify setting an error status and message.
* `Span#Error` should no-op on nil errors
* Record errors as a span event rather than status/attributes.
The implementation in the SDK package now relies on existing API methods.
* Add WithErrorStatus() ErrorOption to allow setting span status on error.
* Apply suggestions from code review
Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>
* Address code review feedback
* Clean up RecordError tests
* Ensure complete and unique error type is recorded for defined types
* Avoid duplicating logic under test in tests
* Move TestError to internal/testing package, improve RecordError test scenarios
Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
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.
* 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>
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>
* 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 🙈
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`.
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.
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.
- 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.
* 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>
* 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
* 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>
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
* Make span start/end configuration more greppable
Rename SpanOption to StartOption
Rename StartOptions to StartConfig
Rename EndOptions to EndConfig
fixes#197
* Add Min() interface - rename MaxSumCount to MinMaxSumCount
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/319
* update stdout exporter to collect and output the minimum value
* update min and max atomically in Aggregator Update
* changed all references to maxsumcount to minmaxsumcount
* Address PR comments
* Remove AddLink & Link from Span Interface
I have remove AddLink and Link from the interface and all it refereneces and replaced AddLink with addlink, Also Removed respective unit tests
Signed-off-by: vineeth <vineethpothulapati@outlook.com>
* removing the unused code from unit tests
Signed-off-by: VineethReddy02 <vineethpothulapati@outlook.com>
* Prom exporter structure
* update prometheus exporter with master and add example.
* remove distributedcontext from prometheus example
* docs and interface checker
* make precommit
* make precommit & remove "OnRegisterError"
* coerce values to float
* return register errors and maybe fix precommit?
* add option to specify a prometheus.Registry
* make exporter implement http.Handler interface
* fix map keys bugs
* remove unused const
* fix modules dependencies.
* add support for histogram
* get metrics with labels values only instead of a labels map
* make exporter implements label encoder interface
* encode labels if the encoder is different.
* split metrics on several files and encapsulate them in structs
* make pre commit
* unexport 'sanitize'
* remove 'AllValues' in favor of 'Points' and change to 'NewDefaultLabelEncoder'
* add prometheus tests
* remove newlines on struct declaration
* formatting
* rewording
* imports
* add todo on labelValues
* blame myself for todo (:
* add todos on sanitize
* add support for summaries. custom remove label encoder.
* imports
* imports
* update with upstream
* Add tests for nonabsolute and varying sign values
* Implement support for NonAbsolute Measurement MaxSumCount
Previously, the MaxSumCount aggregator failed to work correctly with
negative numbers (e.g. MeasureKind Alternate()==true).
* Pass NumberKind to MaxSumCount New() function
Allows it to set the initial state (current.max) to the correct value
based on the NumberKind.
* Revert extraneous local change
* Pass full descriptor to msc New()
This is analagous to the DDSketch New() constructor
* Remember to run make precommit first
* Add tests for empty checkpoint of MaxSumCount aggregator
An empty checkpoint should have Sum() == 0, Count() == 0 and Max()
still equal to the numberKind.Minimum()
* Return ErrEmptyDataSet if no value set by the aggregator
Remove TODO from stdout exporter to ensure that if a maxsumcount or
ddsketch aggregator returns ErrEmptyDataSet from Max(), then the
entire record will be skipped by the exporter.
Added tests to ensure the exporter doesn't send any updates for
EmptyDataSet checkpoints - for both ddsketch and maxsumcount.
* Relayout Aggreggator struct to ensure int64s are 8-byte aligned
On 32-bit architectures, Go only guarantees that primitive
values are aligned to a 4 byte boundary. Atomic operations on 32-bit
machines require 8-byte alignment.
See https://github.com/golang/go/issues/599
* Addressing PR comments
The use of Minimum() for the default uninitialized Maximum value means
that in the unlikely condition that every recorded value for a measure
is equal to the same NumberKind.Minimum(), then the aggregator's Max()
will return ErrEmptyDataSet
* Fix PR merge issue
* Add MetricAggregator.Merge() implementations
* Update from feedback
* Type
* Ckpt
* Ckpt
* Add push controller
* Ckpt
* Add aggregator interfaces, stdout encoder
* Modify basic main.go
* Main is working
* Batch stdout output
* Sum udpate
* Rename stdout
* Add stateless/stateful Batcher options
* Undo a for-loop in the example, remove a done TODO
* Update imports
* Add note
* Rename defaultkeys
* Support variable label encoder to speed OpenMetrics/Statsd export
* Lint
* Checkpoint
* Checkpoint
* Doc
* Precommit/lint
* Simplify Aggregator API
* Record->Identifier
* Remove export.Record a.k.a. Identifier
* Checkpoint
* Propagate errors to the SDK, remove a bunch of 'TODO warn'
* Checkpoint
* Introduce export.Labels
* Comments in export/metric.go
* Comment
* More merge
* More doc
* Complete example
* Lint fixes
* Add a testable example
* Lint
* Dogstats
* Let Export return an error
* Checkpoint
* add a basic stdout exporter test
* Add measure test; fix aggregator APIs
* Use JSON numbers, not strings
* Test stdout exporter error
* Add a test for the call to RangeTest
* Add error handler API to improve correctness test; return errors from RecordOne
* Undo the previous -- do not expose errors
* Add simple selector variations, test
* Repair examples
* Test push controller error handling
* Add SDK label encoder tests
* Add a defaultkeys batcher test
* Add an ungrouped batcher test
* Lint new tests
* Respond to krnowak's feedback
* Checkpoint
* Funciontal example using unixgram
* Tidy the example
* Add a packet-split test
* More tests
* Undo comment
* Use concrete receivers for export records and labels, since the constructors return structs not pointers
* Bug fix for stateful batchers; clone an aggregator for long term storage
* Remove TODO addressed in #318
* Add errors to all aggregator interfaces
* Handle ErrNoLastValue case in stdout exporter
* Move aggregator API into sdk/export/metric/aggregator
* Update all aggregator exported-method comments
* Document the aggregator APIs
* More aggregator comments
* Add multiple updates to the ungrouped test
* Fixes for feedback from Gustavo and Liz
* Producer->CheckpointSet; add FinishedCollection
* Process takes an export.Record
* ReadCheckpoint->CheckpointSet
* EncodeLabels->Encode
* Format a better inconsistent type error; add more aggregator API tests
* More RangeTest test coverage
* Make benbjohnson/clock a test-only dependency
* Handle ErrNoLastValue in stress_test
* Update comments; use a pipe vs a unix socket in the example test
* Update test
* Spelling
* Typo fix
* Rename DefaultLabelEncoder to NewDefaultLabelEncoder for clarity
* Rename DefaultLabelEncoder to NewDefaultLabelEncoder for clarity
* Test different adapters; add ForceEncode to statsd label encoder
* copy of simplelru for attributes without excessive usage of interface{}
This also make sure we only add attributes/links if isRecording.
Move method to export the attributes list to attributeMap.
* run make precommit to update mod files.
* Add MetricAggregator.Merge() implementations
* Update from feedback
* Type
* Ckpt
* Ckpt
* Add push controller
* Ckpt
* Add aggregator interfaces, stdout encoder
* Modify basic main.go
* Main is working
* Batch stdout output
* Sum udpate
* Rename stdout
* Add stateless/stateful Batcher options
* Undo a for-loop in the example, remove a done TODO
* Update imports
* Add note
* Rename defaultkeys
* Support variable label encoder to speed OpenMetrics/Statsd export
* Lint
* Doc
* Precommit/lint
* Simplify Aggregator API
* Record->Identifier
* Remove export.Record a.k.a. Identifier
* Checkpoint
* Propagate errors to the SDK, remove a bunch of 'TODO warn'
* Checkpoint
* Introduce export.Labels
* Comments in export/metric.go
* Comment
* More merge
* More doc
* Complete example
* Lint fixes
* Add a testable example
* Lint
* Let Export return an error
* add a basic stdout exporter test
* Add measure test; fix aggregator APIs
* Use JSON numbers, not strings
* Test stdout exporter error
* Add a test for the call to RangeTest
* Add error handler API to improve correctness test; return errors from RecordOne
* Undo the previous -- do not expose errors
* Add simple selector variations, test
* Repair examples
* Test push controller error handling
* Add SDK label encoder tests
* Add a defaultkeys batcher test
* Add an ungrouped batcher test
* Lint new tests
* Respond to krnowak's feedback
* Undo comment
* Use concrete receivers for export records and labels, since the constructors return structs not pointers
* Bug fix for stateful batchers; clone an aggregator for long term storage
* Remove TODO addressed in #318
* Add errors to all aggregator interfaces
* Handle ErrNoLastValue case in stdout exporter
* Move aggregator API into sdk/export/metric/aggregator
* Update all aggregator exported-method comments
* Document the aggregator APIs
* More aggregator comments
* Add multiple updates to the ungrouped test
* Fixes for feedback from Gustavo and Liz
* Producer->CheckpointSet; add FinishedCollection
* Process takes an export.Record
* ReadCheckpoint->CheckpointSet
* EncodeLabels->Encode
* Format a better inconsistent type error; add more aggregator API tests
* More RangeTest test coverage
* Make benbjohnson/clock a test-only dependency
* Handle ErrNoLastValue in stress_test
* clean dead code from noop tracer
* rename arguments from the Tracer interface's methods
* remove service, resources and component options from sdk/tracer and mock tracer
* remove unused fields from sdk/tracer
* Array aggregator part 1
* Improve median testing
* More testing
* More testing
* Update other dist tests
* Add to the benchmark
* Move errors into aggregator package, use from ddsketch; update Max/Min/Quantile to return errors for array/ddsketch/maxsumcount
* Lint
* Test non-absolute ddsketch
* Lint
* Comment
* Add note
* fix comments and add jaeger tests
* add more jaeger tests
* remove TODOs and add more jaeger tests
* remove TODOs and add more jaeger tests
* fix jaeger tests
* add jaeger agent tests
* fix merge conflicts and fix test
* fix test name
* shrink the value type
went down from 40 bytes to 24
* add missing license blurb
* stringify value type
* print string value types in stdout exporter
* make Value function take a pointer receiver
* add WithSpanKind option to span creation
* change SpanKind to string alias and add support for SpanKind on ot bridge
* fix tests
* fix import order
* fix nits
* api(trace): change trace id to byte array.
* fix lint errors
* add helper to create trace id from hex and improve stdout exporter.
* remove comma.
* fix lint
* change TraceIDFromHex to be compliant with w3 trace-context
* revert remove of hex16 regex because its used to parse SpanID
* lint
* fix typo
* Provide conformance tests for tracers
The test harness may be used to ensure that a given tracer behaves
according to the expectations set by the API.
* Add `ToMatchError` matcher
* Use DeepEqual to compare unknown types in matchers
Unlike basic `==`/`!=`, `reflect.DeepEqual` can compare arbitrary
types (e.g., `[]string` to `[]string`)
* Use struct instead of string for test context key
* Add golint to linters and resolve issues.
I decided to remove constructors for some of the propagation types
because the constructors can be reduced to either using the zero value
or a single, non optional member.
* Enable gofmt and commit fixes
Since these methods are about the span itself rather than specifically
*events* on the span, it makes sense to drop "events" from their names.
[Closes#33]
* setup sdk exporter package
* use sdk exporter package in sdk trace
* use sdk exporter package in all exporters
* empty the exporters list before testing Load
* move SpanData to the exporter package
* use the SpanProcessor registration, don't register exporters
* rename exporter structs to avoid stutter
* rename Syncer and Batcher to SpanSyncer and SpanBatcher
So it's explicit they are for spans, and we reduce the risk of name
conflict
* remove not moot todo
* rename sdk exporter to export
* only execute the SpanData if it is sampled
* add batch span processor.
* add blocking support.
* use With* function for options.
- also changed how Shutdown is handled.
* block Shutdown until queue is flushed.
* fix comment.
* rename finish -> end
* missed a few finish -> end spots
* change end back to finish for the bridge span in the openTracing bridge
* fixed grammar, ran make
* Allow specifying custom timestamps for events
Adding event with timestamp is not yet a part of the OpenTelemetry
specification, but this function will come in handy when implementing
the OpenTracing bridge.
* Add opentracing bridge, wrapper tracer and migration interfaces
There are some features missing - setting up links and span kind;
context propagation will only work between two OpenTracing bridges.
* Add some tests for the opentracing bridge
The tests mostly check various aspects of the cooperation between
OpenTracing and OpenTelemetry APIs.
* add propagation api.
* add http propagator interface and w3c propagator implementation.
* remove Extract api from trace.
* remove Extract interface for tracer.
* fix copyright.
* fix variable names and comments.
* move inject/extract out of trace.
* replace INVALID_SPAN_CONTEXT with EmptySpanContext function.
* fix tag.Map.
* make carrier as interface instead of http.Request.
* rename structs and update doc comments..
* add doc.go
* update doc.
* add noop propagator.
* add new propagation api with Supplier interface.
- added Default Tracer which simply propagates SpanContext.
- added CopyOfRemote option to simply create remote span.
* remove old propagator.
* rename propagator to TextFormatPropagator.
* rename default tracer/span as pass_through tracer/span.
* add test for pass through tracer.
* add missing interface to pass through tracer.
* return SpanContext instead of contex.Context from Extract interface.
- also remove PassThroughTracer
* fix review comments.
* add more test cases for traceContext extraction.
* remove tidy temporarily from circle-ci target to avoid build failure.
* allow header ending in dash '-'.
* add inject test for non-zero value other than 01 for traceoption
* add AddLink and Link interface to MockSpan
* fix running go mod tidy on every build.
This is to shrink the PR #100.
The only place where the registry.Variable type was used was metrics,
so just inline that type into its only user. The use of the
registry.Variable type in core.Key was limited to the Name field.
The stats package also used the registry.Variable type, but seems that
also only the Name field was used and the package is going to be
dropped anyway.
* Merge two event methods in span API
There was an agreement to get rid of the Event interface and
consolidate the two methods for adding events into one. See #57.
* Eliminate the use of the Event interface
There is no need for the SDK to provide the implementation of the
Event interface - it is used nowhere.
* Drop the Event interface
It's dead code now.
* Make it possible to override a finish timestamp through options
Opentracing to opentelemetry bridge will certainly use this feature.
* Obey the start time option
* Add tests for events and custom start/end times
This is to make tag.Map an immutable type, so it is safe to use
concurrently. The safety is not yet fully achieved because of the
functions returning contents of the map (Value and Foreach). The
functions give callers an access to core.Value objects, which contain
a byte slice, which has pointer like semantics. So to avoid accidental
changes, we will need to copy the value if it is of BYTES type.
Fixes#59
* trace sdk initial commit.
* fix imports and comments.
* remove tracestate
* split trace.go
* add attribute over limit test.
* add comments and restructure span.go and tracer.go
* refactor MessageEvent
* defer unlock
* some more cleanup in span.go
* rename *MessageEvent* to *Event*
* cleanup comments in trace_test.go
* fix typos.
* return full string ID for traceID and spanID.
* Move scope.Active to trace.CurrentSpan
* Remove scope / does not build
* Global tracer
* Checkpoint
* Checkpoint
* Add key/key.go for key.New
* Comments
* Remove more EventID and ScopeID
* Use Handle to describe static objects
* TODOs
* Remove empty file
* Remove singletons
* Update TODOs
* TODO about map update
* Make stats package option aliases (like key has)
* Rename experimental/streaming
* streaming SDK builds w/ many TODOs
* Get the examples building
* Tidy up metric API / add interface check
* Remove logic from the registry; this is now a placeholder
* fix compile errors.
* fix lint errors.
* add circle-ci job.
* rename IDHigh to TraceIDHigh
* rename the file.
* add go get for goimports and golangci-lint
* enable GO111MODULE and remove comments.
* remove working dir and update cache name
* Add TEST_RESULT env back.
* run go mod tidy.
* remove go mod download.
* add test coverage.
* fix TraceID.
* fix circlefi config error.
* remove install-tools.
* remove ALL_TEST_SRC from Makefile.