aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/providers/common/metrics/service_counters.h
blob: ef56c8ca8118b16a208bb5fb2094919bed509481 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include <util/generic/string.h>
#include <library/cpp/monlib/dynamic_counters/counters.h>

namespace NYql {
namespace NCommon {

struct TServiceCounters {
    ::NMonitoring::TDynamicCounterPtr RootCounters;   // "counters/counters=yq" - root counters for service metrics
    ::NMonitoring::TDynamicCounterPtr PublicCounters; // "counters/counters=public" - root counters for cloud user metrics
    ::NMonitoring::TDynamicCounterPtr Counters;       // "counters/counters=yq/subsystem=smth" - subsystem part, may match to RootCounters if subsystem name is empty

    ::NMonitoring::TDynamicCounters::TCounterPtr UptimeRootCounter; // yq/uptime_seconds
    ::NMonitoring::TDynamicCounters::TCounterPtr UptimePublicCounter; // yq_public/query.uptime_seconds

    explicit TServiceCounters(
        const ::NMonitoring::TDynamicCounterPtr& rootCounters,
        const ::NMonitoring::TDynamicCounterPtr& publicCounters,
        const TString& subsystemName = "");

    explicit TServiceCounters(
        const ::NMonitoring::TDynamicCounterPtr& baseCounters,
        const TString& subsystemName = "");

    explicit TServiceCounters(
        const TServiceCounters& serviceCounters,
        const TString& subsystemName = "");

    TServiceCounters& operator=(const TServiceCounters& serviceCounters) = default;

    void InitUptimeCounter();

    void SetUptimePublicAndServiceCounter(i64 val) const;
};

} // namespace NCommon
} // namespace NYql