-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Pass the dogstatsd URL to the sidecar * Init the dogstatsd public API * Add support for tags in dogstatsd functions * Change the count value type from float to int * Add tests * Use proper Vec<Tag> instead of string serialization * Add support for Distribution and histogram * Fix compilation issues * Add support for the 'Set' metric type * Move ddtrace_dogstatsd_url function in a new file as dogstatsd_client.c is not compiled on windows * Debug test * Add global tags * Fix handling of invalid tags * Fix stubs * Skip test failing because of a PHP bug on PHP 7.0/7.1 * Fix int type: we must support signed numbers
- Loading branch information
Showing
17 changed files
with
582 additions
and
7 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
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,44 @@ | ||
#include "dogstatsd.h" | ||
|
||
#include "configuration.h" | ||
#include "ddtrace.h" | ||
|
||
ZEND_EXTERN_MODULE_GLOBALS(ddtrace); | ||
|
||
#define DEFAULT_UDS_PATH "/var/run/datadog/dsd.socket" | ||
|
||
char *ddtrace_dogstatsd_url(void) { | ||
zend_string *url = get_DD_DOGSTATSD_URL(); | ||
if (ZSTR_LEN(url) > 0) { | ||
return zend_strndup(ZSTR_VAL(url), ZSTR_LEN(url) + 1); | ||
} | ||
|
||
zend_string *hostname = get_global_DD_AGENT_HOST(); | ||
if (ZSTR_LEN(hostname) > 7 && strncmp(ZSTR_VAL(hostname), "unix://", 7) == 0) { | ||
return zend_strndup(ZSTR_VAL(hostname), ZSTR_LEN(hostname)); | ||
} | ||
|
||
if (ZSTR_LEN(hostname) > 0) { | ||
bool isIPv6 = memchr(ZSTR_VAL(hostname), ':', ZSTR_LEN(hostname)); | ||
|
||
int port = atoi(ZSTR_VAL(get_DD_DOGSTATSD_PORT())); | ||
if (port <= 0 || port > 65535) { | ||
port = 8125; | ||
} | ||
char *formatted_url; | ||
asprintf(&formatted_url, isIPv6 ? HOST_V6_FORMAT_STR : HOST_V4_FORMAT_STR, ZSTR_VAL(hostname), (uint32_t)port); | ||
return formatted_url; | ||
} | ||
|
||
if (access(DEFAULT_UDS_PATH, F_OK) == SUCCESS) { | ||
return zend_strndup(ZEND_STRL("unix://" DEFAULT_UDS_PATH)); | ||
} | ||
|
||
int64_t port = get_global_DD_TRACE_AGENT_PORT(); | ||
if (port <= 0 || port > 65535) { | ||
port = 8125; | ||
} | ||
char *formatted_url; | ||
asprintf(&formatted_url, HOST_V4_FORMAT_STR, "localhost", (uint32_t)port); | ||
return formatted_url; | ||
} |
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,6 @@ | ||
#ifndef DDTRACE_DOGSTATSD_H | ||
#define DDTRACE_DOGSTATSD_H | ||
|
||
char *ddtrace_dogstatsd_url(void); | ||
|
||
#endif // DDTRACE_DOGSTATSD_H |
Oops, something went wrong.