diff options
| author | msherbakov <[email protected]> | 2022-02-10 16:49:16 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:16 +0300 | 
| commit | c224a621661ddd69699f9476922eb316607ef57e (patch) | |
| tree | 33f4d878aa0a9faa964005e06bfab0272313aa71 /library/cpp/monlib/metrics/metric_value.h | |
| parent | 29d0b2eeae154d04156e0698067c0c21a97ea61d (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/metric_value.h')
| -rw-r--r-- | library/cpp/monlib/metrics/metric_value.h | 36 | 
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/monlib/metrics/metric_value.h b/library/cpp/monlib/metrics/metric_value.h index 607fcc86022..18f8dc6fdb4 100644 --- a/library/cpp/monlib/metrics/metric_value.h +++ b/library/cpp/monlib/metrics/metric_value.h @@ -8,23 +8,23 @@  #include <util/datetime/base.h>  #include <util/generic/algorithm.h>  #include <util/generic/vector.h> -#include <util/generic/cast.h> -#include <util/generic/ymath.h> +#include <util/generic/cast.h>  +#include <util/generic/ymath.h>   namespace NMonitoring { -    namespace NPrivate { -        template <typename T> -        T FromFloatSafe(double d) { -            static_assert(std::is_integral<T>::value, "this function only converts floats to integers"); +    namespace NPrivate {  +        template <typename T>  +        T FromFloatSafe(double d) {  +            static_assert(std::is_integral<T>::value, "this function only converts floats to integers");               Y_ENSURE(::IsValidFloat(d) && d >= Min<T>() && d <= MaxFloor<T>(), "Cannot convert " << d << " to an integer value"); -            return static_cast<T>(d); -        } +            return static_cast<T>(d);  +        }           inline auto POINT_KEY_FN = [](auto& p) {              return p.GetTime();          }; -    } // namespace NPrivate - +    } // namespace NPrivate  +       template <typename T, typename Enable = void>      struct TValueType; @@ -132,9 +132,9 @@ namespace NMonitoring {          ui64 AsUint64(EMetricValueType type) const {              switch (type) {                  case EMetricValueType::DOUBLE: -                    return NPrivate::FromFloatSafe<ui64>(Value_.Double); +                    return NPrivate::FromFloatSafe<ui64>(Value_.Double);                   case EMetricValueType::INT64: -                    return SafeIntegerCast<ui64>(Value_.Int64); +                    return SafeIntegerCast<ui64>(Value_.Int64);                   case EMetricValueType::UINT64:                      return Value_.Uint64;                  case EMetricValueType::HISTOGRAM: @@ -158,11 +158,11 @@ namespace NMonitoring {          i64 AsInt64(EMetricValueType type) const {              switch (type) {                  case EMetricValueType::DOUBLE: -                    return NPrivate::FromFloatSafe<i64>(Value_.Double); +                    return NPrivate::FromFloatSafe<i64>(Value_.Double);                   case EMetricValueType::INT64:                      return Value_.Int64;                  case EMetricValueType::UINT64: -                    return SafeIntegerCast<i64>(Value_.Uint64); +                    return SafeIntegerCast<i64>(Value_.Uint64);                   case EMetricValueType::HISTOGRAM:                      ythrow yexception() << "histogram cannot be casted to Int64";                  case EMetricValueType::SUMMARY: @@ -434,8 +434,8 @@ namespace NMonitoring {                      point.GetValue().AsLogHistogram()->Ref();                  }              } -        } - +        }  +           template <typename TConsumer>          void ForEach(TConsumer c) const {              for (const auto& point : Points_) { @@ -470,8 +470,8 @@ namespace NMonitoring {      private:          static void CheckTypes(EMetricValueType t1, EMetricValueType t2) {              Y_ENSURE(t1 == t2, -                     "Series type mismatch: expected " << t1 << -                     ", but got " << t2); +                     "Series type mismatch: expected " << t1 <<  +                     ", but got " << t2);           }      private:  | 
