11#include < datadog/config.h>
22#include < datadog/environment.h>
33#include < datadog/telemetry/configuration.h>
4+ #include < datadog/version.h>
45
56#include " parse_util.h"
67
@@ -25,7 +26,7 @@ tracing::Expected<Configuration> load_telemetry_env_config() {
2526
2627 if (auto metrics_interval_seconds =
2728 lookup (environment::DD_TELEMETRY_METRICS_INTERVAL_SECONDS)) {
28- auto maybe_value = parse_uint64 (*metrics_interval_seconds, 10 );
29+ auto maybe_value = parse_double (*metrics_interval_seconds);
2930 if (auto error = maybe_value.if_error ()) {
3031 return *error;
3132 }
@@ -34,7 +35,7 @@ tracing::Expected<Configuration> load_telemetry_env_config() {
3435
3536 if (auto heartbeat_interval_seconds =
3637 lookup (environment::DD_TELEMETRY_HEARTBEAT_INTERVAL)) {
37- auto maybe_value = parse_uint64 (*heartbeat_interval_seconds, 10 );
38+ auto maybe_value = parse_double (*heartbeat_interval_seconds);
3839 if (auto error = maybe_value.if_error ()) {
3940 return *error;
4041 }
@@ -81,30 +82,35 @@ tracing::Expected<FinalizedConfiguration> finalize_config(
8182 // metrics_interval_seconds
8283 auto metrics_interval = pick (env_config->metrics_interval_seconds ,
8384 user_config.metrics_interval_seconds , 60 );
84- if (metrics_interval.second <= 0 ) {
85- // TBD
86- return Error{ };
85+ if (metrics_interval.second <= 0 . ) {
86+ return Error{Error::Code::OUT_OF_RANGE_INTEGER,
87+ " Telemetry metrics polling interval must be a positive value " };
8788 }
88- result.metrics_interval = std::chrono::seconds (metrics_interval.second );
89+ result.metrics_interval =
90+ std::chrono::duration_cast<std::chrono::milliseconds>(
91+ std::chrono::duration<double >(metrics_interval.second ));
8992
9093 // heartbeat_interval_seconds
9194 auto heartbeat_interval = pick (env_config->heartbeat_interval_seconds ,
9295 user_config.heartbeat_interval_seconds , 10 );
93- if (heartbeat_interval.second <= 0 ) {
94- // TBD
95- return Error{};
96+ if (heartbeat_interval.second <= 0 .) {
97+ return Error{
98+ Error::Code::OUT_OF_RANGE_INTEGER,
99+ " Telemetry heartbeat polling interval must be a positive value" };
96100 }
97- result.heartbeat_interval = std::chrono::seconds (heartbeat_interval.second );
101+ result.heartbeat_interval =
102+ std::chrono::duration_cast<std::chrono::milliseconds>(
103+ std::chrono::duration<double >(heartbeat_interval.second ));
98104
99105 // integration_name
100106 std::tie (origin, result.integration_name ) =
101107 pick (env_config->integration_name , user_config.integration_name ,
102- std::string (" " ));
108+ std::string (" datadog " ));
103109
104110 // integration_version
105111 std::tie (origin, result.integration_version ) =
106112 pick (env_config->integration_version , user_config.integration_version ,
107- std::string ( " " ) );
113+ tracing::tracer_version );
108114
109115 return result;
110116}
0 commit comments