11#include <library/cpp/yson/node/node.h>
13#include <util/system/defaults.h>
14#include <util/generic/maybe.h>
15#include <util/generic/ptr.h>
106 template <
typename T>
129 template <
typename T>
147 static const TString CustomStatisticsNamePrefix_;
150 TJobStatistics(::TIntrusivePtr<TData> data, ::TIntrusivePtr<TFilter> filter);
152 TMaybe<TDataEntry> GetStatisticsImpl(TStringBuf name)
const;
155 ::TIntrusivePtr<TData> Data_;
156 ::TIntrusivePtr<TFilter> Filter_;
167class TJobStatisticsEntry
170 TJobStatisticsEntry(TMaybe<TJobStatistics::TDataEntry> data)
171 : Data_(std::move(data))
188 if (Data_ && Data_->Count) {
222 TMaybe<TJobStatistics::TDataEntry> Data_;
233 return TJobStatisticsEntry<T>(GetStatisticsImpl(name));
239 return TJobStatisticsEntry<T>(GetStatisticsImpl(CustomStatisticsNamePrefix_ + name));
Class representing single statistic.
Definition job_statistics.h:168
TMaybe< T > Avg() const
Average of the statistic over all jobs.
Definition job_statistics.h:186
TMaybe< T > Count() const
Number of jobs that emitted this statistic.
Definition job_statistics.h:195
TMaybe< T > Max() const
Maximum value of the statistic over all jobs.
Definition job_statistics.h:204
TMaybe< T > Sum() const
Sum of the statistic over all jobs.
Definition job_statistics.h:175
TMaybe< T > Min() const
Minimum value of the statistic over all jobs.
Definition job_statistics.h:213
Class representing a collection of job statistics.
Definition job_statistics.h:35
TJobStatisticsEntry< i64 > GetStatistics(TStringBuf name) const
Get statistics by name.
TVector< TString > GetCustomStatisticsNames() const
Get names of all custom statistics.
TJobStatistics JobState(TVector< EJobState > filter) const
Filter statistics by job state.
TJobStatisticsEntry< i64 > GetCustomStatistics(TStringBuf name) const
Get custom statistics (those the user can write in job with NYT::WriteCustomStatistics).
TJobStatistics()
Construct empty statistics.
TJobStatistics TaskName(TVector< TTaskName > taskNames) const
Filter statistics by task name.
TJobStatistics(const NYT::TNode &statistics)
Construct statistics from statistics node.
bool HasCustomStatistics(TStringBuf name) const
Check if given custom statistics exists.
bool HasStatistics(TStringBuf name) const
Check that given statistics exist.
TJobStatisticsEntry< T > GetStatisticsAs(TStringBuf name) const
Get statistics by name.
Definition job_statistics.h:231
TVector< TString > GetStatisticsNames() const
Get (slash separated) names of statistics.
TJobStatisticsEntry< T > GetCustomStatisticsAs(TStringBuf name) const
Get custom statistics (those the user can write in job with NYT::WriteCustomStatistics).
Definition job_statistics.h:237
TJobStatistics JobType(TVector< EJobType > filter) const
Filter statistics by job type.
Main namespace of YT client.
Definition abortable_stream.h:7
void FlushCustomStatisticsStream()
Flush custom statistics stream.
void WriteCustomStatistics(TStringBuf path, i64 value)
Write custom statistics.
T ConvertJobStatisticsEntry(i64 value)
Convert i64 representation of statistics to other type.