* Add semantic conventions for Resource and Trace attributes
* Add SCHEMA_URL pointing to the scheme used for code generation
* Fix setting of SERVICE_NAME in default Resource instance
* Add information about semantic conventions to README.md
* span converter rework
- combine otlp's grpc and http span converters into one
- adjust UsesSpanConverterTrait to always deal with arrays of spans, since span processors only accept arrays
Still to do:
- combine duplicated grpc/http span converter tests
* tidy
* make internal otlp span converted methods private
* WIP
* Return Opts object so chain config
* More WIP
* combining otlp and grpc config
based on SeanHood's initial work for #383, I've fleshed out ConfigOpts, and used it to
simplify the configuration of the http and grpc exporters
* tidy
* changing compression to string, per spec
* update example - insecure defaults to false per spec
* moving more config into ConfigOpts
now both http and grpc exporters have almost the same constructor (todo Grpc accepts a SpanConverter
but http does not)
* removing unused SpanConverter param
* remove unused function
* test coverage for grpc exporter
Co-authored-by: Sean Hood <me@seanhood.co.uk>
* Configuration from environment variables.
Allow configuring resources, (some) exporters, samplers, and span processors from environment.
Add a TraceProviderFactory as a top-level method of creating a span processor from environment variables.
I think that other span exporters can be made to be env-configurable, but holding off until an upcoming improvement to use psr-7 discovery lands, which should simplify
most of the exporters.
* setting io.opentelemetry.contrib.php as the default tracer name
* review feedback
- Throwing InvalidArgumentExceptions from some factories.
- Removing guzzle client from ExporterFactory.
* magic values to consts
* moving queue init to property
* adding root sampler to parentbased sampler description
this makes parent-based description more meaningful, and also useful for test assertions
* fixing tracer provider factory tests
* improving span processor factory tests
* use ReflectionObject in test
* Adding a trait for retrieving and processing environment variables
* empty value must be treated as unset
* fixing default service name
* updating BatchSpanProcessor to spec
The spec for SpanProcessor::shutdown() says 'MUST include the effects of ForceFlush', so implement that logic and add a test (also updated a couple of other tests to add a new expectation on forceFlush)
The spec for SpanProcessor::forceFlush() also says that built-in span processors MUST call forceFlush() on the exporter.
Bugfix: SpanInterface::scheduledDelayMillis clearly accepts milliseconds, but time checking arithmetic uses nanoseconds. Adding a constant to convert between the two (todo, write a test?)
* renaming const, adding batch example
* style fix
* unit tests for batch span processor delay
* improving code coverage of BatchSpanProcessor
* span resources example
example code for setting span resource attribute, which are sent as part of the payload of each span. also adds to ConsoleSpanExporter a
representation of each span's resources
* concurrent spans example
* linting, updating ConsoleSpanExporter tests
* adding some stable resource constants
* update span name
span-n should be more obvious when reading a trace
* Add docs + ConsoleSpanExporter
- [ ] Add tests
- [ ] Support Events/Attributes/Status
- [ ] Kind should return friendly string not int
* Update ConsoleSpanExporter to match SpanExporterInterface
* Tests! and more
* Tests!
* Kind now returns the API name rather than the integer
* Added attributes
* Added status
* Added events
* Fix trace parent id
* Update docs + examples
* Make phan/phpstan/psalm/style happy
* Make palm happy on PHP 7.4?
* Document more functions
* Create and move namespaces into `src/` directory
* Update `composer.json`
Move test helpers outside of `SDK` namespace into `Tests`
* Follow PSR naming conventions for interfaces
* Follow PSR naming conventions for abstract classes and traits
* Do a pass on CI configs
* Add examples directory to cs-fixer config
* Fix some erroneously renamed type names
* First pass at updating Span API
* First pass at updated Span implementation
* Update SDK Span return types to `ReadWriteSpan`
Drop support for PHP 7.3
* Finish initial implementation
* Implement `SpanData`
* Implement `StatusData`
* Re-implement and rename `NoopSpan` to `NonRecordingSpan`
* Updates to support `SpanData` in exporters/span processors
* Add timestamp conversion helper methods
Update Exporters to use `SpanData`
Start updating Exporter tests
Implement non immutable `SpanData` test helper class
* Finish updating exporters/converters
* Fix next batch of tests
* First pass at `Tracer` refactor
Leverage a `SpanBuilder` to create the span
Use a dedicated object to share state
* Just use `NonRecordingSpan` constructor versus `create`
Start of adding tests for new Tracer implementation
* Remove some unneeded `max`
Make `Sampler` the 2nd arg to `TraceProvider`
Fix Integration tests
* Add `NoopSpanProcessor`
Continue updating/adding tests
* Install mockery
Ensure span processor is called with expected contexts/spans
* Update `SpanData` to directly return dropped amounts
Make `SpanProcessor#onStart` take a `ReadWriteSpan`
Update empty span fallback name
* Revamp `Clock` interface/implementation
* Add some additional doc comments
Continued work on updating test coverage
* Add more `Span` tests
* Get tests to a passing state
* Fix type errors
* Make CI happy
* Apply limits within `Span` constructor and `SpanBuilder` logic
Add test coverage for these cases
* Update `TextMapPropagator` interface
* Update trace context propagator
* Implement `ImplicitContextKeyed`
First pass at moving span activation outside of `Tracer`
* Set span as current when activating in `Tracer`
Fix some tests
* Make CI happy
* Use single method to get context
Add doc comments where needed
Update spec links to use specific version
* Normalize `Link` to use `getContext` as well
Reintroduce `getContext` to `ReadableSpan`
Make CI happy
* Update/Rename getter/setter type to be spec compliant
* Revert `Link` method name change
Makes it more clear you're getting a `SpanContext` not some sort of`LinkContext`
* Rename `makeCurrent` to `activate`
* Rename `Context` methods to better reflect their purpose
* Make carrier the 2nd arg
Implement `KeyedArrayAccess` and rename the propagation getter/setter to `ArrayAccessGetterSetter`
* Fix typing issues
* OTLP/HTTP First Pass
This PR Implements OTLP/HTTP (Protobuf)
As it stands the AlwaysOnOTLPExample works sending Traces to the Collector. The SpanConverter was pulled directly from the GRPC implementation.
OTLP/HTTP (Json) has an interesting history behind it and looks harder to support:
https://github.com/open-telemetry/opentelemetry-specification/issues/786
TODO:
- [ ] Tests
- [ ] Support all config params from the constructor (compression, timeout, headers)
- [ ] Endpoint validation
* Fixes Phan Error
* OTLP/HTTP: The wait is over
* Tests tests tests
* Add headers supports
* Supports 4 of 6 Env Vars
* Rejects otlp/json (for now)
* Might support gzip (needs testing)
* Unrelated psalm fixes
* chore: make style
* OTLP/HTTP: Copy/paste SpanConverter Tests
I feel like the OTLP/HTTP and OTLP/GRPC Classes could be more integrated since their SpanConverters are identical
* OTLP/HTTP: Request body should actually send the payload!
* Return InvalidArgumentException when invalid headers are passed rather than silently fail
* Re work process headers function so it\'s called in the constructor rather than later at export
* This fixes a number of test with the span converter, basic types work: string, int, float, bool.
* This fixes converting arrays passed into attributes; and adds tests too
* * Made independent of docker cache... :)
* Ignore docker-compose orphans.
* Made `make collector` section in Makefile since the collector related tests now have their own docker-compose and needed a d-c up as well.
* updated the example file to account for an error in the shouldSample function call, changed `RECORD_AND_SAMPLED` to `RECORD_AND_SAMPLE`, and added a children to a parent root span.
* Typo.
* Two different ways to make children spans.
* Style.
* Added database/internal/external spans.
* Address `psalm` error.
* Formatting.
* Adding Proto to opentelemetry-php
Signed-off-by:Ritick Gautam <riticksinghrajput@gmail.com>
* Updated the script for generating proto folder in root
* Moved shell file in script folder
updated .gitignore
* Removed opentelemetry-proto
* Bug fixed
* added docker-compose.proto.yaml
updated script file
updated Makefile
* Update docker-compose.proto.yaml
* Updated README.md
* OtlpGrpc
* Added Request-response
* Example Updated
* Updated Span Converter
* small fixes
* modified: SpanConvertor.php
* (WIP): Partially working OTLP/GRPC Exporter
What's working?
* Sends spans to the Otel Collector
* Spans contain: Attributes, Status Code, Kind, Start/End timestamp, Lib Version
* Sucessfully sent OTLP to Honeycomb.io
What's not working?
* Need to rebase main onto this branch
* Trace ID and Span ID are too long, and have been fudged to trim them.
* No tests. Unit/Integ
* Events on spans haven't been tested
* Child spans haven't been tested
* Example code needs to be updated (been testing with laravel-otel)
* Need to check the status returned
* Links not implemented
* Generally just unfinished
Anything more to add?
* Thank you to the Ruby OTLP Exporter, lots of inspiration was taken from there
* Fixed traceid and spanid hacks; Now supports Events
* Use localhost:4317 for the default host; + cleanup
* Split code between Exporter.php and SpanConverter.php; Beginnings of tests
* More progress on tests, array's now correctly get converted. Also ran `make style` to format the code
* * Ironed out passing in headers. Could not figure out how best to validate the format php grpc wants the metadata to be in so accepting just the required string format now.
* Beginnings of tests for the Exporter
* Compression now configurable, not tested
* Removed ServiceName from being passed to the Exporter, I believe this should be set as an Attribute on a Resource in the TracerProvider
* Checking the status code coming back from GRPC client, Otel Spec says transient errors MUST be retried, retries not yet implemented: ffc85ddfd9/specification/protocol/exporter.md (retry)
* Add (failing) test for converting SDK Span to OTLP Span
* I'm struggling to set (or even get) an end timestamp for the span.
* Attributes not implemented on Events
* Further progress on Tests for the Exporter
* SpanConverter now translates attrs on Events
* Add opentelemtry-proto files
* Ran `make style' on proto. Do we want this?
I pushed the proto files and build is complaining, not sure if we want to exclude this dir from linting or not?
Testing it formatted so I can try to get this build green.
* Few changes in this one..
1. Moved out ResourcesSpans into the SpanConverter
2. Time is almost fixed, well tests pass but... I learned the clock didn't work as I expected it to. Wall clock and monotonic clock are entirely unrelated. I still think this needs more work but I _think_ it tests that the duration is correctly set on the otlp span.
3. ResourceInfo is now populated on otlp ResourceSpans.
* Fix some of the complaints from static analysis
* Revert "Ran `make style' on proto. Do we want this?"
No, we do not want generated code to be formatted with php-cs-fixer
This reverts commit 996b473ad3.
* make style
* Static analysis fixes
* Hopefully this adds the grpc extension
* Hopefully this adds the grpc extension
* Some Psalm fixes
* Added a few comments; disable testing of InstrumentationLibrary until it's implemented
Co-authored-by: Ritick Gautam <riticksinghrajput@gmail.com>
Co-authored-by: Ritick Gautam <41835832+riticksingh@users.noreply.github.com>
* Update sampling behavior
* Change shouldSample() method signature to accept the Context
* Default sampler is ParentBased(root=AlwaysOn)
* Avoid to start sampled and non-recording span, return NooSpan
* Change names of SamplingResult constants: DROP, RECORD_ONLY, RECORD_AND_SAMPLE
* Return an updated TraceState in SamplingResult (parent TraceState by default)
* Merge Attributes from the SamplingResult with the Attributes provided in the startSpan method
* Add an integration test case for an overridden TraceState by the Sampler
* Experimental New Relic exporter, span converter, example, and tests.
* Test case mod.
* Fixed comment.
* Addressed PR issues.
* Created consts for `DATA_FORMAT` and `DATA_FORMAT_VERSION_DEFAULT`
* Commented out echos pending logging implementation.
* Removed middleware handler causing mem leak.
* [WIP] Add ContextValueTrait and Scope to store in Context
* Add tests for ContextValueTrait
Add test for the Context interaction during the Span creation
Generate the new Trace ID for every root span
* Fix phan warnings
* Add Context\Scope test
* remove global span creation when Tracer is initialized and fix batch exporter not exporting in batches but one by one
* use the monotonic clock instead of realtime clock to compute time elapsed - realtime clocks can move backwards
* add the NoopSpan. It will be used as the root Span
* Use NoopSpan for new traces
* Generate a new context if the root span is noop
* Remove comments
* Inline variable
* Must set parent as active span so that span ID is propagated
* Revert "Must set parent as active span so that span ID is propagated" as context can't be used as span
This reverts commit 985fa5e2c4a1b4b99f9ea15f4589da055652b091.
* Load NoopSpan when required
* Fixed regression: creating a Tracer with an existing context is now supported again.
* Add variable to improve readability
* Rename variable for clarity.
* fix failing psalm checks and add test for root NoopSpan
Co-authored-by: Ben Magee <ben@bmagee.com>
* Metrics API Templating
* Metrics API Templating
* Adding Style
* Added base Metrics Providers
* Rework this commit
* Minor changes in exporter
* Added test for abstract metrics exporter
* Fixed namespace in test
* Added Metrics interface stub
* Added additional check in GlobalMeterProvicerTest
* Style fixes
* Added fixes according to php stan
* Removed comments
* Refactored Exporter
* Removed unused array from AbstractExporter
* Refactored API and aded base files
* Installed new dependencies
* Added example for Prometheus Metrics
* Fixed Phan config
* Added UpDownCounter and tests for it
* Fixed prometheus misspelling, renamed shortcut command for metrics example
* Added docblocks
* Refactored structure of metrics prometheus example
* Added info in readme how to run metrics prometheus example
* Style fixes for counters
* Removed unused import in test
* Added more typization for metric labels
* Added todo for later
* Added versioning in MeterProvider
* Fix for versioning in MeterProvider
* Added ValueRecorder class
* Fixed typo in docblock
* Removed Assert library
* Removed assert library from phpstan config
* Fixed style
* Removed ValueRecorder from this branch
Co-authored-by: Bob Strecansky <bob.strecansky@gmail.com>
move all tests in the same root directory - will be easy to follow
remove errant test and whitelist the library code for coverage instead of tests
inherit JaegerExporter from Zipkin since we are using the zipkin protocol to export to Jaeger
* Change to timestamps and weave the hrtime web
* Fixed comma
* Updating Test
* Updating Tests
* WIP
* WIP
* Change to timestamps and weave the hrtime web
Test revamp (#90)
* Moving Tests
* Moving Tests
Adding more information to README.md (#84)
Fix relative link to AlwaysSampleTraceExample.php (#91)
Updating Tests
* WIP
* Working Time example with all requested updates
* Migrate src/ to sdk/ and api/
Co-authored-by: Bob Strecansky <bob.strecansky@gmail.com>
* Rename TracerFactory to TracerProvider
This follows opentelemetry/oteps#76.
Also start moving sdk tests into the sdk/Tests folder
* Touch up SpanStatus and ending spans
* Remove getTracerVersion and getTracerName
These aren't described in the spec -- we can add them back later
if we need to, but I suspect they belong only in the SDK, if anywhere.
* Update phan config and fix some warnings
* Start writing SpanOptions
Also start fixing examples, currently broken
* Fix PhpUnit 9 incompatibilities
Co-authored-by: Bob Strecansky <bob.strecansky@gmail.com>
* implement TracerFactory, begin migration to recommended library layout, use docker-compose and make to simplify development
* add tests for all TracerFactory method, move TraceFactory configuration in constructor
* run phan in travis-ci build
* rename namespace Tracing into Trace
* Performing Always and Never Sample Steps
* Updating examples to remove builder
* Updating examples to remove builder
* Removing builder from always off trace example