19 #ifndef PAGESPEED_OPT_LOGGING_LOG_RECORD_H_
20 #define PAGESPEED_OPT_LOGGING_LOG_RECORD_H_
28 #include "pagespeed/kernel/http/image_types.pb.h"
29 #include "pagespeed/opt/logging/enums.pb.h"
38 namespace net_instaweb {
41 class RequestTimingInfo;
81 const char* rewriter_id, RewriterApplication::Status status);
87 RewriterApplication::Status status) {
95 RewriterHtmlApplication::Status status);
100 const char* rewriter_id, RewriterApplication::Status status);
114 RewriterApplication::Status status,
119 bool is_recompressed,
120 ImageType original_image_type,
121 ImageType optimized_image_type,
125 bool is_resized_using_rendered_dimensions,
147 bool found,
int key_state) = 0;
158 RewriterApplication::Status status,
159 bool is_image_inlined,
160 bool is_critical_image,
161 bool is_url_rewritten,
163 bool try_low_res_src_insertion,
164 bool low_res_src_inserted,
165 ImageType low_res_image_type,
166 int low_res_data_size) = 0;
171 void LogLazyloadFilter(
const char*
id,
172 RewriterApplication::Status status,
173 bool is_blacklisted,
bool is_critical);
202 virtual void SetImageStats(
int num_img_tags,
int num_inlined_img_tags,
203 int num_critical_images_used) = 0;
210 int original_external_bytes,
216 bool supports_image_inlining,
217 bool supports_lazyload_images,
218 bool supports_critical_images_beacon,
219 bool supports_deferjs,
220 bool supports_webp_in_place,
221 bool supports_webp_rewritten_urls,
222 bool supports_webplossless_alpha,
231 bool log_url_indices,
232 int max_rewrite_info_log_size);
247 RewriterApplication::Status status);
254 const GoogleString& url, RewriteResourceInfo* rewrite_resource_info);
258 void PopulateRewriterStatusCounts();
265 int rewriter_info_max_size_;
268 bool allow_logging_urls_;
271 bool log_url_indices_;
274 StringIntMap url_index_map_;
277 typedef std::map<RewriterApplication::Status, int> RewriteStatusCountMap;
278 struct RewriterStatsInternal {
279 RewriterHtmlApplication::Status html_status;
282 RewriteStatusCountMap status_counts;
284 RewriterStatsInternal()
285 : html_status(RewriterHtmlApplication::UNKNOWN_STATUS) {}
287 typedef std::map<GoogleString, RewriterStatsInternal> RewriterStatsMap;
288 RewriterStatsMap rewriter_stats_;
303 int num_critical_images_used) {}
316 int page_type,
const GoogleString& cohort,
bool found,
int key_state) {}
321 RewriterApplication::Status status,
322 bool is_image_inlined,
323 bool is_critical_image,
324 bool is_url_rewritten,
326 bool try_low_res_src_insertion,
327 bool low_res_src_inserted,
328 ImageType low_res_image_type,
329 int low_res_data_size) {}
333 bool supports_image_inlining,
334 bool supports_lazyload_images,
335 bool supports_critical_images_beacon,
336 bool supports_deferjs,
337 bool supports_webp_in_place,
338 bool supports_webp_rewritten_urls,
339 bool supports_webplossless_alpha,
340 bool is_bot)
override {}
357 :
LogRecord(logging_mutex), logging_info_copy_(logging_info) {}
366 LoggingInfo* logging_info_copy_;
void SetRewriterLoggingStatus(const char *rewriter_id, RewriterApplication::Status status)
void LogImageBackgroundRewriteActivity(RewriterApplication::Status status, const GoogleString &url, const char *id, int original_size, int optimized_size, bool is_recompressed, ImageType original_image_type, ImageType optimized_image_type, bool is_resized, int original_width, int original_height, bool is_resized_using_rendered_dimensions, int resized_width, int resized_height)
void LogRewriterHtmlStatus(const char *rewriter_id, RewriterHtmlApplication::Status status)
Simple AbstractLogRecord implementation which owns a LoggingInfo protobuf.
Definition: log_record.h:294
virtual void AddFoundPropertyToCohortInfo(int page_type, const GoogleString &cohort, const GoogleString &property)=0
RewriterInfo * NewRewriterInfo(const char *rewriter_id)
void SetAllowLoggingUrls(bool allow_logging_urls)
bool WriteLogImpl() override
Definition: log_record.h:342
Abstract interface for implementing a mutex.
Definition: abstract_mutex.h:28
void SetIsHtml(bool is_html)
Atomically sets is_html_response in the logging proto.
virtual void SetTimingInfo(const RequestTimingInfo &timing_info)
Set timing information in the logging implementation.
Definition: log_record.h:235
void LogJsDisableFilter(const char *id, bool has_pagespeed_no_defer)
Definition: log_record.h:59
void SetLogUrlIndices(bool log_url_indices)
void SetRewriterLoggingStatus(const char *rewriter_id, const GoogleString &url, RewriterApplication::Status status)
Definition: log_record.h:85
virtual void SetResourceCounts(int num_external_css, int num_scripts)
Sets the number of external resources on an HTML page.
Definition: log_record.h:305
virtual void AddRetrievedPropertyToCohortInfo(int page_type, const GoogleString &cohort, const GoogleString &property)
Definition: log_record.h:311
Definition: scoped_ptr.h:30
virtual bool WriteLogImpl()
Definition: log_record.h:360
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: request_timing_info.h:43
void SetIsOriginalResourceCacheable(bool cacheable)
virtual void LogImageRewriteActivity(const char *id, const GoogleString &url, RewriterApplication::Status status, bool is_image_inlined, bool is_critical_image, bool is_url_rewritten, int size, bool try_low_res_src_insertion, bool low_res_src_inserted, ImageType low_res_image_type, int low_res_data_size)=0
Log a RewriterInfo for the image rewrite filter.
virtual void SetResourceCounts(int num_external_css, int num_scripts)=0
Sets the number of external resources on an HTML page.
virtual void SetCacheStatusForCohortInfo(int page_type, const GoogleString &cohort, bool found, int key_state)=0
Updates the cohort info to update the cache key state.
GoogleString AppliedRewritersString()
void SetCriticalCssInfo(int critical_inlined_bytes, int original_external_bytes, int overhead_bytes)
Sets critical CSS related byte counts (all uncompressed).
AbstractMutex * mutex()
Definition: log_record.h:181
virtual void AddFoundPropertyToCohortInfo(int page_type, const GoogleString &cohort, const GoogleString &property)
Definition: log_record.h:307
virtual LoggingInfo * logging_info()=0
void SetNumCssCriticalImages(int num_css_critical_images)
Sets the number of critical images in CSS.
virtual void SetImageStats(int num_img_tags, int num_inlined_img_tags, int num_critical_images_used)=0
Sets image related statistics.
void SetRewriterInfoMaxSize(int x)
virtual void SetImageStats(int num_img_tags, int num_inlined_img_tags, int num_critical_images_used)
Sets image related statistics.
Definition: log_record.h:302
virtual bool WriteLogImpl()=0
void LogIsXhr(bool is_xhr)
Log whether the request is an XmlHttpRequest.
void SetNumHtmlCriticalImages(int num_html_critical_images)
Sets the number of critical images in HTML.
void LogRewriterApplicationStatus(const char *rewriter_id, RewriterApplication::Status status)
virtual void AddRetrievedPropertyToCohortInfo(int page_type, const GoogleString &cohort, const GoogleString &property)=0
void LogDeviceInfo(int device_type, bool supports_image_inlining, bool supports_lazyload_images, bool supports_critical_images_beacon, bool supports_deferjs, bool supports_webp_in_place, bool supports_webp_rewritten_urls, bool supports_webplossless_alpha, bool is_bot) override
Log information related to the user agent and device making the request.
Definition: log_record.h:331
virtual void LogDeviceInfo(int device_type, bool supports_image_inlining, bool supports_lazyload_images, bool supports_critical_images_beacon, bool supports_deferjs, bool supports_webp_in_place, bool supports_webp_rewritten_urls, bool supports_webplossless_alpha, bool is_bot)=0
Log information related to the user agent and device making the request.
LoggingInfo * logging_info()
Definition: log_record.h:300
AbstractLogRecord(AbstractMutex *mutex)
Definition: log_record.h:354
virtual void LogImageRewriteActivity(const char *id, const GoogleString &url, RewriterApplication::Status status, bool is_image_inlined, bool is_critical_image, bool is_url_rewritten, int size, bool try_low_res_src_insertion, bool low_res_src_inserted, ImageType low_res_image_type, int low_res_data_size)
Log a RewriterInfo for the image rewrite filter.
Definition: log_record.h:318
RewriterInfo * SetRewriterLoggingStatusHelper(const char *rewriter_id, const GoogleString &url, RewriterApplication::Status status)
void SetCacheStatusForCohortInfo(int page_type, const GoogleString &cohort, bool found, int key_state)
Updates the cohort info to update the cache key state.
Definition: log_record.h:315
virtual void SetBackgroundRewriteInfo(bool log_urls, bool log_url_indices, int max_rewrite_info_log_size)
Sets initial information for background rewrite log.