aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/metrics.h
blob: 8eae426de58fe9a3b817cba8f104c51b6d6f4aa5 (plain)
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
#pragma once

#include <string>

#include "vcpkg_Util.h"

namespace vcpkg::Metrics
{
    struct Metrics : Util::ResourceBase
    {
        void set_send_metrics(bool should_send_metrics);
        void set_print_metrics(bool should_print_metrics);
        void set_user_information(const std::string& user_id, const std::string& first_use_time);
        void init_user_information(std::string& user_id, std::string& first_use_time);

        void track_metric(const std::string& name, double value);
        void track_property(const std::string& name, const std::string& value);
        void track_property(const std::string& name, const std::wstring& value);

        void upload(const std::string& payload);
        void flush();
    };

    extern Util::LockGuarded<Metrics> g_metrics;

    std::wstring get_SQM_user();
    bool get_compiled_metrics_enabled();
}