summaryrefslogtreecommitdiff
path: root/chromium/components/query_tiles/internal/stats.h
blob: f04676458666ad452d6d42b039627279d760b935 (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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_QUERY_TILES_INTERNAL_STATS_H_
#define COMPONENTS_QUERY_TILES_INTERNAL_STATS_H_

#include "components/query_tiles/internal/tile_types.h"

namespace query_tiles {
namespace stats {

extern const char kImagePreloadingHistogram[];

extern const char kHttpResponseCodeHistogram[];

extern const char kNetErrorCodeHistogram[];

extern const char kRequestStatusHistogram[];

extern const char kGroupStatusHistogram[];

extern const char kFirstFlowDurationHistogram[];

extern const char kFetcherStartHourHistogram[];

extern const char kPrunedGroupReasonHistogram[];

// Event to track image loading metrics.
enum class ImagePreloadingEvent {
  // Start to fetch image in full browser mode.
  kStart = 0,
  // Fetch success in full browser mode.
  kSuccess = 1,
  // Fetch failure in full browser mode.
  kFailure = 2,
  // Start to fetch image in reduced mode.
  kStartReducedMode = 3,
  // Fetch success in reduced mode.
  kSuccessReducedMode = 4,
  // Fetch failure in reduced mode.
  kFailureReducedMode = 5,
  kMaxValue = kFailureReducedMode,
};

enum class PrunedGroupReason {
  // Group has expired.
  kExpired = 0,
  // Locale mismatched.
  kInvalidLocale = 1,
  kMaxValue = kInvalidLocale,
};

// Records an image preloading event.
void RecordImageLoading(ImagePreloadingEvent event);

// Records HTTP response code.
void RecordTileFetcherResponseCode(int response_code);

// Records net error code.
void RecordTileFetcherNetErrorCode(int error_code);

// Records request result from tile fetcher.
void RecordTileRequestStatus(TileInfoRequestStatus status);

// Records status of tile group.
void RecordTileGroupStatus(TileGroupStatus status);

// Records the number of hours passed from first time schedule to first time
// run.
void RecordFirstFetchFlowDuration(int hours);

// Records the locale explode hour when fetching starts.
void RecordExplodeOnFetchStarted(int explode);

// Records the reason to cause TileManager to prune the group.
void RecordGroupPruned(PrunedGroupReason reason);

}  // namespace stats
}  // namespace query_tiles

#endif  // COMPONENTS_QUERY_TILES_INTERNAL_STATS_H_