telemetry 1.1.15 → 1.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95925ee7b0d4a631d25365602f7c5731e4198497
4
- data.tar.gz: 1e6a00910d6d26a6964da216f412ba903a4ac4bd
3
+ metadata.gz: 61ce494e39c20a91da002a825fca096cb0f91169
4
+ data.tar.gz: e7929168331c150d1e12a91d6b84329b0892bc17
5
5
  SHA512:
6
- metadata.gz: ce1899599b5eda5507fd9f7c7fca12841b622153bfcacdda701d8abb4fb21832fc89b957f2ae59328d2c272a50726f750aa5fc9abf8e8a9b88399fdf4e6b8119
7
- data.tar.gz: 1f83affc0e23945b6bf92ea347cc3b49fa06ea7a2d2053d212b4f258b4dad9dbcf3ca7fb474b07b9a5f49e15fb9155a77da2820ed67362ba36e6c4d47c2efa24
6
+ metadata.gz: 82e7cfeb4ab001bac20043cd9c864f766a23dbf7163149d6bc9b2bc756290823cc196c3a3d85f3f0ca65778a57ea3b7b44a46464aec252d4bdbc962dc83086d3
7
+ data.tar.gz: f78f373ed23e021cf272d591cc192ed456dd6b8e656a1e1c6299db6849efbecd80ecf664a35a0ad269ee87f5681f2c2d50ced45580ffaffd3cfbbc9507bc862f
data/README.md CHANGED
@@ -50,13 +50,14 @@ For more information see the [affiliate documentation](https://admin.telemetryap
50
50
 
51
51
  Telemetry also supports a daemon mode where a binary (telemetryd) runs indefintely and loops through a configuration file triggering updates to the API as it goes.
52
52
 
53
- Create a config file on your disk (by default /etc/telemetryd_config.rb). This file may have ruby code in it, you may include your own gems, etc. The file supports two configuration directives "interval" and "api_token". The interval is how frequently each flow block is executed with the results sent to the server. Please note if the result from a block is unchanged from the previous execution then it will be sent to the server only once per day.
53
+ Create a config file on your disk (by default /etc/telemetryd_config.rb). This file may have ruby code in it, you may include your own gems, etc. The file supports three configuration directives "interval", "api_token" and "flows_expire_in". The interval is how frequently each flow block is executed with the results sent to the server. The flows_expire_in sets the expiry timout of the flows. If they do not get fresh data before that period of time the board will display and expired logo on their widgets. Please note if the result from a block is unchanged from the previous execution then it will be sent to the server only once per day when flows_expire_in is not set.
54
54
 
55
55
  For more details please see our website.
56
56
 
57
57
  Example simple config:
58
58
 
59
- interval 5
59
+ interval 5
60
+ flows_expire_in 300
60
61
  api_token "test-api-token"
61
62
 
62
63
  gauge "test-flow-gauge" do
@@ -18,6 +18,11 @@ module TelemetryDaemon
18
18
  @@interval = interval
19
19
  end
20
20
 
21
+ @@flows_expire_in = nil
22
+ def flows_expire_in(i)
23
+ @@flows_expire_in = i
24
+ end
25
+
21
26
  # Ensure a minimum of 1 second between loops
22
27
  def wait_for_interval_from(timestamp)
23
28
  @@interval ||= 60
@@ -34,9 +39,9 @@ module TelemetryDaemon
34
39
  x.each {|k,v| @@h[k.to_sym] = v}
35
40
  end
36
41
 
37
- # Code blocks users can call at the beginning and end of each interval
38
- @@begin_interval = nil
39
- @@end_interval = nil
42
+ # Code blocks users can call at the beginning and end of each interval
43
+ @@begin_interval = nil
44
+ @@end_interval = nil
40
45
 
41
46
  def begin_interval(&block)
42
47
  @@begin_interval = block
@@ -177,16 +182,16 @@ module TelemetryDaemon
177
182
  Telemetry::logger.debug "Task #{task[0]} #{task[1]} (every #{task[2]}s)"
178
183
  #Telemetry::logger.debug "Update frequency is #{frequency} now #{Time.now.to_i} next #{@@next_run_at[tag]}"
179
184
  if @@next_run_at[tag] && @@next_run_at[tag] > now.to_i
180
- puts " - Not scheduled yet (waiting #{-(now.to_i - @@next_run_at[tag])}s)"
185
+ Telemetry::logger.debug " - Not scheduled yet (waiting #{-(now.to_i - @@next_run_at[tag])}s)"
181
186
  next
182
187
  end
183
188
  @@next_run_at[tag] = now.to_i + frequency
184
189
 
185
190
  Telemetry::logger.debug " - Running intermittant task at #{now}"
186
191
 
187
- # If an offset is defined then align runtimes to the offset
188
- # How close you can get to the desired offset depends on the global interval. So set it relatively small
189
- # when using this feature
192
+ # If an offset is defined then align runtimes to the offset
193
+ # How close you can get to the desired offset depends on the global interval. So set it relatively small
194
+ # when using this feature
190
195
  if offset and offset >= 0 and offset <= 86400
191
196
  this_morning = Time.new(now.year, now.month, now.day).to_i
192
197
  time_since_offset = now.to_i - this_morning - offset
@@ -203,11 +208,16 @@ module TelemetryDaemon
203
208
  Telemetry.logger.debug " + Executing task #{task[0]} #{task[1]}"
204
209
  block.yield
205
210
 
206
- if @hh == {}
211
+ if @@h == {}
207
212
  Telemetry.logger.debug " - Skipping empty task values #{task[0]} #{task[1]}"
208
213
  next
209
214
  end
210
215
 
216
+ # Use global default to set expires_at field if necessary
217
+ if @@flows_expire_in and not @@h[:expires_at]
218
+ set expires_at: Time.now.to_i + @@flows_expire_in
219
+ end
220
+
211
221
  # Append the variant
212
222
  values = @@h.merge({variant: variant})
213
223
 
@@ -1,3 +1,3 @@
1
1
  module Telemetry
2
- TELEMETRY_VERSION = "1.1.15"
2
+ TELEMETRY_VERSION = "1.1.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telemetry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.15
4
+ version: 1.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - W. Gersham Meharg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2013-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj