logstash-input-google-analytics-daily 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5471c06b1f81388b3cbbbe7cadcf3e354e61e5f09c53d56c3297b00d17a2e8cd
|
4
|
+
data.tar.gz: 2a8510d9363641750352dd1c9b1d9d6d04a7de64fd9965794bb1cf0d67720684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c78a38bb95ee7045d97a188712264fe7e08c103f002dcfbd0ba531c57bc7bffc0615f1f3cd91c0a5c8bfbcebdbf78ad21e08812a9805c01e3f0fced513f08df
|
7
|
+
data.tar.gz: ee10c1d0aec27733e4a344152dd983ecc85db36865de934d040923ee26e73e2332b667040d13566606f6bc392d46ce5c6c07422b7dc067de1d49265518e7cf18
|
@@ -29,9 +29,9 @@ class LogStash::Inputs::GoogleAnalyticsDaily < LogStash::Inputs::Base
|
|
29
29
|
|
30
30
|
# This plugin will fetch daily reports for dates in the specified range
|
31
31
|
# In the format YYYY-MM-DD
|
32
|
-
config :start_date, :validate => :string, :default =>
|
32
|
+
config :start_date, :validate => :string, :default => nil
|
33
33
|
|
34
|
-
config :end_date, :validate => :string, :default =>
|
34
|
+
config :end_date, :validate => :string, :default => nil
|
35
35
|
|
36
36
|
# The aggregated statistics for user activity to your site, such as clicks or pageviews.
|
37
37
|
# Maximum of 10 metrics for any query
|
@@ -83,7 +83,7 @@ class LogStash::Inputs::GoogleAnalyticsDaily < LogStash::Inputs::Base
|
|
83
83
|
|
84
84
|
# Interval to run the command. Value is in seconds. If no interval is given,
|
85
85
|
# this plugin only fetches data once.
|
86
|
-
config :interval, :validate => :number, :required => false, :default => 60 * 60
|
86
|
+
config :interval, :validate => :number, :required => false, :default => 60 * 60 # Daily
|
87
87
|
|
88
88
|
|
89
89
|
public
|
@@ -94,11 +94,16 @@ class LogStash::Inputs::GoogleAnalyticsDaily < LogStash::Inputs::Base
|
|
94
94
|
def run(queue)
|
95
95
|
# we abort the loop if stop? becomes true
|
96
96
|
while !stop?
|
97
|
-
|
97
|
+
plugin_start_time = Time.now
|
98
98
|
|
99
99
|
analytics = get_service
|
100
100
|
|
101
|
-
|
101
|
+
# Setting this here, not in the config at the top,
|
102
|
+
# because we need to reset the date for each new loop (new day)
|
103
|
+
start_date = @start_date || (Date.today - 1).to_s
|
104
|
+
end_date = @end_date || (Date.today - 1).to_s
|
105
|
+
|
106
|
+
@dates = (Date.parse(start_date)..Date.parse(end_date))
|
102
107
|
|
103
108
|
@dates.each do |date|
|
104
109
|
date = date.to_s
|
@@ -203,7 +208,7 @@ class LogStash::Inputs::GoogleAnalyticsDaily < LogStash::Inputs::Base
|
|
203
208
|
break
|
204
209
|
else
|
205
210
|
# Otherwise we sleep till the next run
|
206
|
-
time_lapsed = Time.now -
|
211
|
+
time_lapsed = Time.now - plugin_start_time
|
207
212
|
# Sleep for the remainder of the interval, or 0 if the duration ran
|
208
213
|
# longer than the interval.
|
209
214
|
time_to_sleep_for = [0, @interval - time_lapsed].max
|
@@ -214,6 +219,9 @@ class LogStash::Inputs::GoogleAnalyticsDaily < LogStash::Inputs::Base
|
|
214
219
|
:interval => @interval
|
215
220
|
)
|
216
221
|
else
|
222
|
+
@logger.info(
|
223
|
+
"Sleeping for #{@interval} seconds"
|
224
|
+
)
|
217
225
|
Stud.stoppable_sleep(time_to_sleep_for) { stop? }
|
218
226
|
end
|
219
227
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-google-analytics-daily'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.7.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Logstash plugin to pull daily reports from Google Analytics."
|
6
6
|
s.description = "Logstash plugin to pull daily reports from the Google Analytics v3 Core Reporting API. Install into Logstash using $LS_HOME/bin/logstash-plugin install logstash-input-google-analytics-daily."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-google-analytics-daily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shalvah
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|