1- // Copyright (c) 2020-2021 , NVIDIA CORPORATION. All rights reserved.
1+ // Copyright (c) 2020-2024 , NVIDIA CORPORATION. All rights reserved.
22//
33// Redistribution and use in source and binary forms, with or without
44// modification, are permitted provided that the following conditions
@@ -51,7 +51,7 @@ class InferenceTrace {
5151 TRITONSERVER_InferenceTraceReleaseFn_t release_fn, void * userp)
5252 : level_(level), id_(next_id_++), parent_id_(parent_id),
5353 activity_fn_ (activity_fn), tensor_activity_fn_(tensor_activity_fn),
54- release_fn_(release_fn), userp_(userp)
54+ release_fn_(release_fn), userp_(userp), context_( " " )
5555 {
5656 }
5757
@@ -63,10 +63,12 @@ class InferenceTrace {
6363 const std::string& ModelName () const { return model_name_; }
6464 int64_t ModelVersion () const { return model_version_; }
6565 const std::string& RequestId () const { return request_id_; }
66+ const std::string& Context () const { return context_; }
6667
6768 void SetModelName (const std::string& n) { model_name_ = n; }
6869 void SetModelVersion (int64_t v) { model_version_ = v; }
6970 void SetRequestId (const std::string& request_id) { request_id_ = request_id; }
71+ void SetContext (const std::string& context) { context_ = context; }
7072
7173 // Report trace activity.
7274 void Report (
@@ -125,6 +127,7 @@ class InferenceTrace {
125127 // Maintain next id statically so that trace id is unique even
126128 // across traces
127129 static std::atomic<uint64_t > next_id_;
130+ std::string context_;
128131};
129132
130133//
@@ -144,9 +147,11 @@ class InferenceTraceProxy {
144147 const std::string& ModelName () const { return trace_->ModelName (); }
145148 const std::string& RequestId () const { return trace_->RequestId (); }
146149 int64_t ModelVersion () const { return trace_->ModelVersion (); }
150+ const std::string& Context () const { return trace_->Context (); }
147151 void SetModelName (const std::string& n) { trace_->SetModelName (n); }
148152 void SetRequestId (const std::string& n) { trace_->SetRequestId (n); }
149153 void SetModelVersion (int64_t v) { trace_->SetModelVersion (v); }
154+ void SetContext (const std::string& context) { trace_->SetContext (context); }
150155
151156 void Report (
152157 const TRITONSERVER_InferenceTraceActivity activity, uint64_t timestamp_ns)
0 commit comments