Skip to content

Commit

Permalink
define default values for additional config vars
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc committed Mar 5, 2024
1 parent 0ab6c54 commit 98ba719
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Config/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

/**
* Configuration can come from one or more of the following sources (from highest to lowest priority):
* - values defined in php.ini
* - environment variable (getenv, $_SERVER)
* - values defined in php.ini
* - configuration file (todo)
*/
class Configuration
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ interface Defaults
public const OTEL_PHP_DISABLED_INSTRUMENTATIONS = [];
public const OTEL_PHP_LOGS_PROCESSOR = 'batch';
public const OTEL_PHP_LOG_DESTINATION = 'default';
public const OTEL_PHP_DEBUG_SCOPES_DISABLED = 'false';
public const OTEL_PHP_FIBERS_ENABLED = 'false';
}
2 changes: 1 addition & 1 deletion src/Context/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function activate(): ScopeInterface

private static function debugScopesDisabled(): bool
{
return Configuration::getBoolean(Variables::OTEL_PHP_DEBUG_SCOPES_DISABLED, false);
return Configuration::getBoolean(Variables::OTEL_PHP_DEBUG_SCOPES_DISABLED);
}

public function withContextValue(ImplicitContextKeyedInterface $value): ContextInterface
Expand Down
6 changes: 3 additions & 3 deletions src/Context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ It is recommended to use a `try-finally` statement after `::activate()` to ensur
### Debug scopes

By default, scopes created by `::activate()` warn on invalid and missing calls to `::detach()` in non-production
environments. This feature can be disabled by setting the environment variable `OTEL_PHP_DEBUG_SCOPES_DISABLED` to a
truthy value. Disabling is only recommended for applications using `exit` / `die` to prevent unavoidable notices.
environments. This feature can be disabled by setting the environment variable `OTEL_PHP_DEBUG_SCOPES_DISABLED` to `true`.
Disabling is only recommended for applications using `exit` / `die` to prevent unavoidable notices.

## Async applications

### Fiber support

Requires `PHP >= 8.1`, an NTS build, `ext-ffi`, and setting the environment variable `OTEL_PHP_FIBERS_ENABLED` to a truthy value. Additionally `vendor/autoload.php` has to be preloaded for non-CLI SAPIs if [`ffi.enable`](https://www.php.net/manual/en/ffi.configuration.php#ini.ffi.enable) is set to `preload`.
Requires `PHP >= 8.1`, an NTS build, `ext-ffi`, and setting the environment variable `OTEL_PHP_FIBERS_ENABLED` to `true`. Additionally `vendor/autoload.php` has to be preloaded for non-CLI SAPIs if [`ffi.enable`](https://www.php.net/manual/en/ffi.configuration.php#ini.ffi.enable) is set to `preload`.

### Event loops

Expand Down
2 changes: 1 addition & 1 deletion src/Context/ZendObserverFiber.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ZendObserverFiber
{
public static function isEnabled(): bool
{
return Configuration::getBoolean(Variables::OTEL_PHP_FIBERS_ENABLED, false);
return Configuration::getBoolean(Variables::OTEL_PHP_FIBERS_ENABLED);
}

public static function init(): bool
Expand Down

0 comments on commit 98ba719

Please sign in to comment.