Commit Graph

712 Commits

Author SHA1 Message Date
Brett McBride 615917f5d4
adding logs signal (#934)
* initial work on logs signal

* supressing psalm error

* "fixing" 7.4 segfault
through trial and error, I found that it was consistently segfaulting in the sdk autoloader
tests, but by running them in a different order, the failures went away.

* adding logs tests

* rename example per feedback

* move log context injection into processors, per spec

* correctly set context on logs

* update logger name per feedback

* adding variables, map psr3 to otel severity, fix timestamp

* psr-3 loggers

* tests, psr3 v3 fix

* remove LogRecordDate and refactor SDK log record classes

* tests, tidy, improvements

* remove todos

* documentation

* check for valid span context

* removing psr-3 compatibility, per spec and feedback

* use InstrumentationScopeFactoryInterface

* apply attribute limits on readablelogrecord creation
per feedback, this should be more memory efficient for the processors

* group log record by resource/scope

* remove psr3 references from readme

* ignoring psalm error

* add trace context in Logger rather than processors
per feedback, and following the example in java and python SIGs, we
can add trace context to logs once, in the logger, rather than having
processors do it. The Context passed to processors is no longer used,
but retained for spec compliance.
2023-03-22 08:11:51 -04:00
Brett McBride c058a646f6
upgrade rector (#938)
use latest version, and apply suggested updates
2023-03-21 13:35:20 +11:00
Brett McBride 0538a5a7c7
fixing empty tracestate header handling (#936)
if an empty tracestate header was passed, we were emitting a warning (discovered in the demo app after enabling logging).
to fix this, check for empty string as well as null.
2023-03-16 18:45:15 +11:00
Piotr Antosik 640b6f53a0
Update exporter path in docs & makefile (#935) 2023-03-13 17:52:28 +01:00
Brett McBride 88ea7c3024
adding container detector (#933)
detect container id from cgroup or mountinfo
2023-03-03 09:18:42 +11:00
Piotr Antosik 746d25a7d1
Move grpc/grpc to dev dependency (#930) 2023-02-28 07:44:41 -05:00
Brett McBride 20f39b6a74
script to identify required releases (#928)
a script to identify which of our git-split repos have changes which are not in a release.
also creates release notes for the release, which can be dropped into the github UI
* print new release url
* relax symfony/yaml requirement
* warn about rate limiting if no token provided
2023-02-28 19:55:23 +11:00
Brett McBride da05ab83ce
fixing otlp+json example (#927)
fixing otlp+json example
2023-02-27 21:38:51 +11:00
Brett McBride 2a0a9e33e6
fixes and tests for MetricExporterFactory (#926)
Fixing grpc path and allowing compression from MetricExporerFactory
2023-02-16 10:00:14 +11:00
Brett McBride 19b9326751
relax composer version requirements (#918)
using self.version does not work when we have different components being released individually. ^1.0 seems like a sensible initial setting now that we have reached beta.
2023-02-16 00:44:20 +11:00
Przemyslaw Delewski 5f3e9cae9d
Update CONTRIBUTING.md (#925) 2023-02-14 12:44:41 -05:00
Brett McBride c6b0be7c89
remove older BC implementations (#923)
These BC features have been in place for multiple releases, it's time for them to retire.
2023-02-14 10:56:50 +11:00
Brett McBride e59f2c3cff
fixing phpunit 9.6 deprecations (#922)
phpunit v9.6 introduces a bunch of deprecations for things that will break in v10. This fixes the tests that are currently complaining.
2023-02-13 18:43:57 +11:00
Piotr Antosik 24af6ac173
fix PHP 7.4 preload error (#919) 2023-02-05 21:59:01 +11:00
Ricardo Fontanelli c4161a0ebe
Add scheme to collector endpoint on traces example (#913)
Add scheme to collector endpoint on traces example docker-composer file
2023-01-20 08:20:51 +11:00
Brett McBride 4b9f1200bf
adding a configuration for disabling auto-instrumentations (#909)
* adding a configuration for disabling auto-instrumentations
addressing review feedback from pdelewski, provide a mechanism that can be used to disable auto-instrumentation packages
without actually uninstalling them.
A new variable, OTEL_PHP_DISABLED_INSTRUMENTATIONS, has been added which accepts a list of instrumentation names to be disabled.
Each instrumentation can call Instrumentation::isDisabled to determine if they should bail without registering hooks.

* moving instrumentation disabled into Sdk class
2023-01-12 10:55:48 +01:00
Brett McBride 7b5ca0ce97
allow OTEL_SDK_DISABLED to disable sdk autoloading (#902)
* allow OTEL_SDK_DISABLED to disable sdk autoloading
* review feedback
- test for sdk disabled in initializer
- sdk disabled does not disable propagator, per spec
2023-01-11 10:05:28 +11:00
Przemyslaw Delewski ee26eaa5d8
Remove JaegerExporter and update interface (#908) 2023-01-10 09:25:34 +11:00
Brett McBride 2bd6bc5ff7
do not export empty metrics (#907)
If no metrics have been generated, do not send an empty export request (except via forceFlush())

Closes 905
2023-01-10 09:23:54 +11:00
Brett McBride 558e7ce30e
default logging to console (#899)
Rather than log nothing by default, log warnings and greater to console.
By providing a psr-3 logger, users can gain greater control over logging, including disabling it (via NullLogger)
2022-12-22 09:39:27 +11:00
Brett McBride c98866b3fa
update gitsplit regex to match beta releases (#898) 2022-12-13 11:42:17 +11:00
Brett McBride 425ebaf4f9
doco updates for beta (#895) 2022-12-12 09:05:21 -05:00
Brett McBride 02c1782667
adding php8.2 to build matrix (#896)
* adding 8.2 to build matrix

* 8.2 experimental

* relax deptrac

* allow style check to fail if experimental

* bump checkout action version
2022-12-12 09:05:09 -05:00
Brett McBride 616b356b83
tracestate + baggage todos (#894)
- remove baggage TODOs which have since been done.
- implement TODOs from tracestate to log warnings.
- tidy up tracestate code, simplify some const names.
2022-12-12 14:16:41 +11:00
Brett McBride 602ea8539f
move LoggerHolder to API (#893)
there is a requirement (and some outstanding todo's) to log errors and warnings from the API, so move
logger setup into API to facilitate this.
2022-12-12 09:01:17 +11:00
Brett McBride 0073d6dfe6
create text map propagators from registry (#885)
* create text map propagators from registry
removing undocumented dependency between sdk and extension by adding text map propagators to a registry
as part of composer autoloading, similar to how exporters, transports etc are treated.
* remove TextMapPropagatorFactory instances and register the singletons directly
* rename FactoryRegistry to just Registry
2022-12-10 08:42:47 +11:00
Brett McBride 5a51249c6b
removing jaeger exporters (#890)
Jaeger has dropped support for the jaeger exporter in favour of opentelemetry exporter. The upstream repos are now archived.
Support has been dropped from the opentelemetry collector, and other SIGs should follow soon.
ref: https://github.com/open-telemetry/opentelemetry-specification/pull/2858 and https://github.com/open-telemetry/opentelemetry-specification/issues/2859
2022-12-09 14:25:42 +11:00
Brett McBride f5698c8864
implement retrieve span and trace id as binary (#883)
per spec, https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#retrieving-the-traceid-and-spanid allow retrieving span and trace id in binary form
remove hex2bin calls from otlp span converter and use new binary accessor
2022-12-08 12:55:29 +11:00
Przemyslaw Delewski 7bfc1218d6
allow setting service name from auto instrumentation context (#881) 2022-12-07 23:23:19 +01:00
Brett McBride 02d94216e1
span status compliance (#884)
implement spec-compliance for span status:
- Ok is final
- Unset should be ignored
- Error can be updated to Ok

ref: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
2022-12-07 14:07:33 +11:00
Brett McBride 311afa265a
fixing default service name (#887)
* fixing some sdk/default resource values
- default service name should contain runtime name if available; java just appends ":java" so I did the same

Co-authored-by: Tobias Bachert <git@b-privat.de>
2022-12-07 09:58:33 +11:00
Brett McBride dc5ef24bd3
adding baggage example usage (#888)
adding a baggage example
2022-12-07 09:52:21 +11:00
Brett McBride a1e8aff01e
move exporter examples (#886)
moving exporter examples up one directory, where I think they are more obvious to find.
remove some old and broken grpc examples.
remove unused interface.
2022-12-07 09:00:09 +11:00
Brett McBride 587bc5aaf0
fix stream transport factory creation (#882)
when creating a stream from an endpoint string, the factory wasn't returning the stream. fix and add tests.
Co-authored-by: Tobias Bachert <git@b-privat.de>
2022-12-05 22:02:12 +11:00
Tobias Bachert fd8ac30f07
Run exports with the `Context` the `SpanProcessor` was created in (#880)
* Run exports in spanprocessor construction context

* Resolve psalm issues
2022-12-02 13:31:42 -05:00
Przemyslaw Delewski 0ce2fda813
fixing typo in name (#877) 2022-12-01 09:08:50 +11:00
Brett McBride 2e96621b0f
allow 16 char b3 trace id (#869)
b3 spec allows trace id to be 16 or 32 char. other SIGs left-pad with zero to resolve this.
2022-11-30 14:03:18 +11:00
Brett McBride 80afb1d948
updating membership lists (#876)
adding pdelewski, our newest maintainer
moving some past members into a new 'emeritus' section
2022-11-30 13:39:00 +11:00
Brett McBride 017c3e1c76
update contrib autoloading and gitsplit (#875)
* update grpc gitsplit destination
match the gitsplit destination repo to match package name: 'transport-grpc'
* adding missing autoload files for exporters
2022-11-30 09:54:23 +11:00
Brett McBride c735471aef
improve and expand otlp benchmark (#874)
- remove Mocker mocks, which were contributing extra time, and replace with no-op implementations
- adding extra benchmarks (batch vs simple, protobuf vs json)
2022-11-30 09:53:28 +11:00
Brett McBride 1ffd7e80eb
migrate/remove swoole (#871)
contrib/swoole has been moved into the contrib repo: https://github.com/open-telemetry/opentelemetry-php-contrib
2022-11-29 14:36:58 +11:00
Brett McBride 17f2fac397
tests and benchmark for baggage parsing (#873)
* tests and benchmark for baggage parsing
* adding percent-encoded test case
2022-11-29 14:33:40 +11:00
Brett McBride d37d4490d9
decode OTEL_RESOURCE_ATTRIBUTES values (#872)
per spec, resource attributes coming from environment should be decoded in
the same way that they would be if coming from a header
2022-11-29 14:32:26 +11:00
Brett McBride 01378ecf8a
disallow non-standard boolean config values (#870)
per spec, only 'true', 'false' are valid boolean values. anything else should be
interpreted as false and a warning emitted.
2022-11-29 14:31:09 +11:00
Marcos Passos 22c78cfd3b
Remove internal tag from Context::setStorage (#867)
This allows custom storage (eg for Swoole) to be used.
2022-11-26 07:26:34 +11:00
Brett McBride 904da75ee6
adding exporter + transport registry (#862)
* adding exporter + transport registry
to remove the hidden dependency between SDK and contrib, move all of the exporter knowledge out of
exporter factory, and invent a registry to hold those values. The registry can be added to by contrib
modules as part of composer autoloading.
This also allows users to override things like transports (eg, provide their own grpc transport).
Remove exporter's fromConnectionString as it's not in spec, and I couldn't get it to work nicely with the
registry idea.

* fixing up examples

* allow callables to be registered as factories
adding an example of replacing a registered transport factory with another implementation

* Registry to FactoryRegistry

* new relic exporter factory, tests

* review suggestions

* tidy

* change fromEnvironment() to create() in factories
2022-11-23 14:39:24 -05:00
Brett McBride 116e46d964
sdk autoloading (#854)
* sdk autoloading
* use instrumentation initializers
* basic sdk + autoloading documentation
* exampler filter from config
* configuration default types
2022-11-14 08:52:35 +11:00
Brett McBride f083b10909
refactor environment configuration (#859)
refactoring Environment access to allow configuration from multiple sources. Initially, the sources are env ($_SERVER) and php.ini, but this should allow us to add more sources in future without changing the API.
do not modify OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
allow resolvers to return mixed
2022-11-10 09:48:17 +11:00
Erdem Köse 92e7a0d070
Fix OTLP GRPC example (#856) 2022-11-05 09:10:14 +11:00
Brett McBride 0b43fac729
refactor otlp exporter (#838)
* merge otlp exporters
continuing on from Nevay's work, this removes the individual OtlpHttp and OtlpGrpc exporters, and replaces with
Otlp\Exporter using a transport to manage grpc and http/protobuf complexity.

* tidy

* use mockery overload instead of prototype clone

* making all smoke-test examples work

* removing startBatch
verified that the call attributes have the same values when using TraceServiceClient

* tidy

* tidy

* Revert "use mockery overload instead of prototype clone"

This reverts commit bbb685b4d1.
Mocking proto-generated files segfaults with ext-protobuf (which is harder to diagnose when running in a child process, which
was required for fancy mockery mocking of "new". So, back to the prototype approach, and skip the tests if ext-protobuf enabled.

* tests without mocking protobuf

* test

* typo

* reverting FromConnectionStringInterface

* grpc headers

* revert to dumb transports, handle multiple protocols

* tidy, adding initial otlp json support

* self-review

* linting

* remove redundant interface

* Revert "remove redundant interface"

This reverts commit 350d40cdfe.

* fix getFloat

Co-authored-by: Tobias Bachert <git@b-privat.de>

* move withSignal into otlp-specific interface

* moving exporter/transport env handling into a new factory

* linting

* remove unused code

* tidy

* moving OtlpHttp into Otlp

* removing OtlpTransportFactoryInterface

* fix style

* fixing psalm error

* addressing review feedback

* replacing removed code

* fixing example

Co-authored-by: Tobias Bachert <git@b-privat.de>
2022-11-02 08:31:48 -04:00