Skip to content

Commit

Permalink
Pass driver info to Timestream using user agent (#6)
Browse files Browse the repository at this point in the history
* pass driver info to Timestream using user agent

* add log for user agent setting
  • Loading branch information
RoyZhang2022 authored and alinaliBQ committed Dec 5, 2023
1 parent 8386498 commit aab6e8b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion amazon-timestream-odbc-driver/src/odbc/src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,22 @@ bool Connection::TryRestoreConnection(const config::Configuration& cfg,
clientCfg.connectTimeoutMs = cfg.GetConnectionTimeout();
clientCfg.requestTimeoutMs = cfg.GetReqTimeout();
clientCfg.maxConnections = cfg.GetMaxConnections();

#if defined(_WIN32)
std::string platform("Windows");
#elif defined(__APPLE__)
std::string platform("macOS");
#else
std::string platform("Linux");
#endif
// pass driver info to Timestream as user agent
clientCfg.userAgent = "ts-odbc." + utility::GetFormatedDriverVersion() + " on " + platform;
LOG_DEBUG_MSG("region is "
<< cfg.GetRegion() << ", connection timeout is "
<< clientCfg.connectTimeoutMs << ", request timeout is "
<< clientCfg.requestTimeoutMs << ", max connection is "
<< clientCfg.maxConnections);
<< clientCfg.maxConnections << ", user agent is "
<< clientCfg.userAgent);

SetClientProxy(clientCfg);

Expand Down

0 comments on commit aab6e8b

Please sign in to comment.