* Add semantic convention generator
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update semantic conventions from generator
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Use existing internal/tools module
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fix lint issues, more initialisms
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update changelog
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* semconvgen: Faas->FaaS
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fix a few more key names with replacements
* Update replacements from PR feedback
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* rename commonInitialisms to capitalizations, move some capitalizations there
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Regenerate semantic conventions with updated capitalizations and replacements
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Generate semantic conventions from spec v1.3.0
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Cleanup semconv generator util a bit
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* No need to put internal tooling additions in the CHANGELOG
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fix HTTP semconv tests
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add semconv generation notes to RELEASING.md
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Remove the Tracer method from the Span API
* Update CHANGELOG with changes
* Update CHANGELOG.md
* Fix misspell
* Address feedback
* Implement global default non-recording span
* Add changes to CHANGELOG
* Update PR number in changelog
* Store Span instead of local/remote SpanContext in Context
Now that the SpanContext has a remote identifier, storing a Span's
SpanContext two separate ways in a Context (one for local another for
remote) is unnecessary and adds complication throughout the project when
determining heredity of a Span. This moves to storing the Span directly
in the Context uniformly (for both local and remote) as current Span. In
the process, it updates the getter/setter functionality the `trace`
package provides and replaces the distributed heredity logic throughout
the project with just using the current Span as the parent if it exists.
* Update trace/context.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Assert propagators context remote state
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Remove links on NewRoot spans
To ensure forwards compatibility, remove the unspecified links currently
set on `NewRoot` spans.
Resolves#461
* Remove links from oteltest tracer to match
* Add test to prove the Tracer is safe for concurrent calls
* Fix NotToPanic of harness never call the input func
* Fix tests
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add a tool to auto-generate replace directives
* Auto-generated changes from previous commit
* Create new modules required for trace release
* otel/metric
* otel/trace
* otel/oteltest
* otel/sdk/export/metric
* otel/sdk/metric
Relates to #1467
* Move metric-related public API out of otel/ pkg
Move GetMeterProvider, Meter and SetMeterProvider to new package
otel/metric/global in the otel/metric module.
This will allow otel/ module to be released as v1.0.
* Include PR references in CHANGELOG
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Check for root dir
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Rework proto generation
The changes here are:
- Fix the default goal (using "default" target is not doing it).
- Bail out with a useful message if proto submodule is not checked
out.
- Replace the use of docker image with downloading the protoc binary
and building the gogofast plugin ourselves. This gives us a greater
control over the invocation of protoc.
- Use rsync to copy the generated code, instead of pax. Pax did not
work for me (it was complaining about the unknown -0 flag).
The control over the protoc invocation will be useful later, when we
will want to generate a code with data structures in one place and the
collector code elsewhere. The collector code may or may not depend on
gRPC, but data structures have no need for it. This split will happen
when we move the gRPC code out of the OTLP exporter module into a
submodule.
Getting rid of docker has the upside that the generated files do not
belong to root, so there is no hassle of changing the ownership of the
files, and it is not requires to use sudo for the `clean` target. And
not using docker is faster.
The downside of this work is that it depends on more tools: rsync,
unzip and wget. I can only hope that macOS users have those tools too,
and that those tools are invoked the same.
* Update protogen workflow
* Move global code to toplevel package
* Move version function to toplevel package
* Update changelog
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
* 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>
* Move api/baggage to the propagators package
* Create Baggage API to match specification
* Update CHANGELOG.md
* Baggage API unit tests
* Rename and add unit test
* Update unit test value checking
* Update TODO with issue tracking work.
* 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
* Unexport NoopXXX trace types
The change unexports the noop implementations and provide the NoopProvider function for user to construct noop providers. Users can access noop tracer and noop spans by using the provider.
This change removes the types users should never be directly using from the package. It improves the usability of the API by reducing the API surface to half and helping the user to focus on the canonical APIs.
Fixes#1133
* Provide noop tracer and span for internal use
* Remove obsolete doc
* Use noop span instead of nil
* Fix the broken build
* Make trace testhelpers public
Move MockSpan and MockTracer out of internal package into the api/trace
directory.
* Do not move internal/trace/parent into testing dir
Leave internal/trace/parent/parent.go in the internal directory.
* Fix MockTracer Start method comments
Fix "TraceID".
* Run make precommit to cleanup go.mod
Cleanum go.mod and go.sum.
* Fix tracetest MockSpan structure alignment
Make MockSpan 80 bytes instead of 88 by fixing its alignment.
* Revert bridge/opentracing/internal/mock.go imports
Do not change imports lines in bridge/opentracing/internal/mock.go.
* 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>
* 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
* Adjust Jaeger and Zipkin exporters helper methods
* Update and add tests, examples, various minor improvements
* Update changelog
* Correct the Zipkin example
- wait for the spans to be exported
- rebuild the example
* Zipkin service name as argument
* Rework Jaeger and Zipkin tests
* Include more detailed Changelog
Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Import open-telemetry/opentelemetry-proto submodule under internal
* Commit changes in updated/new protobuf files
* Refer to new location of .pb.go files after rewrite from import
* Describe in CHANGELOG
* 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
* 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>
* 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
* 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)
* 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 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
* 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>
* 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>
* 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>
When during determining a parent for a new span, we find out that
there is a current span in the context, we are putting a remote span
context into links as an ignored on demand. A problem with this
approach is that the remote span context will end up in links of every
descendant span. Another problem is that jaeger exporter currently
treats all links as span contexts with a "child of" relationship and
that likely confuses the jaeger visualization.
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.
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>
* 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
* Add inspectable test tracer
This adds a test Tracer implementation that tracks its active and ended
spans and uses a Span implementation that can be inspected (e.g., to see
what attributes have been set).
* Ensure test tracer can start spans concurrently
* Flip conditional logic to return early
* Remove duplicate test
* Fix file name casing
🤦
* Add comments to testtrace code
* Remove Link and AddLink methods from test Span
* Enable concurrently setting and getting test attrs
* Remove SetAttribute from test tracer
* Fix test
* Fix names post-rebase
* Make span start/end configuration more greppable
Rename SpanOption to StartOption
Rename StartOptions to StartConfig
Rename EndOptions to EndConfig
fixes#197
* 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>
* 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
* 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]
* 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.