Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call to curl_global_init if disable_send is set to true #1150

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions agent/native/ext/lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,21 @@ void elasticApmModuleInit( int moduleType, int moduleNumber )
registerAtExitLogging();
registerExceptionHooks();

curlCode = curl_global_init( CURL_GLOBAL_ALL );
if ( curlCode != CURLE_OK )
if ( config->disableSend )
{
resultCode = resultFailure;
ELASTIC_APM_LOG_ERROR( "curl_global_init failed: %s (%d)", curl_easy_strerror( curlCode ), (int)curlCode );
goto finally;
ELASTIC_APM_LOG_DEBUG( "disable_send (disableSend) configuration option is set to true - skipping curl_global_init" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is tracer->curlInited == false by default?

}
else
{
curlCode = curl_global_init( CURL_GLOBAL_ALL );
if ( curlCode != CURLE_OK )
{
resultCode = resultFailure;
ELASTIC_APM_LOG_ERROR( "curl_global_init failed: %s (%d)", curl_easy_strerror( curlCode ), (int)curlCode );
goto finally;
}
tracer->curlInited = true;
}
tracer->curlInited = true;

astInstrumentationOnModuleInit( config );

Expand Down
Loading