File tree Expand file tree Collapse file tree 5 files changed +37
-1
lines changed Expand file tree Collapse file tree 5 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ struct TRITONSERVER_MetricFamily;
91
91
/// }
92
92
///
93
93
#define TRITONSERVER_API_VERSION_MAJOR 1
94
- #define TRITONSERVER_API_VERSION_MINOR 18
94
+ #define TRITONSERVER_API_VERSION_MINOR 19
95
95
96
96
/// Get the TRITONBACKEND API version supported by the Triton shared
97
97
/// library. This value can be compared against the
@@ -857,6 +857,17 @@ TRITONSERVER_DECLSPEC TRITONSERVER_Error*
857
857
TRITONSERVER_InferenceTraceModelVersion (
858
858
TRITONSERVER_InferenceTrace * trace , int64_t * model_version );
859
859
860
+ /// Get the request id associated with a trace. The caller does
861
+ /// not own the returned string and must not modify or delete it. The
862
+ /// lifetime of the returned string extends only as long as 'trace'.
863
+ ///
864
+ /// \param trace The trace.
865
+ /// \param request_id Returns the version of the model associated
866
+ /// with the trace.
867
+ /// \return a TRITONSERVER_Error indicating success or failure.
868
+ TRITONSERVER_DECLSPEC TRITONSERVER_Error * TRITONSERVER_InferenceTraceRequestId (
869
+ TRITONSERVER_InferenceTrace * trace , const char * * request_id );
870
+
860
871
/// TRITONSERVER_InferenceRequest
861
872
///
862
873
/// Object representing an inference request. The inference request
Original file line number Diff line number Diff line change @@ -957,6 +957,7 @@ EnsembleContext::InitStep(
957
957
if (parent_trace != nullptr ) {
958
958
irequest->SetTrace (parent_trace->SpawnChildTrace ());
959
959
irequest->Trace ()->SetModelName (irequest->ModelName ());
960
+ irequest->Trace ()->SetRequestId (irequest->Id ());
960
961
irequest->Trace ()->SetModelVersion (irequest->ActualModelVersion ());
961
962
}
962
963
#endif
Original file line number Diff line number Diff line change @@ -61,9 +61,11 @@ class InferenceTrace {
61
61
62
62
const std::string& ModelName () const { return model_name_; }
63
63
int64_t ModelVersion () const { return model_version_; }
64
+ const std::string& RequestId () const { return request_id_; }
64
65
65
66
void SetModelName (const std::string& n) { model_name_ = n; }
66
67
void SetModelVersion (int64_t v) { model_version_ = v; }
68
+ void SetRequestId (const std::string& request_id) { request_id_ = request_id; }
67
69
68
70
// Report trace activity.
69
71
void Report (
@@ -117,6 +119,7 @@ class InferenceTrace {
117
119
118
120
std::string model_name_;
119
121
int64_t model_version_;
122
+ std::string request_id_;
120
123
121
124
// Maintain next id statically so that trace id is unique even
122
125
// across traces
@@ -137,8 +140,10 @@ class InferenceTraceProxy {
137
140
int64_t Id () const { return trace_->Id (); }
138
141
int64_t ParentId () const { return trace_->ParentId (); }
139
142
const std::string& ModelName () const { return trace_->ModelName (); }
143
+ const std::string& RequestId () const { return trace_->RequestId (); }
140
144
int64_t ModelVersion () const { return trace_->ModelVersion (); }
141
145
void SetModelName (const std::string& n) { trace_->SetModelName (n); }
146
+ void SetRequestId (const std::string& n) { trace_->SetRequestId (n); }
142
147
void SetModelVersion (int64_t v) { trace_->SetModelVersion (v); }
143
148
144
149
void Report (
Original file line number Diff line number Diff line change @@ -998,6 +998,20 @@ TRITONSERVER_InferenceTraceModelName(
998
998
#endif // TRITON_ENABLE_TRACING
999
999
}
1000
1000
1001
+ TRITONAPI_DECLSPEC TRITONSERVER_Error*
1002
+ TRITONSERVER_InferenceTraceRequestId (
1003
+ TRITONSERVER_InferenceTrace* trace, const char ** request_id)
1004
+ {
1005
+ #ifdef TRITON_ENABLE_TRACING
1006
+ tc::InferenceTrace* ltrace = reinterpret_cast <tc::InferenceTrace*>(trace);
1007
+ *request_id = ltrace->RequestId ().c_str ();
1008
+ return nullptr ; // Success
1009
+ #else
1010
+ return TRITONSERVER_ErrorNew (
1011
+ TRITONSERVER_ERROR_UNSUPPORTED, " inference tracing not supported" );
1012
+ #endif // TRITON_ENABLE_TRACING
1013
+ }
1014
+
1001
1015
TRITONAPI_DECLSPEC TRITONSERVER_Error*
1002
1016
TRITONSERVER_InferenceTraceModelVersion (
1003
1017
TRITONSERVER_InferenceTrace* trace, int64_t * model_version)
@@ -2907,6 +2921,7 @@ TRITONSERVER_ServerInferAsync(
2907
2921
tc::InferenceTrace* ltrace = reinterpret_cast <tc::InferenceTrace*>(trace);
2908
2922
ltrace->SetModelName (lrequest->ModelName ());
2909
2923
ltrace->SetModelVersion (lrequest->ActualModelVersion ());
2924
+ ltrace->SetRequestId (lrequest->Id ());
2910
2925
2911
2926
lrequest->SetTrace (std::make_shared<tc::InferenceTraceProxy>(ltrace));
2912
2927
#else
Original file line number Diff line number Diff line change @@ -174,6 +174,10 @@ TRITONSERVER_InferenceTraceModelVersion()
174
174
{
175
175
}
176
176
TRITONAPI_DECLSPEC void
177
+ TRITONSERVER_InferenceTraceRequestId ()
178
+ {
179
+ }
180
+ TRITONAPI_DECLSPEC void
177
181
TRITONSERVER_InferenceRequestNew ()
178
182
{
179
183
}
You can’t perform that action at this time.
0 commit comments