opencensus 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +23 -0
- data/README.md +14 -3
- data/lib/opencensus.rb +12 -0
- data/lib/opencensus/common.rb +1 -0
- data/lib/opencensus/common/config.rb +1 -0
- data/lib/opencensus/config.rb +5 -3
- data/lib/opencensus/context.rb +1 -0
- data/lib/opencensus/stats.rb +1 -0
- data/lib/opencensus/tags.rb +1 -0
- data/lib/opencensus/trace.rb +31 -11
- data/lib/opencensus/trace/annotation.rb +1 -0
- data/lib/opencensus/trace/config.rb +13 -11
- data/lib/opencensus/trace/exporters.rb +1 -0
- data/lib/opencensus/trace/exporters/logger.rb +4 -3
- data/lib/opencensus/trace/exporters/multi.rb +1 -0
- data/lib/opencensus/trace/formatters.rb +3 -2
- data/lib/opencensus/trace/formatters/binary.rb +1 -0
- data/lib/opencensus/trace/formatters/cloud_trace.rb +1 -0
- data/lib/opencensus/trace/formatters/trace_context.rb +3 -2
- data/lib/opencensus/trace/integrations.rb +1 -0
- data/lib/opencensus/trace/integrations/faraday_middleware.rb +57 -21
- data/lib/opencensus/trace/integrations/rack_middleware.rb +11 -19
- data/lib/opencensus/trace/integrations/rails.rb +1 -0
- data/lib/opencensus/trace/link.rb +17 -7
- data/lib/opencensus/trace/message_event.rb +13 -3
- data/lib/opencensus/trace/samplers.rb +11 -7
- data/lib/opencensus/trace/samplers/always_sample.rb +1 -0
- data/lib/opencensus/trace/samplers/never_sample.rb +1 -0
- data/lib/opencensus/trace/samplers/probability.rb +13 -5
- data/lib/opencensus/trace/samplers/rate_limiting.rb +74 -0
- data/lib/opencensus/trace/span.rb +11 -5
- data/lib/opencensus/trace/span_builder.rb +84 -27
- data/lib/opencensus/trace/span_context.rb +76 -40
- data/lib/opencensus/trace/status.rb +227 -5
- data/lib/opencensus/trace/time_event.rb +1 -0
- data/lib/opencensus/trace/trace_context_data.rb +1 -0
- data/lib/opencensus/trace/truncatable_string.rb +1 -0
- data/lib/opencensus/version.rb +2 -1
- metadata +6 -6
- data/lib/opencensus/trace/samplers/max_qps.rb +0 -55
data/lib/opencensus/version.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
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
|
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
|