1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_
10 #include "base/time/time.h"
11 #include "components/domain_reliability/domain_reliability_export.h"
17 namespace domain_reliability
{
19 // The per-request data that is uploaded to the Domain Reliability collector.
20 struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon
{
22 DomainReliabilityBeacon();
23 ~DomainReliabilityBeacon();
25 // Converts the Beacon to JSON format for uploading. Calculates the age
26 // relative to an upload time of |upload_time|.
27 base::Value
* ToValue(base::TimeTicks upload_time
,
28 base::TimeTicks last_network_change_time
) const;
30 // The URL that the beacon is reporting on, if included.
32 // The domain that the beacon is reporting on, if included.
34 // The resource name that the beacon is reporting on, if included.
36 // Status string (e.g. "ok", "dns.nxdomain", "http.403").
38 // Net error code. Encoded as a string in the final JSON.
40 // IP address of the server the request went to.
41 std::string server_ip
;
42 // Whether the request went through a proxy. If true, |server_ip| will be
45 // Protocol used to make the request.
47 // HTTP response code returned by the server, or -1 if none was received.
48 int http_response_code
;
49 // Elapsed time between starting and completing the request.
50 base::TimeDelta elapsed
;
51 // Start time of the request. Encoded as the request age in the final JSON.
52 base::TimeTicks start_time
;
54 // Okay to copy and assign.
57 } // namespace domain_reliability
59 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_