forked from mapsme/omim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayers_statistics.cpp
64 lines (54 loc) · 1.72 KB
/
layers_statistics.cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "map/layers_statistics.hpp"
#include "base/assert.hpp"
#include "base/string_utils.hpp"
#include "3party/Alohalytics/src/alohalytics.h"
namespace
{
std::string ToString(LayersStatistics::Status status)
{
switch (status)
{
case LayersStatistics::Status::Success: return "success";
case LayersStatistics::Status::Error: return "error";
case LayersStatistics::Status::Unavailable: return "unavailable";
}
UNREACHABLE();
}
std::string ToString(LayersStatistics::LayerItemType itemType)
{
switch (itemType)
{
case LayersStatistics::LayerItemType::Point: return "point";
case LayersStatistics::LayerItemType::Cluster: return "cluster";
}
UNREACHABLE();
}
std::string ToString(LayersStatistics::InitType initType)
{
switch (initType)
{
case LayersStatistics::InitType::User: return "user";
case LayersStatistics::InitType::Auto: return "auto";
}
UNREACHABLE();
}
} // namespace
LayersStatistics::LayersStatistics(std::string const & layerName)
: m_layerName(layerName)
{
}
void LayersStatistics::LogActivate(Status status,
std::set<int64_t> const & mwmVersions /* = {} */,
InitType initType /* = InitType::User */) const
{
alohalytics::TStringMap params = {{"name", m_layerName}, {"status", ToString(status)},
{"init", ToString(initType)}};
if (!mwmVersions.empty())
params.emplace("dataversion", strings::JoinAny(mwmVersions));
alohalytics::LogEvent("Map_Layers_activate", params);
}
void LayersStatistics::LogItemSelected(LayerItemType itemType) const
{
alohalytics::LogEvent("Map_Layers_item_selected",
{{"name", m_layerName}, {"type", ToString(itemType)}});
}