Skip to content

Commit

Permalink
Merge 1.8.4 to 1.x (#968)
Browse files Browse the repository at this point in the history
* Fixed a few formatting issues (#925)

* Improved formatting in AllOptionsMetadata.php

* Improved formatting in Logger_tests.c

* Improved formatting in src/ext/log.c

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/AllComponentTestsOptionsMetadata.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/RawDataFromAgent.php

* Improved formatting in tests.ElasticApmTests.ComponentTests.ConfigSettingTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/PDOTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php (part 2)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed a few naming issues (#926)

* Improved formatting in AllOptionsMetadata.php

* Improved formatting in Logger_tests.c

* Improved formatting in src/ext/log.c

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/AllComponentTestsOptionsMetadata.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/RawDataFromAgent.php

* Improved formatting in tests.ElasticApmTests.ComponentTests.ConfigSettingTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/PDOTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php (part 2)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Renamed BootstrapStageLogger::logLevel to logWithLevel

* Renamed ELASTIC_APM_LOG_WRITE_TO_SYSLOG to ELASTIC_APM_LOG_TO_BACKGROUND_SINK

* Fixed typo in local variable name

* Added clarification in the online documentation that log_* configuration is for supportability only (#939)

* Clarified that log_* is for supportability only

* Apply suggestions from code review

Co-authored-by: Brandon Morelli <[email protected]>

---------

Co-authored-by: Brandon Morelli <[email protected]>

* Refactored some code (#927)

* Improved formatting in AllOptionsMetadata.php

* Improved formatting in Logger_tests.c

* Improved formatting in src/ext/log.c

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/AllComponentTestsOptionsMetadata.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/RawDataFromAgent.php

* Improved formatting in tests.ElasticApmTests.ComponentTests.ConfigSettingTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/PDOTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php (part 2)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Renamed BootstrapStageLogger::logLevel to logWithLevel

* Renamed ELASTIC_APM_LOG_WRITE_TO_SYSLOG to ELASTIC_APM_LOG_TO_BACKGROUND_SINK

* Fixed typo in local variable name

* Added Logger::if*LevelEnabledNoLine for all the remaining log levels

* Added ability to inherit context from LoggerFactory

* Make ArrayUtil::getValueIfKeyExists a template instead of mixed

* Added ArrayUtil::append

* Marked captureInClassicFormatExcludeElasticApm $loggerFactory as nullable

StackTraceUtil::captureInClassicFormatExcludeElasticApm

* Removed redundant type-hint

* Added ELASTIC_APM_BUILD_PHP_VERSION_ID

* Removed declaration of unused makeDynamicArray()

* Added src/ext/ArrayView.h

* Added string related utility functions

* Added string related utility functions (part 2)

* Split ConfigManager.h into multiple more manageable headers

* Split ConfigManager.h into multiple more manageable headers (part 2)

* Split ConfigManager.h into multiple more manageable headers (part 3)

* Split ConfigManager.h into multiple more manageable headers (part 4)

* Added string related utility functions (part 3)

* Split ConfigManager.h into multiple more manageable headers (part 5)

* Split big header files into multiple more manageable headers (part 6)

* Split big header files into multiple more manageable headers (part 7)

* enum LogLevel to a separate header (LogLevel.h)

* Added maxEnabledLogLevel()

* Added ELASTIC_APM_LOG_DIRECT_INFO

* Added missing include

* Added // NOLINT for ELASTIC_APM_FOR_EACH_INDEX_START_END

* Clarified structure of a header added to each allocation for track it

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h

* Extracted OptionalBool to its own header (OptionalBool.h)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 2)

* Made implicit casts explcit

* Added openFile to have "safe fopen" similar to fopen_s available on Windows

* Added openFile to have "safe fopen" similar to fopen_s available on Windows (part 2)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 3)

* Added resultBufferIsTooSmall to ResultCode

* Renamed ELASTIC_APM_CALL_EARLY_GOTO_FINALLY_WITH_SUCCESS to ELASTIC_APM_SET_RESULT_CODE_TO_SUCCESS_AND_GOTO_FINALLY

* Added ELASTIC_APM_EMPTY_STRING_VIEW instead of makeEmptyStringView so it can be used to init static

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 4)

* Split ConfigManager.h into multiple more manageable headers (part 6)

* Split ConfigManager.h into multiple more manageable headers (part 7)

* Removed unused ELASTIC_APM_PHP_PART_ON_PHP_ERROR_FUNC and ELASTIC_APM_PHP_PART_SET_LAST_THROWN_FUNC

* Split ConfigManager.h into multiple more manageable headers (part 8)

* Added ELASTIC_APM_EMPTY_STRING_VIEW instead of makeEmptyStringView so it can be used to init static (part 2)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 5)

* Added zend_string related utility functions

* Added missing include-s

* Refactored TextUtilForTests::iterateLines to allow finer control over end-of-line part

* Removed unused import (tests/ElasticApmTests/ComponentTests/Util/ResourcesClient.php)

* Replaced ComponentTestCaseBase::getMandatoryAppCodeArg + assertIs<expected type> by get<expected type>FromMap

* Removed unused import (tests/ElasticApmTests/Util/Deserialization/ServerApiSchemaValidator.php)

* Added /* in,out */ to ArrayUtilForTests::append

* Added AssertMessageBuilder::buildString

* Removed unused import (tests/ElasticApmTests/Util/TestCaseBase.php)

* DataProviderForTestBuilder: Have keys included in logged data-set

* Added MixedMap

* Made IterableUtilForTests::iterableToGenerator a function template

instead of being based on mixed type-hint

* Added comments to calls of ArrayUtilForTests::append

* Refactored TextUtilForTests::iterateLines to allow finer control over end-of-line part (part 2)

* Fixed imports in ComponentTestCaseBase.php

* Fixed incorrect merge

* Added missing include

* Added retries on "composer install" has an intermittent failure

* Log PhpUnitExtensionBase::$timestampBeforeTest when setting it

* Use TimeUtilForTests::timestampToLoggable in assertLessThanOrEqualTimestamp

* Applied runAndEscalateLogLevelOnFailure to testAllWaysToSetConfig

from ConfigSettingTest class

* Improved supportability (#941)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed incorrect merge

* Added INTERNAL_CHECKS_LEVEL to OptionNames.php

* Added maxNumberOfStackFrames as parameter to 

LoggableStackTrace::buildForCurrent instead having hardcoded

* Removed static from constructConfigManagerMetadata to have on stack trace

* Log stack trace on failed ASSERT in native part

* Set g_elasticApmDirectLogLevel* to default values so that they can be used even before configuration is parsed

* Documented that agent uses PHP's error_reporting (#938)

* Documented that agent uses PHP's error_reporting

* Reworded part of "PHP errors as APM error events" section

* Made sure all the supported configuration options are documented (#940)

* Documented that agent uses PHP's error_reporting

* Clarified that log_* is for supportability only

* Documented capture_errors

* Fixed incorrect quotes placement

* Improved description for disable_instrumentations

* Apply suggestions from code review

Co-authored-by: Brandon Morelli <[email protected]>

* Fixed merge

---------

Co-authored-by: Brandon Morelli <[email protected]>

* Update supported-technologies.asciidoc (#952)

Added Laravel 10 to the list of versions of Laravel

* Update supported-technologies.asciidoc (#952)

Added Laravel 10 to the list of versions of Laravel

* Update supported-technologies.asciidoc (#952)

Added Laravel 10 to the list of versions of Laravel

* Fixed addDelayToAbsTimeSpec for the case when (#953)

when delayInNanoseconds >= NANOSECONDS_IN_SECOND

* Extended span compression support to spans without service target (#944)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed incorrect merge

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed incorrect merge

* Added documentation for configuration options

* Added options to AllOptionsMetadata.php

* Added SPAN_COMPRESSION_* option names to OptionNames.php

* Added Span Compression options to Config/Snapshot.php

* Added COMPRESSION_STRATEGY_* constants

* Added implementation

* Added Span Compression related options to src/ext/ConfigManager.c

* Added Span Compression related options to src/ext/ConfigManager.h

* Added Span Compression related options to src/ext/elastic_apm.c

* Added Span Compression related options to tests/ElasticApmTests/ComponentTests/ConfigSettingTest.php

* MySQLiTest: Disable Span Compression feature to have all the expected spans individually

* PDOTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/ComponentTests/SpanCompressionComponentTest.php

* Clarified comment about "Disable Span Compression"

* StackTraceComponentTest: Disable Span Compression feature to have all the expected spans individually

* Added TracerUnitTestCaseBase::isCompatibleWithSpanCompression

* InferredSpansBuilderTest: Disable Span Compression feature to have all the expected spans individually

* StackTraceUnitTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/UnitTests/SpanCompressionUnitTest.php

* Added tests\ElasticApmTests\Util\AssertValidTrait::assertValidNonNullableString

* Updated ElasticApmTests\Util\SpanDto

* Updated SpanExpectations

* Removed unused imports

* Extended span compression to spans without service target

* Removed redundant comment

* Clarified docs

* Added workaround for false positives from static analysis

* Simplified parallel-lint invocation

* Fixed unit tests failing on PHP 7.2

* Fixed issue found by static analysis

* Fixed formatting

* Fixed formatting

* Added --exclude ./tests/polyfills/

* Removed TestCaseBaseShim

* Fixed failing unit test

* Added ELASTIC_APM_PHP_TESTS_IS_LONG_RUN_MODE

* Reduced number of datasets from dataProviderForTestReasonsCompressionStops

* Run testOneCompressedSequence only in isLongRunMode

* Added check for isLongRunMode dataProviderForTestReasonsCompressionStops

* Fixed static analysis issue

* Fixed failing unit tests

* Temporarily hide TransactionMaxSpansUnitTest behind isLongRunMode

* Fixed unit tests

* Added diagnostics

* Fixed failing unit tests

* Added re-run with escalated log level to HttpTransactionTest::testHttpStatus

* Fixed failing component test

* Re-enabled SpanCompressionUnitTest::testReasonsCompressionStops

* chore: Updated the content of the file "/tmp/updatecli/github/elastic... (#942)

... /apm-agent-php/tests/APM_Agents_shared/gherkin-specs/otel_bridge.feature"

Made with ❤️️ by updatecli

Co-authored-by: apmmachine <[email protected]>

* Prepare for additional instrumentation kind (#946)

* Improved formatting in AllOptionsMetadata.php

* Improved formatting in Logger_tests.c

* Improved formatting in src/ext/log.c

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/AllComponentTestsOptionsMetadata.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/Util/RawDataFromAgent.php

* Improved formatting in tests.ElasticApmTests.ComponentTests.ConfigSettingTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/PDOTest.php

* Improved formatting in tests/ElasticApmTests/ComponentTests/MySQLiTest.php (part 2)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Renamed BootstrapStageLogger::logLevel to logWithLevel

* Renamed ELASTIC_APM_LOG_WRITE_TO_SYSLOG to ELASTIC_APM_LOG_TO_BACKGROUND_SINK

* Fixed typo in local variable name

* Added Logger::if*LevelEnabledNoLine for all the remaining log levels

* Added ability to inherit context from LoggerFactory

* Make ArrayUtil::getValueIfKeyExists a template instead of mixed

* Added ArrayUtil::append

* Marked captureInClassicFormatExcludeElasticApm $loggerFactory as nullable

StackTraceUtil::captureInClassicFormatExcludeElasticApm

* Removed redundant type-hint

* Added ELASTIC_APM_BUILD_PHP_VERSION_ID

* Removed declaration of unused makeDynamicArray()

* Added src/ext/ArrayView.h

* Added string related utility functions

* Added string related utility functions (part 2)

* Split ConfigManager.h into multiple more manageable headers

* Split ConfigManager.h into multiple more manageable headers (part 2)

* Split ConfigManager.h into multiple more manageable headers (part 3)

* Split ConfigManager.h into multiple more manageable headers (part 4)

* Added string related utility functions (part 3)

* Split ConfigManager.h into multiple more manageable headers (part 5)

* Split big header files into multiple more manageable headers (part 6)

* Split big header files into multiple more manageable headers (part 7)

* enum LogLevel to a separate header (LogLevel.h)

* Added maxEnabledLogLevel()

* Added ELASTIC_APM_LOG_DIRECT_INFO

* Added missing include

* Added // NOLINT for ELASTIC_APM_FOR_EACH_INDEX_START_END

* Clarified structure of a header added to each allocation for track it

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h

* Extracted OptionalBool to its own header (OptionalBool.h)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 2)

* Made implicit casts explcit

* Added openFile to have "safe fopen" similar to fopen_s available on Windows

* Added openFile to have "safe fopen" similar to fopen_s available on Windows (part 2)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 3)

* Added resultBufferIsTooSmall to ResultCode

* Renamed ELASTIC_APM_CALL_EARLY_GOTO_FINALLY_WITH_SUCCESS to ELASTIC_APM_SET_RESULT_CODE_TO_SUCCESS_AND_GOTO_FINALLY

* Added ELASTIC_APM_EMPTY_STRING_VIEW instead of makeEmptyStringView so it can be used to init static

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 4)

* Split ConfigManager.h into multiple more manageable headers (part 6)

* Split ConfigManager.h into multiple more manageable headers (part 7)

* Removed unused ELASTIC_APM_PHP_PART_ON_PHP_ERROR_FUNC and ELASTIC_APM_PHP_PART_SET_LAST_THROWN_FUNC

* Split ConfigManager.h into multiple more manageable headers (part 8)

* Added ELASTIC_APM_EMPTY_STRING_VIEW instead of makeEmptyStringView so it can be used to init static (part 2)

* Extracted TextOutputStream_forward_decl.h from TextOutputStream.h (part 5)

* Added zend_string related utility functions

* Added missing include-s

* Refactored TextUtilForTests::iterateLines to allow finer control over end-of-line part

* Removed unused import (tests/ElasticApmTests/ComponentTests/Util/ResourcesClient.php)

* Replaced ComponentTestCaseBase::getMandatoryAppCodeArg + assertIs<expected type> by get<expected type>FromMap

* Removed unused import (tests/ElasticApmTests/Util/Deserialization/ServerApiSchemaValidator.php)

* Added /* in,out */ to ArrayUtilForTests::append

* Added AssertMessageBuilder::buildString

* Removed unused import (tests/ElasticApmTests/Util/TestCaseBase.php)

* DataProviderForTestBuilder: Have keys included in logged data-set

* Added MixedMap

* Made IterableUtilForTests::iterableToGenerator a function template

instead of being based on mixed type-hint

* Added comments to calls of ArrayUtilForTests::append

* Refactored TextUtilForTests::iterateLines to allow finer control over end-of-line part (part 2)

* Fixed imports in ComponentTestCaseBase.php

* Fixed incorrect merge

* Added missing include

* Added retries on "composer install" has an intermittent failure

* Log PhpUnitExtensionBase::$timestampBeforeTest when setting it

* Use TimeUtilForTests::timestampToLoggable in assertLessThanOrEqualTimestamp

* Applied runAndEscalateLogLevelOnFailure to testAllWaysToSetConfig

from ConfigSettingTest class

* Added INTERNAL_CHECKS_LEVEL to OptionNames.php

* Added maxNumberOfStackFrames as parameter to 

LoggableStackTrace::buildForCurrent instead having hardcoded

* Removed static from constructConfigManagerMetadata to have on stack trace

* Log stack trace on failed ASSERT in native part

* Set g_elasticApmDirectLogLevel* to default values so that they can be used even before configuration is parsed

* Added documentation for configuration options

* Added options to AllOptionsMetadata.php

* Added SPAN_COMPRESSION_* option names to OptionNames.php

* Added Span Compression options to Config/Snapshot.php

* Added COMPRESSION_STRATEGY_* constants

* Added implementation

* Added Span Compression related options to src/ext/ConfigManager.c

* Added Span Compression related options to src/ext/ConfigManager.h

* Added Span Compression related options to src/ext/elastic_apm.c

* Added Span Compression related options to tests/ElasticApmTests/ComponentTests/ConfigSettingTest.php

* MySQLiTest: Disable Span Compression feature to have all the expected spans individually

* PDOTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/ComponentTests/SpanCompressionComponentTest.php

* Clarified comment about "Disable Span Compression"

* StackTraceComponentTest: Disable Span Compression feature to have all the expected spans individually

* Added TracerUnitTestCaseBase::isCompatibleWithSpanCompression

* InferredSpansBuilderTest: Disable Span Compression feature to have all the expected spans individually

* StackTraceUnitTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/UnitTests/SpanCompressionUnitTest.php

* Added tests\ElasticApmTests\Util\AssertValidTrait::assertValidNonNullableString

* Updated ElasticApmTests\Util\SpanDto

* Updated SpanExpectations

* Added optional dbgParamName for better diagnostics

* Distinguish between plugin name and keywords

Both name and keywords can be used to disable a plugin

* Removed unused imports

* Added 'internal-func' to names related to existing instrumentation (part 2)

to distinguish from other instrumentation mechanisms (for example the upcoming AST processing based)

* Added 'internal-func' to names related to existing instrumentation (part 3)

to distinguish from other instrumentation mechanisms (for example the upcoming AST processing based)

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed incorrect merge

* Reverted references of ELASTIC_APM_EMPTY_STRING_VIEW back to makeEmptyStringView()

since ELASTIC_APM_EMPTY_STRING_VIEW is added in a later PR

* Fixed incorrect merge

* Added documentation for configuration options

* Added options to AllOptionsMetadata.php

* Added SPAN_COMPRESSION_* option names to OptionNames.php

* Added Span Compression options to Config/Snapshot.php

* Added COMPRESSION_STRATEGY_* constants

* Added implementation

* Added Span Compression related options to src/ext/ConfigManager.c

* Added Span Compression related options to src/ext/ConfigManager.h

* Added Span Compression related options to src/ext/elastic_apm.c

* Added Span Compression related options to tests/ElasticApmTests/ComponentTests/ConfigSettingTest.php

* MySQLiTest: Disable Span Compression feature to have all the expected spans individually

* PDOTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/ComponentTests/SpanCompressionComponentTest.php

* Clarified comment about "Disable Span Compression"

* StackTraceComponentTest: Disable Span Compression feature to have all the expected spans individually

* Added TracerUnitTestCaseBase::isCompatibleWithSpanCompression

* InferredSpansBuilderTest: Disable Span Compression feature to have all the expected spans individually

* StackTraceUnitTest: Disable Span Compression feature to have all the expected spans individually

* Added tests/ElasticApmTests/UnitTests/SpanCompressionUnitTest.php

* Added tests\ElasticApmTests\Util\AssertValidTrait::assertValidNonNullableString

* Updated ElasticApmTests\Util\SpanDto

* Updated SpanExpectations

* Removed unused imports

* Extended span compression to spans without service target

* Removed redundant comment

* Clarified docs

* Added workaround for false positives from static analysis

* Simplified parallel-lint invocation

* Fixed unit tests failing on PHP 7.2

* Fixed issue found by static analysis

* Fixed formatting

* Fixed formatting

* Added --exclude ./tests/polyfills/

* Removed TestCaseBaseShim

* Fixed failing unit test

* Added ELASTIC_APM_PHP_TESTS_IS_LONG_RUN_MODE

* Reduced number of datasets from dataProviderForTestReasonsCompressionStops

* Run testOneCompressedSequence only in isLongRunMode

* Added check for isLongRunMode dataProviderForTestReasonsCompressionStops

* Fixed static analysis issue

* Fixed failing unit tests

* Removed unused import

* Fixed merge

* Fixed merge

* Fixed merge

* Fixed merge

* Temporarily hide TransactionMaxSpansUnitTest behind isLongRunMode

* Fixed unit tests

* Added diagnostics

* Fixed failing unit tests

* Added re-run with escalated log level to HttpTransactionTest::testHttpStatus

* Fixed failing component test

* Re-enabled SpanCompressionUnitTest::testReasonsCompressionStops

* Fixed merge

* Fixed line endings

* Fixed line endings (CRLF -> LF) (#956)

* Fixed not joining background sender thread if there was fork after module init (#959)

* Fixed line endings (CRLF -> LF)

* Fixed not joining background sender thread if there was fork

Fixed not joining background sender thread if there was fork after module init

* Fixed not cleaning up connection data in sync backend comm. mode (#957)

* Fixed line endings (CRLF -> LF)

* Fixed not cleaning up connection data in sync backend comm. mode

* Fixed registration of pthread_atfork handlers (876) (#964)

* Fixed verify_server_cert=false not disabling all the checks related to HTTPS certificate (#965)

* Fixed verify_server_cert=false not disabling all the checks

* Removed setting CURLOPT_SSL_VERIFYSTATUS to 0 since 0 is the default

* Prevent deadloop in exception and error handlers (#955)

* added logging in case of potential deadloop
 * moved hook registration into MINIT/MSHUTDOWN

* Prepared for 1.8.4 release (#967)

---------

Co-authored-by: Brandon Morelli <[email protected]>
Co-authored-by: Peter Steenbergen <[email protected]>
Co-authored-by: apmmachine <[email protected]>
Co-authored-by: apmmachine <[email protected]>
Co-authored-by: Pawel Filipczak <[email protected]>
  • Loading branch information
6 people authored May 18, 2023
1 parent e77e856 commit 8a18c84
Show file tree
Hide file tree
Showing 267 changed files with 9,777 additions and 4,629 deletions.
21 changes: 20 additions & 1 deletion .ci/validate_agent_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ function runComponentTests () {
exit ${composerCommandExitCode}
}

function runPhpCoposerInstall () {
local run_command_with_timeout_and_retries_args=(--max-tries=3)
run_command_with_timeout_and_retries_args=(--retry-on-error=yes "${run_command_with_timeout_and_retries_args[@]}")
local initialTimeoutInMinutes=5
local initialTimeoutInSeconds=$((initialTimeoutInMinutes*60))
run_command_with_timeout_and_retries_args=(--timeout="${initialTimeoutInSeconds}" "${run_command_with_timeout_and_retries_args[@]}")
run_command_with_timeout_and_retries_args=(--increase-timeout-exponentially=yes "${run_command_with_timeout_and_retries_args[@]}")
run_command_with_timeout_and_retries_args=(--wait-time-before-retry="${initialTimeoutInSeconds}" "${run_command_with_timeout_and_retries_args[@]}")

set +e
.ci/run_command_with_timeout_and_retries.sh "${run_command_with_timeout_and_retries_args[@]}" -- composer install
local composerCommandExitCode=$?
set -e

if [ ${composerCommandExitCode} -ne 0 ] ; then
exit ${composerCommandExitCode}
fi
}

function main () {
thisScriptDir="$( dirname "${BASH_SOURCE[0]}" )"
thisScriptDir="$( realpath "${thisScriptDir}" )"
Expand All @@ -72,7 +91,7 @@ function main () {
export ELASTIC_APM_ENABLED=false

# Install 3rd party dependencies
composer install
runPhpCoposerInstall

printInfoAboutEnvironment

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ endif::[]
// Using the template above, release notes go here.
// CHANGELOG_AUTOMATION_KEYWORD
[[release-notes-v1.8.4]]
=== v1.8.4 - 2023/05/17
[float]
==== Bug fixes
* Fixed deadlock caused by use of pthread_atfork {pull}964[#964]
* Fixed verify_server_cert=false not disabling all the checks related to HTTPS certificate {pull}965[#965]
* Fixed not joining background sender thread if there was fork after module init {pull}959[#959]
[[release-notes-v1.8.3]]
=== v1.8.3 - 2023/04/21
[float]
Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
"justinrainbow/json-schema": "^5.2.12",
"monolog/monolog": "^2.7",
"php-ds/php-ds": "^1.4.1",
"phpstan/phpstan": "1.10.2",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phpstan/phpstan": "1.10.14",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpunit/phpunit": "^8.5||^9.5",
"react/http": "^1.6",
"slevomat/coding-standard": "8.11.1",
"squizlabs/php_codesniffer": "3.7.2"
},
"suggest": {
Expand All @@ -47,9 +50,15 @@
},
"config": {
"process-timeout": 0,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"parallel-lint": [
"parallel-lint ./src/ElasticApm/ ./tests/ --exclude ./tests/polyfills/"
],
"php_codesniffer_check": [
"phpcs -s ./src/ElasticApm/",
"phpcs -s ./tests/",
Expand All @@ -71,6 +80,7 @@
"phpstan analyse -c ./phpstan.neon ./examples/ --level max --memory-limit=1G"
],
"static_check": [
"composer run-script -- parallel-lint",
"composer run-script -- php_codesniffer_check",
"composer run-script -- phpstan"
],
Expand Down
160 changes: 155 additions & 5 deletions docs/configuration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,29 @@ elastic_apm.secret_token=TOKEN
elastic_apm.service_name=SERVICE_NAME
----

[float]
[[configure-apm-data-amount]]
=== Control the amount of APM data emitted by the agent
The following configuration settings control the amount of APM data emitted by the agent.
They can be tuned to reduce the agent overhead on the monitored application,
network utilization, and the amount of storage required by {es}.

- <<config-transaction-sample-rate>>
- <<config-breakdown-metrics>>
- <<configure-php-error-reporting>>
- <<config-capture-errors>>

[float]
[[configure-logging]]
=== Logging

NOTE: Configuration settings described in this section are related to logs emitted by the agent itself
and not the logs emitted by the monitored application.
The intended use case for these configuration settings is for the agent's supportability.
The logs emitted by the agent are not stored in Elasticsearch by default,
so reducing the level for these logs will not reduce the amount of storage used in Elasticsearch--
see <<configure-apm-data-amount>> instead.

The easiest way to configure the logging is by using the <<config-log-level-syslog>> configuration option.

Available log levels are:
Expand Down Expand Up @@ -88,6 +107,16 @@ elastic_apm.log_level=WARNING
elastic_apm.log_level_syslog=TRACE
----

[float]
[[configure-php-error-reporting]]
=== PHP errors as APM error events
The agent automatically creates APM error events for PHP errors triggered by the monitored application.
APM error events are created only for PHP errors which level is included in
PHP https://www.php.net/manual/en/function.error-reporting.php[`error_reporting`] setting.

In addition <<config-capture-errors>> configuration option controls
if the agent captures any PHP errors.

[float]
[[configure-duration-format]]
=== Duration format
Expand Down Expand Up @@ -149,8 +178,8 @@ Examples: `*foo*`, `/foo/*/bar, /*/baz*`.

Matching is case insensitive by default.
Prepending an element with `(?-i)` makes the matching case sensitive.
For example `(?-i)/bar, /foo` matches /bar` and `/FOO` `but it doesn't match `/BAR`
on the other hand `(?-i)/bar, (?-i)/foo` matches `/bar` and `/foo`
For example `(?-i)/bar, /foo` matches `/bar` and `/FOO` but it doesn't match `/BAR`.
On the other hand `(?-i)/bar, (?-i)/foo` matches `/bar` and `/foo`
but doesn't match neither `/BAR` nor `/FOO`.

Whitespace around commas separating wildcard expressions in the list is ignored.
Expand Down Expand Up @@ -223,6 +252,28 @@ breakdown metrics, which can reduce the overhead of the agent.

NOTE: This feature requires APM Server and Kibana >= 7.3.

[float]
[[config-capture-errors]]
==== `capture_errors`

[options="header"]
|============
| Environment variable name | Option name in `php.ini`
| `ELASTIC_APM_CAPTURE_ERRORS` | `elastic_apm.capture_errors`
|============

[options="header"]
|============
| Default | Type
| true | Boolean
|============

If this configuration option is set to `true` the agent will collect and report error events.
Set it to `false` to disable the collection and reporting of APM
error events, which can reduce the overhead of the agent.

Also see <<configure-php-error-reporting>>.

[float]
[[config-disable-instrumentations]]
==== `disable_instrumentations`
Expand All @@ -242,10 +293,25 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
A comma-separated list of wildcard expressions to match
instrumentation names which should be disabled.
When an instrumentation is disabled, no spans will be created for that instrumentation.
An instrumentation may match more than one name -
for example PDO instrumentation matches both `db` and `pdo`.
Each instrumentation has a name and any number of keywords.
If the instrumentation's name or any of its keywords match this configuration option
then the instrumentation is disabled.

See <<configure-wildcard>> for more details on how to use wildcard expressions.

Supported instrumentations:
[options="header"]
|============
| Name | Keywords
| `curl` | `HTTP-client`
| `PDO` | `DB`
| `MySQLi` | `DB`
|============

Valid instrumentation names are `curl`, `db`, `http-client`, `pdo`.
Examples:

- `db` disables both PDO and MySQLi instrumentations
- `*HTTP*` disables curl instrumentation

[float]
[[config-disable-send]]
Expand Down Expand Up @@ -531,6 +597,90 @@ The version of the currently deployed service. If your deployments are not versi
the recommended value for this field is the commit identifier of the deployed revision, e.g.,
the output of git rev-parse HEAD.

[float]
[[config-span-compression-enabled]]
==== `span_compression_enabled`

[options="header"]
|============
| Environment variable name | Option name in `php.ini`
| `ELASTIC_APM_SPAN_COMPRESSION_ENABLED` | `elastic_apm.span_compression_enabled`
|============

[options="header"]
|============
| Default | Type
| true | Boolean
|============

Setting this option to true will enable span compression feature.
Span compression reduces the collection, processing, and storage overhead,
and removes clutter from the UI.
The tradeoff is that some information
such as DB statements of all the compressed spans will not be collected.

[float]
[[config-span-compression-exact-match-max-duration]]
==== `span_compression_exact_match_max_duration`

[options="header"]
|============
| Environment variable name | Option name in `php.ini`
| `ELASTIC_APM_SPAN_COMPRESSION_EXACT_MATCH_MAX_DURATION` | `elastic_apm.span_compression_exact_match_max_duration`
|============

[options="header"]
|============
| Default | Type
| `50ms` | Duration
|============

Consecutive spans that are exact match and that are under this threshold
will be compressed into a single composite span.
This option does not apply to composite spans.
This reduces the collection, processing, and storage overhead,
and removes clutter from the UI.
The tradeoff is that the DB statements of all the compressed spans will not be collected.

Since it is *max* duration threshold setting this configuration option to 0
effectively disables this compression strategy
because only spans with duration 0 will be considered eligible for compression with this strategy.

This configuration option supports the duration suffixes: `ms`, `s` and `m`.
For example: `10ms`.
This option's default unit is `ms`, so `5` is interpreted as `5ms`.

[float]
[[config-span-compression-same-kind-max-duration]]
==== `span_compression_same_kind_max_duration`

[options="header"]
|============
| Environment variable name | Option name in `php.ini`
| `ELASTIC_APM_SPAN_COMPRESSION_SAME_KIND_MAX_DURATION` | `elastic_apm.span_compression_same_kind_max_duration`
|============

[options="header"]
|============
| Default | Type
| `0ms` | Duration
|============

Consecutive spans to the same destination that are under this threshold
will be compressed into a single composite span.
This option does not apply to composite spans.
This reduces the collection, processing, and storage overhead,
and removes clutter from the UI.
The tradeoff is that the DB statements of all the compressed spans will not be collected.

Since it is *max* duration threshold setting this configuration option to 0
effectively disables this compression strategy
because only spans with duration 0 will be considered eligible for compression with this strategy.

This configuration option supports the duration suffixes: `ms`, `s` and `m`.
For example: `10ms`.
This option's default unit is `ms`, so `5` is interpreted as `5ms`.

[float]
[[config-transaction-ignore-urls]]
==== `transaction_ignore_urls`
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[[release-notes]]
== Release notes

* <<release-notes-v1.8.4>>
* <<release-notes-v1.8.3>>
* <<release-notes-v1.8.2>>
* <<release-notes-v1.8.1>>
Expand Down
9 changes: 8 additions & 1 deletion docs/supported-technologies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ We support automatic instrumentation for the following web frameworks.
|

|Laravel
|6, 7, 8, 9
|6, 7, 8, 9, 10

|===

Expand Down Expand Up @@ -76,3 +76,10 @@ The spans are named after the schema `<method> <host>`, for example `GET elastic
|

|===

[float]
[[supported-php-errors]]
=== Capturing PHP errors as APM error events

The agent automatically creates APM error events for PHP errors triggered by the monitored application.
See <<configure-php-error-reporting>> for the relevant configuration settings.
12 changes: 12 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
</properties>
</rule>

<config name="installed_paths" value="../../slevomat/coding-standard"/>

<!-- https://github.com/slevomat/coding-standard/blob/master/doc/namespaces.md#slevomatcodingstandardnamespacesunuseduses- -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<!-- searchAnnotations (defaults to false): enables searching for class names in annotations. -->
<property name="searchAnnotations" value="true"/>
</properties>
</rule>

<!-- other sniffs to include -->

<exclude-pattern>*/polyfills/Stringable.php</exclude-pattern>
<exclude-pattern>*/polyfills/WeakMap.php</exclude-pattern>
</ruleset>
5 changes: 1 addition & 4 deletions src/ElasticApm/DistributedTracingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public function serializeToString(): string
*/
public function injectHeaders(Closure $headerInjector): void
{
$headerInjector(
HttpDistributedTracing::TRACE_PARENT_HEADER_NAME,
HttpDistributedTracing::buildTraceParentHeader($this)
);
$headerInjector(HttpDistributedTracing::TRACE_PARENT_HEADER_NAME, HttpDistributedTracing::buildTraceParentHeader($this));
}
}
2 changes: 1 addition & 1 deletion src/ElasticApm/ElasticApm.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class ElasticApm
{
use StaticClassTrait;

public const VERSION = '1.8.3';
public const VERSION = '1.8.4';

/**
* Begins a new transaction and sets it as the current transaction.
Expand Down
Loading

0 comments on commit 8a18c84

Please sign in to comment.