Commit Graph

712 Commits

Author SHA1 Message Date
Bob Strecansky 104aa74e34 Add API Docs to README.md 2024-11-06 13:22:16 +00:00
Severin Neumann ea908b161d
Rename phpdoc-to-github-pages to phpdoc-to-github-pages.yml (#1425)
- follow up to #1418, where I named the file without the required YML suffix
- Do not run on pull requests
2024-11-05 20:38:15 +11:00
Aleksei Gagarin 39cc549f04
Support google protobuf v4 (#1421) 2024-10-30 22:49:49 +11:00
Severin Neumann 1aae9dd619
Workflow to publish phpdoc to github pages (#1418) 2024-10-28 08:27:02 +11:00
znerol 93f2068d0b
fix start timestamp in auto root span (#1413) 2024-10-19 08:01:35 +11:00
Mark van Duijker fd654b99c7
fix: Guzzle version 6 error in Http Client Discovery (#1409) 2024-10-17 20:58:13 +11:00
Brett McBride d2b15077df
use weaver to generate semconv (#1398)
update semconv generation to use the new tooling. This is fairly close to a 1:1 of what we have now,
although I noted a couple of TODOs which we might consider in future to align with what Java is
doing: split attribute up into file-per-type, and split stable/unstable.
2024-10-17 20:57:37 +11:00
Brett McBride 01d0fd3618
ensure zipkin tags and attributes are cast to strings (#1406) 2024-10-16 08:03:20 -04:00
Tobias Bachert 2c1da9aaec
Add `TextMapPropagator` to instrumentation context (#1401) 2024-10-16 09:42:37 +11:00
Brett McBride c632d960a5
check for readable host id files before read (#1400)
* check for readable host id files before read
* reset vfs between tests
2024-10-16 09:42:15 +11:00
Tobias Bachert f29277abc0
Move hook manager registration to API package (#1402)
Keeping registration in SDK to not break API >1.1.0 w/ SDK 1.1.0.
2024-10-14 09:16:24 +11:00
Chris Lightfoot-Wild cd8c0e3124
Fix HookManagerInterface annotation (#1395)
* Align OpenTelemetry\API\Instrumentation\AutoInstrumentation\HookManagerInterface::hook signatures with OpenTelemetry\Instrumentation\hook.

Co-authored-by: Tobias Bachert <git@b-privat.de>
2024-10-05 16:00:52 +10:00
Brett McBride 0ae272373d
84 implicit null (#1394)
* 8.4: fixing some implicit nullable params

* fix withspan handler nullable + example (#1377)

- class is nullable for pre hooks
- add phpt tests for withspan and its interaction with auto root span

* fix: update references to logging exporter (#1383)

This exporter has been replaced by the debug exporter and will be removed soon. Related to https://github.com/open-telemetry/opentelemetry-collector/pull/11037

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* fix: Update collector tag in example to latest (#1384)

Follow-up from #1383. Debug exporter isn't available until v0.86.0, so this new configuration throws an error when trying to run the collector. `Error: cannot unmarshal the configuration: unknown exporters type "debug" for "debug"` Instead of setting to v0.86.0, I noticed the other docker files omitted the tag (so latest is pulled). I just updated this to match.

* Remove `MeterInterface::isEnabled()` and fix meter config re-enabling (#1387)

* Update SPI dependency to v1. (#1388)

* Fix README badges. (#1389)

* add phpDocumentor instructions to Makefile (#1385)

* add phpDocumentor instructions to Makefile

Signed-off-by: svrnm <neumanns@cisco.com>

* update DEVELOPMENT.md

Signed-off-by: svrnm <neumanns@cisco.com>

---------

Signed-off-by: svrnm <neumanns@cisco.com>

* Update README.md (#1344)

* Fix `IncompatibleReturnValueException` in `MessageFactoryTest` (#1392)

PSR7 `RequestInterface::getUri()` must return `UriInterface`, not `string`; explicit typehint was added in `2.0`.

* more implicit nulls

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: svrnm <neumanns@cisco.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
Co-authored-by: Tobias Bachert <git@b-privat.de>
Co-authored-by: Chris Lightfoot-Wild <github-clw@wild.me.uk>
Co-authored-by: Severin Neumann <neumanns@cisco.com>
Co-authored-by: Oleg <142805497+devactivity-team@users.noreply.github.com>
2024-10-02 08:06:03 -04:00
Tobias Bachert fd24607c10
Fix `IncompatibleReturnValueException` in `MessageFactoryTest` (#1392)
PSR7 `RequestInterface::getUri()` must return `UriInterface`, not `string`; explicit typehint was added in `2.0`.
2024-09-29 22:12:53 +10:00
Oleg 20bf3cff3e
Update README.md (#1344) 2024-09-25 14:40:03 -04:00
Severin Neumann 91f4735b3a
add phpDocumentor instructions to Makefile (#1385)
* add phpDocumentor instructions to Makefile

Signed-off-by: svrnm <neumanns@cisco.com>

* update DEVELOPMENT.md

Signed-off-by: svrnm <neumanns@cisco.com>

---------

Signed-off-by: svrnm <neumanns@cisco.com>
2024-09-25 14:39:36 -04:00
Chris Lightfoot-Wild 7d744e0086
Fix README badges. (#1389) 2024-09-25 21:59:48 +10:00
Chris Lightfoot-Wild 439447b286
Update SPI dependency to v1. (#1388) 2024-09-25 21:54:21 +10:00
Tobias Bachert 6a2242d46a
Remove `MeterInterface::isEnabled()` and fix meter config re-enabling (#1387) 2024-09-25 09:58:09 +10:00
Jamie Danielson 8ed62b1e43
fix: Update collector tag in example to latest (#1384)
Follow-up from #1383. Debug exporter isn't available until v0.86.0, so this new configuration throws an error when trying to run the collector. `Error: cannot unmarshal the configuration: unknown exporters type "debug" for "debug"` Instead of setting to v0.86.0, I noticed the other docker files omitted the tag (so latest is pulled). I just updated this to match.
2024-09-24 08:35:18 +10:00
Alex Boten 3be58cff57
fix: update references to logging exporter (#1383)
This exporter has been replaced by the debug exporter and will be removed soon. Related to https://github.com/open-telemetry/opentelemetry-collector/pull/11037

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-09-22 17:42:55 +10:00
Brett McBride 068086347b
fix withspan handler nullable + example (#1377)
- class is nullable for pre hooks
- add phpt tests for withspan and its interaction with auto root span
2024-09-07 08:51:46 +10:00
Brett McBride bee9c64ae9
adding auto-instrumentation attribute to API (#1371)
adding WithSpan and SpanAttribute attributes to the API. These attributes
are used by an upcoming feature in auto-instrumentation which allows users
to add attributes to their code to enable auto-instrumentation.
2024-08-31 09:17:53 +10:00
Brett McBride 4fc170002d
re-adding removed trace attribute values (#1368)
the MESSAGING_OPERATION_* attribute values were removed in semconv 1.26.0,
so update our generation to put them back, marking as deprecated
2024-08-28 19:20:31 +10:00
Brett McBride 653e453f95
adding config provider (#1366)
implement recent additions to the otel spec re: config provider. Config provider should return a
ConfigProperties, but we were already returning a ConfigurationRegistry. Added a ConfigProperties
interface for ConfigurationRegistry to implement, which gets us pretty close to spec.
We don't make ConfigProvider globally available, instead passing the ConfigurationRegistry in to
each instrumentation as we register it. The spec allows for this.
2024-08-27 09:28:08 +10:00
Brett McBride f4b52c4b49
add minimal auto-instrumentation hook functions (#1358)
add OpenTelemetry\API\Instrumentation\WithSpanHandler, which will be the default pre/post
hook callbacks for attribute-based auto-instrumentation.
2024-08-26 11:17:16 +10:00
Brett McBride 5276df3171
auto root span creation (#1354)
* auto root span creation
proof of concept for automatically creating a root span on startup.
the obvious deficiencies are:
- no idea of response values (status code etc)
- does not capture exceptions

* deptrac
2024-08-23 09:15:18 -04:00
Brett McBride 69825d395a
fix implicit null usage (#1362)
php8.4 deprecates implicit null (now checked by phan)
2024-08-21 10:29:20 +10:00
Luc 80e97da6eb
Allow 'google/protobuf' '^4.0' to be used. (#1361) 2024-08-18 21:02:08 +10:00
Brett McBride 41dd113030
implement scope configuration (#1353) 2024-08-18 20:52:43 +10:00
Brett McBride 382331e062
semconv 1.27.0 (#1356)
* generate semconv 1.27.0

* improve attribute values brief and deprecation display

* remove duplicate trace attribute, ignore deprecated attributes

* fix tests
2024-08-06 11:17:39 -04:00
Brett McBride d2ec5e6d0b
add enabled to late binding logger and tracer (#1357) 2024-08-06 07:58:59 -04:00
Brett McBride 10b8d9732b
adding LocalRootSpan (#1310)
* adding LocalRootSpan class
this is based on Java's implementation, https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v2.3.0/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/LocalRootSpan.java
and adds the ability to identify and locate the "local root span" in a trace. The local root span is the top-level active span which has either
an invalid or remote parent.
It's tracked automatically as part of making a span active, either via `Span::activate()` or `Span::storeInContext()`, and can be retrieved in
a couple of ways, but most easily via `LocalRootSpan::current()`.

* remove redundant local root span check

* move context key to api

* internal

* adding example

* mark LocalRootSpan as experimental

* adding an example of local root span usage

* style, fix broken build
2024-08-06 07:58:33 -04:00
Brett McBride 68b1b43cab
auto-instrumentation registration (#1304)
* [WIP] Add instrumentation configuration

* add autoloading for auto-instrumentations using SPI

* allow autoloading and non-autoloading to work

* fix attribute

* experimental config file

* fixing invalid dependencies
- deptrac was rightly complaining that API (indirectly) depended on SDK through config/sdk. For now,
remove usage of Config\SDK\Configuration\Context
- update deptrac config to allow some new dependencies

* dont register hook manager globally or in sdk

* remove unused function, psalm ignore missing extension function

* possibly fixing type-hint
psalm doesn't complain now, so that should be good

* load config files relative to cwd

* fixing hook manager enable/disable + psalm complaints

* fixing 8.1 psalm error

* use context to pass providers to instrumentations
- make "register global" a function of Sdk, but keep the sdk builder's interface intact
- invent an API instrumentation context, similar to the one in config/sdk, to pass providers
  to instrumentations
- add an initial test of autoloading from a config file

* adding tests for sdk::registerGlobal
in passing, remove some dead code for handling invalid booleans - config already handles this correctly

* linting

* test coverage for globals

* add opentelemetry extension to developer image and actions

* always register instrumentations via SPI

* register globals initializer for file-config sdk
allow SDK created from config file to coexist with components using globals initializer

* linting

* remove globals init function

* fix phan warning

* simplify hook manager
- drop storage from hook manager: can't guarantee that something else, eg swoole, won't modify storage
- drop context from hook manager: we must lazy-load globals via initializers, because not all instrumentations use SPI (although that may change in future)
- default hook manager to enabled

* add todo to deprecate Registry in future

* autoload instrumentations without config
if no config provided, still try to load them. wrap registration in a try/catch/log

* fixing phan ref, update doc

* remove phan suppress

* fix example

* bump SPI to 0.2.1

* adding late-binding tracer+provider
per review from Nevay, this will allow instrumentations to get things from Globals as late as possible

* adding late binding logger and meter providers

* more late binding test coverage

* tidy

* dont use CoversMethod yet
not available in phpunit 10, so comment out and leave a todo

* kitchen sink, remove unused var

* instrumentation config as a map, per config file spec

* adding general config

* move general config into sdk

* test config caching

* move general instrumentation config to api

* avoid bad version of sebastian/exporter

* bump config yaml files to 0.3

* fix tests

* disable hook manager during file-based init

* cleanup

* support multiple config files in autoloader

* move hook manager enable/disable out of extension hook manager
The most obvious place to do this is in a class named HookManager, which _was_ an
interface for hook managers. Rename existing HookManager to HookManagerInterface,
then re-purpose HookManager for globally enabling/disabling hook managers as well
as determining the disabled status.

* update spi config

---------

Co-authored-by: Tobias Bachert <git@b-privat.de>
2024-07-22 10:40:34 -04:00
Brett McBride 4ed0d870f7
add enabled functions (#1350)
* add enabled function
spec 1.34 requires logger, tracer, and instrument to have an enabled function

* Update src/API/Metrics/Instrument.php

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

* adjust instrument enabled logic

---------

Co-authored-by: Tobias Bachert <git@b-privat.de>
2024-07-19 10:28:32 -04:00
Brett McBride 1271f1ed69
add return type hints (#1351)
now that 7.4 and 8.0 support is dropped, we can add correct return type-hints
to these functions, and remove the ReturnTypeWillChange attribute.
2024-07-19 09:33:49 -04:00
Brett McBride e4f9604411
remove deprecated rector rule (#1352)
this silences a rector warning which was breaking local build
2024-07-19 09:30:29 -04:00
Cedric Ziel 17ad56a3f3
Add linux/arm64 to base images support M3 devices (#1343) 2024-07-05 17:14:50 -04:00
Brett McBride a822c455a4
update semconv to 1.26.0 (#1316)
note that `messaging.client_id` was renamed to `messaging.client.id`, which causes a conflict in const name.
The recommendation from semconv maintainers is to replace the old value, `messaging.client_id`.
2024-06-28 11:51:36 +10:00
Brett McBride 36f29a37cb
fixing implicit nullable deprecations, bump GH actions (#1340)
* implicit nullable parameters are deprecated in 8.4, so make them explicit
* update github actions versions
2024-06-28 11:44:08 +10:00
Brett McBride b6f9afb5af
log discarded span+log attributes (#1336)
The SDK should log a warning once if there are any dropped span attributes, links, link attributes, events or event attributes.
The SDK should log a warning once if there are any dropped LogRecord attributes.
2024-06-27 08:52:30 +10:00
Brett McBride a90f18cc72
event logger spec compliance (#1335)
update event logger to conform to spec 1.34.0:
- implement ForceFlush, which delegates to the LoggerProvider
- rename event payload to body
2024-06-26 15:34:36 +10:00
Brett McBride fc28032748
handle empty encoded responses (#1337)
at least one otel backend product sends an empty response with a gzip encoding, which we fail to decode (because
an empty string is not valid). Work around this by not trying to decode an empty value.
2024-06-20 09:44:40 +10:00
Matt Hensley 6bf422c0f1
Adds experimental service.instance.id resource detector (#1309)
* implement experimental service.instance.id attribute
2024-06-15 12:09:33 +10:00
Bart Reunes eebf23a21d
Add return types for ArrayAccess in docblocks (#1319) 2024-06-05 08:04:47 -04:00
David Grayston 600d8a5f53
Fix logs exporter factory exception message (#1318) 2024-06-03 09:14:46 -04:00
Chris Lightfoot-Wild 39f81a3cc6
Updated link to 3musketeers site. (#1315) 2024-05-22 09:40:03 +10:00
Brett McBride eaba9e3228
conflict with mockery 1.6.12 (#1313) 2024-05-21 14:27:12 +10:00
Brett McBride fbdb103590
upgrade to phpunit 11 (#1308)
* run unit tests in random order
running in random order highlights some interference between tests (mostly logging being enabled), and is a requirement for
mutation testing (ie, all tests must pass when executed in a random order).
* adding infection mutation testing
this adds the ability to run infection. It generates a lot of output, which is an exercise for another PR...
* replace assertwell/phpunit-global-state
the package was not compatible with phpunit 11. create out own test Trait, which handles
env vars, as well as general cleanup of the usual suspects of state that our tests mess up
* remove redundant tearDown functions
there's an after annotation on the trait to handle this
* use rector to upgrade tests for phpunit 11
* fixing CoversFunction for namespaced functions
* use FQNs in test attributes
2024-05-16 09:21:28 +10:00
Brett McBride 4f32817065
Add infection test tool (#1306)
* run unit tests in random order
running in random order highlights some interference between tests (mostly logging being enabled), and is a requirement for
mutation testing (ie, all tests must pass when executed in a random order).
* adding infection mutation testing
this adds the ability to run infection. It generates a lot of output, which is an exercise for another PR...
* infection max threads
2024-05-15 20:46:42 +10:00