Commit Graph

497 Commits

Author SHA1 Message Date
Kishan Sangani 5de0986f86
Refactored ResourceInfo and ResourceInfoFactory Unit and Integration tests (#664) 2022-04-20 13:47:52 -04:00
Yukti 1d5283b9e4
Add integration tests for tracing compliance (#662)
* Add integration tests for span builder

* Space fixed

* Add more descriptive names and @group annotation

Modified the names of the tests to be more descriptive and added the
`@group compliance` notation.
Additionally, I commented out one of the tests that I was not totally
sure of. (unsure if `setAttribute()` should work with empty string `''`
values.

* Fixed test name

* Check for specific attributes and not just count

Removed `$span->end()` calls as they shouldn't be necessary

* Remove redundant `end()` calls

* Add test for getting default tracer

Test to get default tracer. Also, added `@group` php unit annotation for
tests to check specification compliance

* Fixed warning

* Fixed style warning
2022-04-17 13:15:34 +02:00
Tushar 6d993586b0
Move InstrumentationLibrary key generation logic out of TracerProvider/SpanConverter [#619] (#663)
* Extract InstrumentationLibrary key generation logic

Factors key generation logic for InstrumentationLibrary instances
out to a helper method in a utils class.

* Remove @see PHP annotation

Phan doesn't like it, couldn't see an acceptable workaround.

* Change key generator namespace and class

Changes the key generator's namespace to Util\Instrumentation and classname to
KeyGenerator, refactoring usages.

* Add unit tests for Instrumentation key generator

* Add test case for non-null version and null schema

Also renames the other 2 tests for descriptiveness.
2022-04-15 14:16:12 +02:00
Yukti 7ce599bab1
Fixed formatting (#661) 2022-04-14 22:01:13 +10:00
Yukti c242c37db0
Readme tidy (#654)
* Fix typos and some redundancy

Fixed a few typos and removed mentions of "from your bash compatible
shell" (we use make so these commands are compatible with all clis)
2022-04-14 19:10:05 +10:00
Timo Michna 99fba0d720
Make Error level of BC messages configurable and add info to README. (#657)
* Make BC error level configurable

* Add information about BC errors to README

* Make CS happy

* Silence Psalm

* Add missing test

* Remove unused data annotation
2022-04-05 21:53:49 +02:00
Brett McBride 57076b50d5
bump protobuf extension to 3.20.0 (#656)
this should make the build green for 8.1, finally. We can now consider 8.1 supported,
and so it moves out of experimental - future 8.1 breaks will fail the pipeline.
2022-04-04 13:20:23 -04:00
Brett McBride e096e529bb
Revert "replace E_USER_NOTICE with E_USER_DEPRECATED (#647)" (#655)
This reverts commit 72816bb324.
2022-04-03 21:22:16 +10:00
Ivo Bathke 72816bb324
replace E_USER_NOTICE with E_USER_DEPRECATED (#647)
* replace E_USER_NOTICE with E_USER_DEPRECATED since it is a notice about a deprecation

* fixed tests
2022-04-02 11:30:23 -04:00
Brett McBride 80a6d63f51
static logging methods (#651)
allow logging methods in LogsMessagesTrait to be called from within either a static or non-static method.
in passing, adding a missing coversNothing annotation on a complaining integration test
2022-04-02 09:55:45 -04:00
Timo Michna 5f71d3cfe3
Add example of how to create a new trace in same process (#650) 2022-04-02 16:56:56 +11:00
lalex 445e932ee0
Extract a Resource schemaUrl merging method (#627) 2022-04-02 07:01:52 +02:00
Yukti f2ad2fcb5b
Add compliance tests for environment variables (#648)
* Add compliance tests for environment variables

* Add tests to verify compliance

* Add Makefile task for testing compliance
2022-04-02 05:41:31 +02:00
Brett McBride 0bc3731ca6
removing brick/math from phan config (#646)
was not removed in #642 along with the rest of the library
2022-03-31 08:50:30 -04:00
Yukti 169bdbee57
Add @group annotation to compliance tests for environment variables (#611)
* Add @group annotation to compliance tests

Marked tests for environment variables with phpunit @group annotations to identify
compliance tests. This enables for a way to run just those specific
test and will serve as a useful form of documentation.

* Add trace signal specific notation
2022-03-31 08:49:33 -04:00
Grunet ca05f51481
Add test based on the Jaeger spec (#645)
* Add test based on the spec
* Fix the other tests which appear flaky
* Clarify the randomness in these tests
* Add concrete example from Go for the trace id splitting
* Fix style
2022-03-31 20:46:40 +11:00
Brett McBride 178cc9e292
adding new contributor welcome message (#644)
welcome-bot has been installed in our repo, this is config to make it do something on a first PR
2022-03-30 15:03:46 -04:00
Bob Strecansky 8f0b522bd3
Updating .github workflow for psalm-security-analysis based on output from action run (#643) 2022-03-30 14:04:07 -04:00
dependabot[bot] 8b488b384d
Bump guzzlehttp/psr7 in /examples/distributed-tracing/src (#640)
Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 2.1.0 to 2.2.1.
- [Release notes](https://github.com/guzzle/psr7/releases)
- [Changelog](https://github.com/guzzle/psr7/blob/master/CHANGELOG.md)
- [Commits](https://github.com/guzzle/psr7/compare/2.1.0...2.2.1)

---
updated-dependencies:
- dependency-name: guzzlehttp/psr7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-31 04:30:25 +11:00
Sakti Behera aadcb1218d
[#641] Fixed issue related to traceId & spanId mismatch between otel lib and jager collector (#642) 2022-03-30 12:16:54 -04:00
Brett McBride e62cd5e831
honour grpc exporter provided endpoint url (#639)
a bug when fetching settings from environment was causing the grpc exporter to always use our default
value, rather than the one provided to the exporter's constructor
2022-03-29 10:37:53 +02:00
Grunet 54066eb3eb
Fix span and trace ids to be the correct unsigned ints they need to be when converted for Thrift (#635)
* Factor a class out for handling the id conversion

* Remove remaining direct intval references

* Further isolating the soon-to-be-replaced use of intval

* Use brick\math to fix the issue and update the existing tests

* Adding brick\math to composer.json because I missed it in the previous commit?

* Adding some edge case unit tests around the id conversion

* Move explanatory comments into the data provider itself

* Add new package to phan config

* Fix style

* Try clarify comment

* Extract constant

* Remove comments

* Try quick manual merge to fix merge conflicts
2022-03-28 21:35:31 -04:00
Grunet 39c99e5a2f
Map OTEL Resources to Jaeger Process Tags (#636)
* Commit in progress work because Gitpod is weird

* Finish initial stab at the changes

* Forgot to update the exporter

* Add in proper handling of serialization of ResourceInfo

* ksort doesn't return the array...

* Only PHP 8.1 supports key-ed array destructuring

* Creating some adapters to break the hard dependency on Batch to make testing easier

* Refactoring to break the hard dependency on Batch

* Add initial unit tests around the new logic in HttpSender

* Some refactoring of the test's helpers

* Another small refactor

* Some more refactoring

* Rename ResourceInfo's test file to match it's file name

* Move a test our of REsourceInfoTest into a more appropriate file

* Add some basic conformance tests around the new ResourceInfo::serialize method

* Add a test to try and catch future properties that aren't added to ResourceInfo::serialize

* CLean up comments

* Replace string with constant

* Improve variable names

* Cleaning up comment

* Split out tag creation into a helper class

* Phan didn't like the type docs

* Fix style

* Fix tests after merge from main

* Fix coverage reporting issues on 2 of the new files

* Fix style

* Rename vals to values

* Shortening the batch adapter factory method name to create

* Inline a method call

* Inline some method calls

* Shorten factory method to just "create"

* Inline some code

* Split assertions into 3 tests

* Rename parameter in interface implementation for psalm + update the rest of the file to match

Co-authored-by: Timo Michna <timomichna@yahoo.de>
2022-03-28 03:18:32 +02:00
Timo Michna a2f64053da
Add Backward Compatibility layer (#637)
* Add Attributes BC layer

* Add AttributeLimits BC layer

* Add InstrumentationLibrary BC layer

* Add GlobalLoggerHolder BC layer

* Add triggerMethodDeprecationNotice

* Move Clock BC layer

* Add ResourceInfo BC notices

* Add missing return statement

* Add BC class directory to coverage ignore

* Fix code coverage annotations
2022-03-28 03:11:01 +02:00
Timo Michna 8e1e912c92
Move and refactor clock components (#633)
* Move Clock classes to SDK\Common\Time namespace

* Move conversion methods to Util class

* Implement StopWatch

* Implement ClockFactory

* Fix StopwatchInterface

* Finalize ClockFactory

* Implement StopWatchFactory

* Deprecate AbstractClock

* Add BC alias

* Add initial start time to StopWatch

* Unify and optimize SystemClock methods

* Use ClockFactory in Span

* Use ClockFactory in BatchSpanProcessor

* Use ClockInterface in BatchSpanProcessorTest

* Use ClockFactory in SpanData

* Use ClockFactory in examples

* Add millisToNanos Util method

* Use StopWatch in BatchSpanProcessor

* Make Phan happy

* Make Psalm happy

* Make PHPUnit happy

* Remove sllh/composer-versions-check from allowed composer plugins

* Use correct assertion

* Use correct assertion

* Assert difference
2022-03-25 23:26:39 +01:00
Kishan Sangani 2b72c92fcb
Created ResouceInfoFactory class (#628) 2022-03-24 13:54:42 +11:00
Kishan Sangani 3856d4df06
Resource Detector Unit Tests (#626)
* Added Resource Detector Unit Tests

* Modified test

* Resolved review messages
2022-03-21 18:59:04 +01:00
Timo Michna f96756ba10
Refactor and move InstrumentationLibrary (#624)
* Refactor and move InstrumentationLibrary
2022-03-20 21:36:18 +11:00
Timo Michna 6e7a650c4b
Fix Exception Message (#620) 2022-03-19 23:52:08 -04:00
Timo Michna 940f67f1c7
Refactor Attributes (#623)
* Move Attribute classes to Common namespace

* refactor AttributesTest

* Move Attribute classes to Common namespace in examples

* Introduce AttributeLimitsInterface

* Fix bug in total added values calculation

* Move compare test to correct test-class

* Apply CS

* Refactor Attributes

* Fix attributes in Benchmark

* Move AttributeLimits defaults to interface
2022-03-19 23:51:47 -04:00
Timo Michna 1d6d717e0d
Refactor LoggerHolder (#617) 2022-03-19 12:52:06 -04:00
Timo Michna 33958e03a4
Update dependency checks (#616) 2022-03-19 11:03:38 -04:00
Timo Michna fd0c270c08
Fix env var resolution (#615) 2022-03-19 11:02:57 -04:00
Timo Michna 3c5f9fc5ae
Support Env Var injection (#614) 2022-03-18 08:22:33 -04:00
Kishan Sangani 7b26ce1260
Updated Members and Contributors (#612)
* Updated Members and Contributors

* Updated header size for contributors
2022-03-16 14:42:54 -04:00
lalex 3445917252
Add support for schemaUrl in TracerProvider and OTLP SpanConverter (#607)
* Add support for schemaUrl in TracerProvider and OTLP SpanConverter
2022-03-16 10:18:40 +11:00
Brett McBride 78e43b0918
ignoring some new phpstan failures (#604)
phpstan has just started to fail on a couple of test assertions based on their phpdoc return type:
Call to method PHPUnit\Framework\Assert::assertNotSame() with mixed and mixed will always evaluate to false
This doesn't consider that assert<Not>Same will also check for whether two objects are the same instance, so
ignore the error.
2022-03-08 09:03:27 +11:00
Kumar Pratyush 0732418071
Refactoring to use known values (#601) 2022-03-07 12:10:12 +11:00
Bob Strecansky b9920a5d32
Updating CONTRIBUTING.md (#602) 2022-03-02 23:12:13 +01:00
Kishan Sangani 5dd8f967cf
Added OTEL_PHP_DETECTORS environment variable (#600)
* Added OTEL_PHP_DETECTORS environment variable to configure detectors from environment

* Added unit tests for defaultResource

* Review comment: Added exapmle

* Refactoring to keep the syntax same across examples

* Review comment: Using static method instead creating instance and using constants
2022-03-02 16:23:09 +01:00
Kishan Sangani be15243441
Refactored Environment.php to use EnvironmentVariablesTrait::hasEnvironmentVariable function (#598) 2022-03-01 12:45:53 +01:00
Grunet 6a50c55f48
Scaffold Jaeger Thrift Http Exporter (#576)
* Scaffold the new exporter and helper class

* Make the SpanConverter compliant to the interface the others are

* Removing check already covered by SpanExporterTrait

* Adding in scaffolding for a happy path test through the new code

* Fix bugs when path is present or endpoint scheme is https

* Remove type doc to fix psalm errors

* Comment out doc type to fix phan issue

* Fix style

* Add missing type in constructor

* Shorten ternary

* Inline function calls in doExport

* Inline function calls in doExport

* Revert ternary condensation commit from earlier

* Not requiring a port be set in the endpoint URL and inferring it from the scheme when it's missing

* Try adjusting thttpclient with a subclass instead of adapter (#2)

* Setup the exporter for injecting a psr-18 client

* Switch to using a subclass of THttpCLient

* Getting the psr-18 client into the subclass

* Copy verbatim from THttpCLient the method that needs working

* Getting the request and stream factories in there too

* Migrating the headers over to use the psr18 and psr7 things

* Migrating over the body

* Commenting out some more things Otel doesn't need

* Commenting out the rest as it seems accounted for

* Removing the last of the old implementation

* Fix to undefined variable from previous commit

* Actually otel isn't using any custom headers so we don't need to handle those either

* Remove all the commented out code

* Updating fromConnectionString to use the discovery helpers to find and inject the PSR-18 and PSR-7 classes HttpCollectorExporter needs

* Reworking happy path test to use mocks of the PSR-18/PSR-7 interfaces

* Turning TODO in to comment

* Adjust line breaks

* Fix style

* Fix potential array key access error Phan noticed

* Ignore psalm false positives in the test file

* Workaround odd psalm bug/behavior of surfacing errors in THttpClient after it's been subclassed

* Switch to correct shortening of ternaries this time

* Minimal changes needed to drop dependence on THttpClient

* Moving some of the setters into the constructor now that the THttpClient superclass is gone

* Cleaning up endpointURL duplication and removing host_ member that's not really needed anymore

* Naming the copied over buf_ member a little more explicitly

* Naming the main test object in the span converter test class more clearly

* Renaming 2 of the files/classes to be more clear

* Remove inaccurate copy pasta leftover from THttpClient

* Fix style

* Factor out a helper object for parsing the endpoints to help satisfy Phan

* Have codecov pick up on the hlper class for code coverage

* Refactor the UDP exporter to also use the new ParsedEndpointUrl helper class

* Fix style

* Psalm makes a good point that the defaults for host/port in the UDP exporter can never be hit since the entry point requires them to be present in the endpoint URL
2022-02-28 12:42:31 +01:00
Yukti ccc3f8db96
Add support for OTLP signal specific environment overrides [#590] (#595)
* Add support for OTLP signal specific environment overrides

Modified the OTLP gPRC and HTTP trace exporters to allow for
configuration options overrides by signal specific options to comply
with OpenTelemetry specs.

* Revert overrides for the INSECURE variable

* Add check method to EnvironmentVariableTrait

For better code readabilty, added a hasEnvironmentVariable() to
EnvironmentVariableTrait.

* Add check for empty certificate file

* Fix style and add check for endpoint variable
2022-02-28 12:38:34 +01:00
Timo Michna b7093b57c1
Adjust stale-bot config (#596)
* Adjust stale-bot config
2022-02-28 06:58:13 +11:00
Kishan Sangani 8a362215fd
Refactored SpanProcessorFactory and updated corresponding unit tests (#594) 2022-02-24 09:43:53 +11:00
Kishan Sangani e50a827704
Exporting ResourceInfo in SpanConverter (#591)
* Exported ResourceInfo attributes in SpanConverter

* Updated Unit tests
2022-02-23 18:17:50 +01:00
Kishan Sangani 08d3fe8d0d
Refactored Environment.php to use Environment constants and accessor (#592) 2022-02-23 10:31:54 -05:00
Patrice Chalin 061adadafd
Delete website_docs (#585) 2022-02-17 18:46:54 -05:00
Bob Strecansky a02868f26d
Stale bot setup (#583) 2022-02-16 20:03:37 +01:00
Timo Michna 3a7f7f71bb
Update SemConv (#581) 2022-02-16 08:32:22 +01:00