Commit Graph

9 Commits

Author SHA1 Message Date
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 f96756ba10
Refactor and move InstrumentationLibrary (#624)
* Refactor and move InstrumentationLibrary
2022-03-20 21:36:18 +11: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
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
Kishan Sangani e50a827704
Exporting ResourceInfo in SpanConverter (#591)
* Exported ResourceInfo attributes in SpanConverter

* Updated Unit tests
2022-02-23 18:17:50 +01:00
Grunet 7335c4183f
Bring Jaeger Thrift Span Converter up to Spec (#556)
* Add in the span kind mapping

* Improve colocation of the 64 bit check

* Make the order of the helper functions better match the usage in the entry method

* Rename otlp to otel since that was tripping me up a little

* Initial work for events conversion

* Making the previous commit functional and adding tests

* Factoring out a chunk of code from the entrypoint

* Fixing style

* Extract confusing constants

* Uncommenting the handling for tags of non-string types

* Making the string tag type the default fallback, matching the sanitiseTagValue method

* Moving the array serialization into the buildTag method

* Opening up the tag creation to arbitrary types, not just strings

* Moving the array serialization method to be more colocated

* Fix existing tests

* Removing hard to reach branch that should already be covered by the default case

* Extending existing test to cover the new number cases

* Refactor to avoid possibly mutating argument reference

* Implement error flag section of the spec

* Implement the Links section from the spec

* Refactoring the span id conversion for better colocation

* Fix assertion parameter order in a few tests

* Fix style

* Fix style post manual merge from main

* Inline helper method call

* Remove elseif branches

* Re-cover bool to string conversion line and remove less-than-helpful comment nearby
2022-01-29 07:41:12 +01:00
Grunet 13717d367c
Some incremental progress on Jaeger spec compliance (#555)
* Add in the span kind mapping

* Improve colocation of the 64 bit check

* Make the order of the helper functions better match the usage in the entry method

* Rename otlp to otel since that was tripping me up a little

* Initial work for events conversion

* Making the previous commit functional and adding tests

* Factoring out a chunk of code from the entrypoint

* Fixing style

* Extract confusing constants
2022-01-26 05:16:23 +01:00
Grunet 9d1d0c5e49
Satisfy base spec for Jaeger Thrift span conversion (#547)
* Include library name and version in the jaeger span
* Implementing the span status conversion part of the base spec
* Add test now instead of later to pass coverage requirements
* Trying to clarify how the mapped statuses are distinct from the input ones with constant names
* Update namings of constants to be more flexible
2022-01-17 16:23:02 +11:00
Grunet 015907c2f2
Revamped PR for Jaeger Agent Support (#545)
* Moving the files to what I think are their correct new location
* Initial resolution of some of the parsing and intellisense errors
* Installing apache/thrift to solve more of the parsing issues
* Updating AgentExporter to conform to the updated SpanExporterInterface
* Switching to the new method names on SpanDataInterface
* Make the thrift generation script executable
* Fixing the last intellisense issue in AgentExporter
* Generating these thrift IDL files seems to have resolved the remaining parsing/intellisense errors
* Update thrift generation script to change target directory
* Generate the thrift idl files in the new directory
* Clean up conflicts with SpanExporterTrait's declaration of isRunning
* initial scaffolding for a happy path
* Fix lookup for socket functions to not look in the Jaeger declared namespace
* Setting up the autoloader so auto-generated thrift files can be found
* Switching to use the static method for creating the object under test
* Add a method and assertions to the happy path
* Doing some more exercise by passing in a shell span to export
* Clean up the socket at the end of the test
* Extend the happy path's coverage slightly
* Move exertion of the tag generation logic into a unit test
* Commenting out apparently dead code
* Adding a unit test exercising the happy path of the SpanConverter in more detail
* Ordering assertSame parameters correctly
* Cleaning up the 2 new tests a little
* Updating tests to match the new naming convention upstream
* Run make style
* Fix psalm errors
* Fixing most of the phpstan errors
* Fix test broken by psalm changes
* Fix phan config issues
* Fix phpstan issues
* Preventing installations on non-64 bit systems that won't work with Jaeger ids
* Manually merge changes to composer.json
* Fix 64 bit requirement setup
* Some more manual merging to try and resolve composer.json conflicts
* Update namespace for SpanData test helper to fix psalm issues
* Move the test files to what appear to be their new locations
* Fix failing test around getValue call on attributes (not exactly sure how this was passing before, but now it matches the zipkin version)
* Add @covers attributes to the test files
* Moving AgentExporterTest under the Unit folder because tests under the integration folder don't have their coverage reported
* Commenting out CodecUtility to see how that affects the coverage
* Adding in requirements and suggestions for ext-sockets into the composer.json's
* Switch to self when invoking the static method
* Rename Transport to TransportInterface
* Switch to using the logging trait instead of calling error_log directly
* Removing 64-bit install requirement
* Refactor anything needing to use intval into 1 function
* Adding a runtime check for 64-bit integer support
* Adding missing return types on methods
* Moving ext-sockets to be a suggest in the contrib composer.json too
* Remove extraneous comments in tests
* Switch to use shared time unit conversion method
* Clarify what the pre-existing commented out code should be used for
* Run style fixer
* Move 64bit check into a constructor
* Deleting the unused CodecUtility file
* Converting the TODO to a NOTE for the 2nd commented out block in SpanConverter
2022-01-13 15:22:53 +11:00