Compare commits

..

4 Commits

Author SHA1 Message Date
Umair Choudhary
9b06b71c34 added self time to profiler 2019-09-11 11:56:36 -04:00
Umair Choudhary
78cd06fb92 profiler 2019-09-10 15:38:54 -04:00
Umair Choudhary
ca6237cb33 render time attribute 2019-09-10 15:32:31 -04:00
Umair Choudhary
b9597b548c Add render time attr to profiler 2019-09-10 15:11:21 -04:00
5 changed files with 13 additions and 15 deletions

View File

@@ -106,9 +106,3 @@ template = Liquid::Template.parse("{{x}} {{y}}")
template.render!({ 'x' => 1}, { strict_variables: true })
#=> Liquid::UndefinedVariable: Liquid error: undefined variable y
```
### Usage tracking
To help track usages of a feature or code path in production, we have released opt-in usage tracking. To enable this, we provide an empty `Liquid:: Usage.increment` method which you can customize to your needs. The feature is well suited to https://github.com/Shopify/statsd-instrument. However, the choice of implementation is up to you.
Once you have enabled usage tracking, we recommend reporting any events through Github Issues that your system may be logging. It is highly likely this event has been added to consider deprecating or improving code specific to this event, so please raise any concerns.

View File

@@ -75,7 +75,6 @@ require 'liquid/utils'
require 'liquid/tokenizer'
require 'liquid/parse_context'
require 'liquid/partial_cache'
require 'liquid/usage'
# Load all the tags of the standard library
#

View File

@@ -44,7 +44,7 @@ module Liquid
include Enumerable
class Timing
attr_reader :code, :partial, :line_number, :children
attr_reader :code, :partial, :line_number, :children, :total_time, :self_time
def initialize(node, partial)
@code = node.respond_to?(:raw) ? node.raw : node
@@ -63,6 +63,18 @@ module Liquid
def finish
@end_time = Time.now
@total_time = @end_time - @start_time
if @children.size == 0
@self_time = @total_time
else
total_children_time = 0
@children.each do |child|
total_children_time += child.total_time
end
@self_time = @total_time - total_children_time
end
end
def render_time

View File

@@ -421,7 +421,6 @@ module Liquid
def default(input, default_value = ''.freeze)
if !input || input.respond_to?(:empty?) && input.empty?
Usage.increment("default_filter_received_false_value") if input == false # See https://github.com/Shopify/liquid/issues/1127
default_value
else
input

View File

@@ -1,6 +0,0 @@
module Liquid
module Usage
def self.increment(name)
end
end
end