Skip to content

Commit

Permalink
Use 'Elastic Distribution for OpenTelemetry PHP' product name (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: Emily S <[email protected]>
  • Loading branch information
intuibase and estolfo authored Jul 9, 2024
1 parent ddb8c54 commit 5f31e42
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Elastic OpenTelemetry PHP Distribution
Elastic Distribution for OpenTelemetry PHP
Copyright 2023-2024 Elasticsearch B.V.

This project is licensed under the Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

This is currently a work-in-progress project.

# Elastic distribution of OpenTelemetry for PHP
# Elastic Distribution for OpenTelemetry PHP

This project is the Elastic distribution of OpenTelemetry for PHP.
This project is the Elastic Distribution for OpenTelemetry PHP.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elastic/otel-distro",
"description": "Elastic distribution of OpenTelemetry for PHP",
"description": "Elastic Distribution for OpenTelemetry PHP",
"keywords": [ "elastic", "open telemetry", "OTel", "apm", "tracing", "apm-agent" ],
"type": "project",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packaging/configs/elastic-otel-custom-template.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; This file contains the various settings for the Elastic OpenTelemetry PHP. For
; This file contains the various settings for the Elastic Distribution for OpenTelemetry PHP. For
; further details refers to the following URL:
; https://www.elastic.co/guide/en/apm/agent/php/current/configuration-reference.html
;
Expand Down
2 changes: 1 addition & 1 deletion packaging/nfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ depends:
- bash
maintainer: "APM Team <[email protected]>"
description: |
Elastic OpenTelemetry PHP distribution
Elastic Distribution for OpenTelemetry PHP
Git Commit: ${PACKAGE_SHA}
vendor: "Elasticsearch, Inc."
homepage: "https://github.com/elastic/elastic-otel-php"
Expand Down
24 changes: 12 additions & 12 deletions packaging/scripts/before-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ function is_extension_enabled() {
################################################################################
#### Function remove_extension_configuration_to_file ###########################
function remove_extension_configuration_to_file() {
# remove lines from ; THIS IS AN AUTO-GENERATED FILE by the Elastic OpenTelemetry PHP post-install.sh script
# remove lines from ; THIS IS AN AUTO-GENERATED FILE by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
# with elastic_otel.bootstrap_php_part_file=.+
# then ; END OF AUTO-GENERATED by the Elastic OpenTelemetry PHP post-install.sh script
HEADER='; THIS IS AN AUTO-GENERATED FILE by the Elastic OpenTelemetry PHP post-install.sh'
FOOTER='; END OF AUTO-GENERATED by the Elastic OpenTelemetry PHP post-install.sh'
# then ; END OF AUTO-GENERATED by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
HEADER='; THIS IS AN AUTO-GENERATED FILE by the Elastic Distribution for OpenTelemetry PHP post-install.sh'
FOOTER='; END OF AUTO-GENERATED by the Elastic Distribution for OpenTelemetry PHP post-install.sh'
EXTENSION='extension=.*'
BOOTSTRAP='elastic_otel.bootstrap_php_part_file=.*'
numberOfHeaderMatches=$(grep "${HEADER}" "$1" -c)
Expand All @@ -73,18 +73,18 @@ function remove_extension_configuration_to_file() {
bootstrap=$(grep "${BOOTSTRAP}" -n ${TMP_FILE} | cut -f1 -d:)
## Ensure the automated installation in place uses the right format.
if [ "${extension}" == "2" ] && [ "${bootstrap}" == "3" ] && [ "${footer}" == "4" ] ; then
echo "$1 has been configured with the Elastic OpenTelemetry PHP setup, let's uninstalled it."
echo "$1 has been configured with the Elastic Distribution for OpenTelemetry PHP setup, let's uninstalled it."
headerLine=$(grep "${HEADER}" -n "$1" | cut -f1 -d:)
extensionLine=$((headerLine + 1))
bootstrapLine=$((headerLine + 2))
footerLine=$((headerLine + 3))
sed -i${BACKUP_EXTENSION} "${headerLine}d;${extensionLine}d;${bootstrapLine}d;${footerLine}d" "$1"
else
echo "$1 has been configured with the Elastic OpenTelemetry PHP setup. But it cannot be uninstalled automatically."
echo "$1 has been configured with the Elastic Distribution for OpenTelemetry PHP setup. But it cannot be uninstalled automatically."
manual_extension_agent_uninstallation
fi
else
echo "$1 has been configured with the Elastic OpenTelemetry PHP setup. But it cannot be uninstalled automatically."
echo "$1 has been configured with the Elastic Distribution for OpenTelemetry PHP setup. But it cannot be uninstalled automatically."
manual_extension_agent_uninstallation
fi
}
Expand Down Expand Up @@ -145,7 +145,7 @@ function unlink_file() {
################################################################################
############################### MAIN ###########################################
################################################################################
echo 'Uninstalling Elastic OpenTelemetry PHP'
echo 'Uninstalling Elastic Distribution for OpenTelemetry PHP'
PHP_INI_FILE_PATH="$(php_ini_file_path)/php.ini"
PHP_CONFIG_D_PATH="$(php_config_d_path)"

Expand All @@ -162,20 +162,20 @@ if [ -e "${PHP_INI_FILE_PATH}" ] ; then
if grep -q "elastic_otel_php_loader.so" "${PHP_INI_FILE_PATH}" ; then
remove_extension_configuration_to_file "${PHP_INI_FILE_PATH}"
else
echo ' extension configuration does not exist for the Elastic OpenTelemetry PHP.'
echo ' extension configuration does not exist for the Elastic Distribution for OpenTelemetry PHP.'
echo ' skipping ... '
fi
else
echo 'No default php.ini file has been found.'
fi

if is_extension_enabled ; then
echo 'Failed. Elastic OpenTelemetry PHP extension is still enabled.'
echo 'Failed. Elastic Distribution for OpenTelemetry PHP extension is still enabled.'
if [ -e "${PHP_INI_FILE_PATH}${BACKUP_EXTENSION}" ] ; then
echo "Reverted changes in the file ${PHP_INI_FILE_PATH}"
mv -f "${PHP_INI_FILE_PATH}${BACKUP_EXTENSION}" "${PHP_INI_FILE_PATH}"
echo "${PHP_INI_FILE_PATH} got some leftovers please delete the entries for the Elastic OpenTelemetry PHP manually"
echo "${PHP_INI_FILE_PATH} got some leftovers please delete the entries for the Elastic Distribution for OpenTelemetry PHP manually"
fi
else
echo 'Extension has been removed successfully for Elastic OpenTelemetry PHP.'
echo 'Extension has been removed successfully for Elastic Distribution for OpenTelemetry PHP.'
fi
24 changes: 12 additions & 12 deletions packaging/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ function generate_configuration_files() {
CONTENT=$(add_extension_configuration)
tee "${INI_FILE_PATH}" <<EOF
; ***** DO NOT EDIT THIS FILE *****
; THIS IS AN AUTO-GENERATED FILE by the Elastic OpenTelemetry PHP post-install.sh script
; THIS IS AN AUTO-GENERATED FILE by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
; To overwrite the INI settings for this extension, edit
; the INI file in this directory "${CUSTOM_INI_FILE_PATH}"
[elastic]
${CONTENT}
; END OF AUTO-GENERATED by the Elastic OpenTelemetry PHP post-install.sh script
; END OF AUTO-GENERATED by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
EOF

echo "${INI_FILE_PATH} created"
Expand All @@ -146,9 +146,9 @@ function add_extension_configuration_to_file() {
## IMPORTANT: The below content is also used in the before-uninstall.sh
## script.
tee -a "$1" <<EOF
; THIS IS AN AUTO-GENERATED FILE by the Elastic OpenTelemetry PHP post-install.sh script
; THIS IS AN AUTO-GENERATED FILE by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
${CONTENT}
; END OF AUTO-GENERATED by the Elastic OpenTelemetry PHP post-install.sh script
; END OF AUTO-GENERATED by the Elastic Distribution for OpenTelemetry PHP post-install.sh script
EOF
}

Expand Down Expand Up @@ -177,7 +177,7 @@ function manual_extension_agent_setup() {
#### Function agent_extension_not_supported ####################################
function agent_extension_not_supported() {
PHP_API=$(php_api)
echo 'Failed. Elastic OpenTelemetry PHP extension not supported for the current PHP API version.'
echo 'Failed. Elastic Distribution for OpenTelemetry PHP extension not supported for the current PHP API version.'
echo " PHP API => ${PHP_API}"
}

Expand Down Expand Up @@ -214,15 +214,15 @@ function is_php_supported() {
################################################################################
############################### MAIN ###########################################
################################################################################
echo 'Installing Elastic OpenTelemetry PHP'
echo 'Installing Elastic Distribution for OpenTelemetry PHP'
EXTENSION_FILE_PATH=$(get_extension_file)
PHP_INI_FILE_PATH="$(php_ini_file_path)/php.ini"
PHP_CONFIG_D_PATH="$(php_config_d_path)"

echo "DEBUG: after-install parameter is '$1'"

if ! is_php_supported ; then
echo 'Failed. Elastic OpenTelemetry PHP extension is not supported for the existing PHP installation.'
echo 'Failed. Elastic Distribution for OpenTelemetry PHP extension is not supported for the existing PHP installation.'
exit 1
fi

Expand All @@ -232,10 +232,10 @@ else
if [ -e "${PHP_INI_FILE_PATH}" ] ; then
if [ -e "${EXTENSION_FILE_PATH}" ] ; then
if grep -q "${EXTENSION_FILE_PATH}" "${PHP_INI_FILE_PATH}" ; then
echo ' extension configuration already exists for the Elastic OpenTelemetry PHP.'
echo ' extension configuration already exists for the Elastic Distribution for OpenTelemetry PHP.'
echo ' skipping ... '
else
echo "${PHP_INI_FILE_PATH} has been configured with the Elastic OpenTelemetry PHP setup."
echo "${PHP_INI_FILE_PATH} has been configured with the Elastic Distribution for OpenTelemetry PHP setup."
cp -fa "${PHP_INI_FILE_PATH}" "${PHP_INI_FILE_PATH}${BACKUP_EXTENSION}"
add_extension_configuration_to_file "${PHP_INI_FILE_PATH}"
fi
Expand All @@ -244,7 +244,7 @@ else
fi
else
if [ -e "${EXTENSION_FILE_PATH}" ] ; then
echo "${PHP_INI_FILE_PATH} has been created with the Elastic OpenTelemetry PHP setup."
echo "${PHP_INI_FILE_PATH} has been created with the Elastic Distribution for OpenTelemetry PHP setup."
add_extension_configuration_to_file "${PHP_INI_FILE_PATH}"
else
agent_extension_not_supported
Expand All @@ -253,9 +253,9 @@ else
fi

if is_extension_enabled ; then
echo 'Extension enabled successfully for Elastic OpenTelemetry PHP'
echo 'Extension enabled successfully for Elastic Distribution for OpenTelemetry PHP'
else
echo 'Failed. Elastic OpenTelemetry PHP extension is not enabled'
echo 'Failed. Elastic Distribution for OpenTelemetry PHP extension is not enabled'
if [ -e "${PHP_INI_FILE_PATH}${BACKUP_EXTENSION}" ] ; then
echo "Reverted changes in the file ${PHP_INI_FILE_PATH}"
mv -f "${PHP_INI_FILE_PATH}${BACKUP_EXTENSION}" "${PHP_INI_FILE_PATH}"
Expand Down
6 changes: 3 additions & 3 deletions packaging/test/smokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

echo "Checking if extension is loaded: ";
if (array_search("elastic_otel", get_loaded_extensions()) === false) {
echo CRED."FAILED. Elastic OpenTelemetry extension not found\n".CDEF;
echo CRED."FAILED. Elastic Distribution for OpenTelemetry PHP extension not found\n".CDEF;
exit(1);
}
echo CGREEN."OK\n".CDEF;

echo "Looking for internal function 'elastic_otel_is_enabled': ";
if (array_search("elastic_otel_is_enabled", get_extension_funcs("elastic_otel")) === false) {
echo CRED."FAILED. Elastic OpenTelemetry extension function 'elastic_otel_is_enabled' not found\n".CDEF;
echo CRED."FAILED. Elastic Distribution for OpenTelemetry PHP extension function 'elastic_otel_is_enabled' not found\n".CDEF;
exit(1);
}
echo CGREEN."OK\n".CDEF;


echo "Checking if extension is enabled: ";
if (elastic_otel_is_enabled() !== true) {
echo CRED."FAILED. Elastic OpenTelemetry extension is not enabled\n".CDEF;
echo CRED."FAILED. Elastic Distribution for OpenTelemetry PHP extension is not enabled\n".CDEF;
exit(1);
}
echo CGREEN."OK\n".CDEF;
Expand Down
4 changes: 2 additions & 2 deletions packaging/test/smokeTestUninstalled.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

echo "Checking if extension is loaded: ";
if (array_search("elastic_otel", get_loaded_extensions()) !== false) {
echo CRED."FAILED. Elastic OpenTelemetry extension found\n".CDEF;
echo CRED."FAILED. Elastic Distribution for OpenTelemetry PHP extension found\n".CDEF;
exit(1);
}
echo CGREEN."OK\n".CDEF;

echo "Looking for internal function 'elastic_otel_is_enabled': ";
if (array_search("elastic_otel_is_enabled", get_defined_functions()["internal"]) !== false) {
echo CRED."FAILED. Elastic OpenTelemetry extension function 'elastic_otel_is_enabled' found\n".CDEF;
echo CRED."FAILED. Elastic Distribution for OpenTelemetry PHP extension function 'elastic_otel_is_enabled' found\n".CDEF;
exit(1);
}
echo CGREEN."OK\n".CDEF;
Expand Down
2 changes: 1 addition & 1 deletion prod/native/extension/code/ModuleInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

// #endif /* INFO_H */

#define ELASTIC_PRODUCT_NAME "Elastic OpenTelemetry distribution"
#define ELASTIC_PRODUCT_NAME "Elastic Distribution for OpenTelemetry PHP"

extern elasticapm::php::ConfigurationManager configManager;

Expand Down
2 changes: 1 addition & 1 deletion prod/native/extension/code/ModuleInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void logStartupPreamble(elasticapm::php::LoggerInterface *logger) {
constexpr int colWidth = 40;

using namespace std::literals;
ELOG(logger, level, "Elastic OpenTelemetry PHP");
ELOG(logger, level, "Elastic Distribution for OpenTelemetry PHP");
ELOG(logger, level, "%*s%s", -colWidth, "Native part version:", ELASTIC_OTEL_VERSION);
ELOG(logger, level, "%*s%s", -colWidth, "Process command line:", elasticapm::utils::sanitizeKeyValueString(elasticapm::utils::getEnvName(EL_STRINGIFY(ELASTIC_OTEL_CFG_OPT_NAME_API_KEY)), elasticapm::osutils::getCommandLine()).c_str());
ELOG(logger, level, "%*s%s", -colWidth, "Process environment:", elasticapm::utils::sanitizeKeyValueString(elasticapm::utils::getEnvName(EL_STRINGIFY(ELASTIC_OTEL_CFG_OPT_NAME_API_KEY)), elasticapm::osutils::getProcessEnvironment()).c_str());
Expand Down
2 changes: 1 addition & 1 deletion prod/native/libcommon/code/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void getProcessDiags(std::ostream &out, std::string_view name) {

static void getDiagnosticInformation(std::ostream &out, elasticapm::php::PhpBridgeInterface const &bridge) {
out << std::setfill(detail::separator) << std::setw(detail::separatorWidth) << detail::separator << std::endl;
out << "Elastic OpenTelemetry PHP diagnostics:" << std::endl;
out << "Elastic Distribution for OpenTelemetry PHP diagnostics:" << std::endl;
out << std::setfill(detail::separator) << std::setw(detail::separatorWidth) << detail::separator << std::endl;
std::time_t time = std::time({});
char timeString[std::size("yyyy-mm-ddThh:mm:ssZ")];
Expand Down
6 changes: 3 additions & 3 deletions prod/native/loader/code/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,20 @@ __attribute__ ((visibility("default"))) elasticapm::loader::phpdata::zend_module
elastic_otel_loader_module_entry.zts = isThreadSafe;

if (!isVersionSupported) {
LOG_TO_SYSLOG_AND_STDERR( "Zend Engine version %s is not supported by Elastic OpenTelemetry distro\n", std::string(zendVersion).c_str());
LOG_TO_SYSLOG_AND_STDERR("Zend Engine version %s is not supported by Elastic Distribution for OpenTelemetry PHP\n", std::string(zendVersion).c_str());
return &elastic_otel_loader_module_entry;
}

if (isThreadSafe) {
LOG_TO_SYSLOG_AND_STDERR( "Thread Safe mode (ZTS) is not supported by Elastic OpenTelemetry distro\n");
LOG_TO_SYSLOG_AND_STDERR("Thread Safe mode (ZTS) is not supported by Elastic Distribution for OpenTelemetry PHP\n");
return &elastic_otel_loader_module_entry; // unsupported thread safe mode
}

// get path to libraries
Dl_info dl_info;
dladdr((void *)get_module, &dl_info);
if (!dl_info.dli_fname) {
LOG_TO_SYSLOG_AND_STDERR( "Unable to resolve path to Elastic OpenTelemetry PHP libraries\n");
LOG_TO_SYSLOG_AND_STDERR("Unable to resolve path to Elastic Distribution for OpenTelemetry PHP libraries\n");
return &elastic_otel_loader_module_entry;
}

Expand Down

0 comments on commit 5f31e42

Please sign in to comment.