-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collect agent info and apply the env for remote config
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
- Loading branch information
Showing
14 changed files
with
195 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "agent_info.h" | ||
#include "ddtrace.h" | ||
#include "sidecar.h" | ||
#include "configuration.h" | ||
|
||
ZEND_EXTERN_MODULE_GLOBALS(ddtrace); | ||
|
||
void ddtrace_check_agent_info_env() { | ||
if (DDTRACE_G(agent_info_reader) && ZSTR_LEN(get_DD_ENV()) == 0) { | ||
bool changed; | ||
ddog_CharSlice env = ddog_get_agent_info_env(DDTRACE_G(agent_info_reader), &changed); | ||
if (env.len) { | ||
zend_alter_ini_entry_chars(zai_config_memoized_entries[DDTRACE_CONFIG_DD_ENV].ini_entries[0]->name, env.ptr, env.len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); | ||
} | ||
} | ||
} | ||
|
||
void ddtrace_agent_info_rinit() { | ||
if (ddtrace_endpoint && !ZSTR_LEN(get_global_DD_ENV())) { | ||
DDTRACE_G(agent_info_reader) = ddog_get_agent_info_reader(ddtrace_endpoint); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef DD_AGENT_INFO_H | ||
#define DD_AGENT_INFO_H | ||
|
||
void ddtrace_check_agent_info_env(void); | ||
void ddtrace_agent_info_rinit(void); | ||
|
||
#endif // DD_AGENT_INFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule libdatadog
updated
69 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
DDTrace\ExceptionSpanEvent serialization with overridden attributes | ||
--SKIPIF-- | ||
<?php include __DIR__ . '/../includes/skipif_no_dev_env.inc'; ?> | ||
<?php | ||
echo "nocache\n"; | ||
$ctx = stream_context_create([ | ||
'http' => [ | ||
'method' => 'PUT', | ||
"header" => [ | ||
"Content-Type: application/json", | ||
"X-Datadog-Test-Session-Token: dd_trace_agent_env", | ||
], | ||
'content' => '{"config":{"default_env":"test_env"}}' | ||
] | ||
]); | ||
file_get_contents("http://request-replayer/set-agent-info", false, $ctx); | ||
?> | ||
--ENV-- | ||
DD_AGENT_HOST=request-replayer | ||
DD_TRACE_AGENT_PORT=80 | ||
DD_TRACE_AGENT_FLUSH_INTERVAL=333 | ||
DD_TRACE_GENERATE_ROOT_SPAN=0 | ||
--INI-- | ||
datadog.env= | ||
datadog.trace.agent_test_session_token=dd_trace_agent_env | ||
--FILE-- | ||
<?php | ||
|
||
$span = \DDTrace\start_span(); | ||
usleep(500000); | ||
\DDTrace\close_span(); | ||
var_dump($span->env); | ||
|
||
?> | ||
--EXPECTF-- | ||
string(8) "test_env" |