opencensus 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +14 -3
  4. data/lib/opencensus.rb +12 -0
  5. data/lib/opencensus/common.rb +1 -0
  6. data/lib/opencensus/common/config.rb +1 -0
  7. data/lib/opencensus/config.rb +5 -3
  8. data/lib/opencensus/context.rb +1 -0
  9. data/lib/opencensus/stats.rb +1 -0
  10. data/lib/opencensus/tags.rb +1 -0
  11. data/lib/opencensus/trace.rb +31 -11
  12. data/lib/opencensus/trace/annotation.rb +1 -0
  13. data/lib/opencensus/trace/config.rb +13 -11
  14. data/lib/opencensus/trace/exporters.rb +1 -0
  15. data/lib/opencensus/trace/exporters/logger.rb +4 -3
  16. data/lib/opencensus/trace/exporters/multi.rb +1 -0
  17. data/lib/opencensus/trace/formatters.rb +3 -2
  18. data/lib/opencensus/trace/formatters/binary.rb +1 -0
  19. data/lib/opencensus/trace/formatters/cloud_trace.rb +1 -0
  20. data/lib/opencensus/trace/formatters/trace_context.rb +3 -2
  21. data/lib/opencensus/trace/integrations.rb +1 -0
  22. data/lib/opencensus/trace/integrations/faraday_middleware.rb +57 -21
  23. data/lib/opencensus/trace/integrations/rack_middleware.rb +11 -19
  24. data/lib/opencensus/trace/integrations/rails.rb +1 -0
  25. data/lib/opencensus/trace/link.rb +17 -7
  26. data/lib/opencensus/trace/message_event.rb +13 -3
  27. data/lib/opencensus/trace/samplers.rb +11 -7
  28. data/lib/opencensus/trace/samplers/always_sample.rb +1 -0
  29. data/lib/opencensus/trace/samplers/never_sample.rb +1 -0
  30. data/lib/opencensus/trace/samplers/probability.rb +13 -5
  31. data/lib/opencensus/trace/samplers/rate_limiting.rb +74 -0
  32. data/lib/opencensus/trace/span.rb +11 -5
  33. data/lib/opencensus/trace/span_builder.rb +84 -27
  34. data/lib/opencensus/trace/span_context.rb +76 -40
  35. data/lib/opencensus/trace/status.rb +227 -5
  36. data/lib/opencensus/trace/time_event.rb +1 -0
  37. data/lib/opencensus/trace/trace_context_data.rb +1 -0
  38. data/lib/opencensus/trace/truncatable_string.rb +1 -0
  39. data/lib/opencensus/version.rb +2 -1
  40. metadata +6 -6
  41. data/lib/opencensus/trace/samplers/max_qps.rb +0 -55
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module OpenCensus
16
17
  module Trace
17
18
  ##
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module OpenCensus
16
17
  module Trace
17
18
  ##
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module OpenCensus
16
17
  module Trace
17
18
  ##
@@ -12,7 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module OpenCensus
16
17
  ## Current OpenCensus version
17
- VERSION = "0.3.1".freeze
18
+ VERSION = "0.4.0".freeze
18
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencensus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-13 00:00:00.000000000 Z
12
+ date: 2018-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '0.52'
104
+ version: 0.59.2
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0.52'
111
+ version: 0.59.2
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: yard
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -177,9 +177,9 @@ files:
177
177
  - lib/opencensus/trace/message_event.rb
178
178
  - lib/opencensus/trace/samplers.rb
179
179
  - lib/opencensus/trace/samplers/always_sample.rb
180
- - lib/opencensus/trace/samplers/max_qps.rb
181
180
  - lib/opencensus/trace/samplers/never_sample.rb
182
181
  - lib/opencensus/trace/samplers/probability.rb
182
+ - lib/opencensus/trace/samplers/rate_limiting.rb
183
183
  - lib/opencensus/trace/span.rb
184
184
  - lib/opencensus/trace/span_builder.rb
185
185
  - lib/opencensus/trace/span_context.rb
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  requirements: []
210
210
  rubyforge_project:
211
- rubygems_version: 2.6.14
211
+ rubygems_version: 2.7.6
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: A stats collection and distributed tracing framework
@@ -1,55 +0,0 @@
1
- # Copyright 2017 OpenCensus Authors
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module OpenCensus
16
- module Trace
17
- module Samplers
18
- ##
19
- # The MaxQPS sampler delays a minimum amount of time between each sample,
20
- # enforcing a maximum QPS across traces that use this sampler.
21
- #
22
- class MaxQPS
23
- ##
24
- # Create a sampler for the given QPS.
25
- #
26
- # @param [Number] qps Samples per second. Default is 0.1.
27
- #
28
- def initialize qps = 0.1
29
- @delay_secs = 1.0 / qps
30
- @last_time = ::Time.now.to_f - @delay_secs
31
- end
32
-
33
- ##
34
- # Implements the sampler contract. Checks to see whether a sample
35
- # should be taken at this time.
36
- #
37
- # @return [boolean] Whether to sample at this time.
38
- #
39
- def call _opts = {}
40
- time = ::Time.now.to_f
41
- delays = (time - @last_time) / @delay_secs
42
- if delays >= 2.0
43
- @last_time = time - @delay_secs
44
- true
45
- elsif delays >= 1.0
46
- @last_time += @delay_secs
47
- true
48
- else
49
- false
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end