Skip to content

Commit

Permalink
Update Telemetry env variable. (#2356)
Browse files Browse the repository at this point in the history
* Update Telemetry env variable.

* Retrieve telemetry env once.

---------

Co-authored-by: Boyu Chen <cheboyu@amazon.com>
  • Loading branch information
chen3933 and Boyu Chen committed Jun 13, 2023
1 parent 89fbd88 commit 7270447
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class WorkerThread implements Runnable {
private WorkerLifeCycle lifeCycle;
private int responseTimeout;
private long recoveryStartTS; // 0: default value. no recovery needed, in healthy mode
private String telemetryPath = System.getenv("SM_TELEMETRY_LOG_REV_2022_12");

public WorkerThread(
ConfigManager configManager,
Expand Down Expand Up @@ -178,7 +179,9 @@ public void run() {
currentThread.set(thread);
BaseModelRequest req = null;
int status = HttpURLConnection.HTTP_INTERNAL_ERROR;

if (telemetryPath != null) {
loggerTelemetryMetrics.info("Telemetry enabled.");
}
try {
connect();

Expand Down Expand Up @@ -283,15 +286,15 @@ public void run() {
} catch (OutOfMemoryError oom) {
logger.error("Out of memory error when creating workers", oom);
status = HttpURLConnection.HTTP_ENTITY_TOO_LARGE;
if (java.lang.System.getenv("SM_TELEMETRY_LOG") != null) {
if (telemetryPath != null) {
loggerTelemetryMetrics.info(
"ModelServerError.Count:1|#TorchServe:{},{}:-1",
ConfigManager.getInstance().getVersion(),
oom.getClass().getCanonicalName());
}
} catch (Throwable t) {
logger.warn("Backend worker thread exception.", t);
if (java.lang.System.getenv("SM_TELEMETRY_LOG") != null) {
if (telemetryPath != null) {
loggerTelemetryMetrics.info(
"ModelServerError.Count:1|#TorchServe:{},{}:-1",
ConfigManager.getInstance().getVersion(),
Expand Down

0 comments on commit 7270447

Please sign in to comment.