opencensus-stackdriver 0.1.2 → 0.2.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: 6648ab08a2f19dcc8378487f54025f43d3f0fbbf5144582a095eb1df50d899a8
4
- data.tar.gz: b35b154b195811a9fc6a69cbdf553825f59818390a8e80dbbd9d7138767c8934
3
+ metadata.gz: de5d4705ab7b4fa7150e3b561d6f9c13767ac11421cb5a0c46d1fa0d74b1d755
4
+ data.tar.gz: e01dec6e909b19e2eddbecc0fa325b0d57c8218ac62dbab45c11b025d628d941
5
5
  SHA512:
6
- metadata.gz: 59d6285c74a85ed961450af1a9d847c436aecd190ad7afae0c76206e0eb33fb7d30eecaa382ab8039a668d8f232a574c5bad65a6b24641d399a57b5fd973db16
7
- data.tar.gz: 4559660ff5249c3535b42f4e813c1b93adf026d07c152d855d3c86cd18768fb5d6bd6a6d3430807cc89dbd63c3eb129b4ac949524ee43ca86e3f760bf5b2b0f0
6
+ metadata.gz: 3dca3bcb5eb051ff45c181946e29e7a68e3a961ac818129c8de72dd83cae673a435878e4089a6875e57408b9a344a4c47bee0eac1a8d8d51e900a73d9a2237df
7
+ data.tar.gz: 65d28205b8301f9a7b9e074428e5ba4e44c4380303762e8fb2f17219b7ef0985f494801dff38a6fb87b2899573795f1f6ffac3c5ae3ffb9ffa1055dd0ed2c650
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Release History
2
2
 
3
+ ### 0.2.0 / 2018-10-22
4
+
5
+ This release requires version 0.4 or later of the opencensus gem.
6
+
7
+ * Map standard HTTP attributes from OpenCensus names to Stackdriver names.
8
+ * Fixed thread pool size configuration.
9
+
3
10
  ### 0.1.2 / 2018-05-22
4
11
 
5
12
  * Add agent identifier and version attribute to reported spans.
@@ -12,4 +12,16 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
16
+ ##
17
+ # OpenCensus is a vendor-agnostic single distribution of libraries to provide
18
+ # metrics collection and tracing for your services. See https://opencensus.io/
19
+ # for general information on OpenCensus.
20
+ #
21
+ # The Stackdriver Trace plugin for OpenCensus is implemented in the
22
+ # {OpenCensus::Trace::Exporters::Stackdriver} class.
23
+ #
24
+ module OpenCensus
25
+ end
26
+
15
27
  require "opencensus/stackdriver"
@@ -12,10 +12,17 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require "opencensus"
16
17
 
17
18
  module OpenCensus
18
- ## Information about the Stackdriver exporter plugin
19
+ ##
20
+ # The Stackdriver exporter plugin for OpenCensus exports OpenCensus trace and
21
+ # stats information to Stackdriver Trace and Monitoring services.
22
+ #
23
+ # The Stackdriver Trace plugin for OpenCensus is implemented in the
24
+ # {OpenCensus::Trace::Exporters::Stackdriver} class.
25
+ #
19
26
  module Stackdriver
20
27
  end
21
28
  end
@@ -12,9 +12,10 @@
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 Stackdriver
17
18
  ## Current OpenCensus Stackdriver plugin version
18
- VERSION = "0.1.2".freeze
19
+ VERSION = "0.2.0".freeze
19
20
  end
20
21
  end
@@ -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
  gem "google-cloud-trace"
16
17
  gem "concurrent-ruby"
17
18
 
@@ -20,7 +21,13 @@ require "google/cloud/trace"
20
21
  require "google/cloud/trace/v2"
21
22
 
22
23
  module OpenCensus
24
+ ##
25
+ # OpenCensus Trace provides a standard interface for distributed tracing.
26
+ #
23
27
  module Trace
28
+ ##
29
+ # The exporters module is a namespace for trace exporters.
30
+ #
24
31
  module Exporters
25
32
  ##
26
33
  # The Stackdriver exporter for OpenCensus Trace exports captured spans
@@ -191,7 +198,7 @@ module OpenCensus
191
198
  def create_executor max_threads, max_queue
192
199
  if max_threads >= 1
193
200
  Concurrent::ThreadPoolExecutor.new \
194
- min_length: 1, max_length: max_threads,
201
+ min_threads: 1, max_threads: max_threads,
195
202
  max_queue: max_queue, fallback_policy: :caller_runs,
196
203
  auto_terminate: false
197
204
  else
@@ -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
  require "google/devtools/cloudtrace/v2/trace_pb"
16
17
  require "google/protobuf/well_known_types"
17
18
 
@@ -52,6 +53,20 @@ module OpenCensus
52
53
  "opencensus-ruby [#{::OpenCensus::VERSION}] ruby-stackdriver-" \
53
54
  "exporter [#{::OpenCensus::Stackdriver::VERSION}]"
54
55
 
56
+ ##
57
+ # @private
58
+ # Mapping for certain well-known attributes defined in
59
+ # https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md
60
+ #
61
+ ATTRIBUTE_NAME_MAPPING = {
62
+ "http.host" => "/http/host",
63
+ "http.method" => "/http/method",
64
+ "http.path" => "/http/path",
65
+ "http.route" => "/http/route",
66
+ "http.user_agent" => "/http/user_agent",
67
+ "http.status_code" => "/http/status_code"
68
+ }.freeze
69
+
55
70
  ##
56
71
  # Create a converter
57
72
  #
@@ -170,6 +185,16 @@ module OpenCensus
170
185
  end
171
186
  end
172
187
 
188
+ ##
189
+ # Map OpenCensus attribute name to Stackdriver Trace name.
190
+ #
191
+ # @param [String] name OpenCensus attribute name
192
+ # @return [String] Corresponding Stackdriver Trace attribute.
193
+ #
194
+ def convert_attribute_name name
195
+ ATTRIBUTE_NAME_MAPPING[name] || name
196
+ end
197
+
173
198
  ##
174
199
  # Convert an attributes hash
175
200
  #
@@ -187,7 +212,8 @@ module OpenCensus
187
212
  attribute_map[AGENT_KEY] = convert_attribute_value AGENT_VALUE
188
213
  end
189
214
  attributes.each do |k, v|
190
- attribute_map[k] = convert_attribute_value v
215
+ attribute_map[convert_attribute_name k] =
216
+ convert_attribute_value v
191
217
  end
192
218
  TraceProtos::Span::Attributes.new \
193
219
  attribute_map: attribute_map,
@@ -347,6 +373,7 @@ module OpenCensus
347
373
  #
348
374
  def convert_optional_status status
349
375
  return nil if status.nil?
376
+
350
377
  Google::Rpc::Status.new code: status.code, message: status.message
351
378
  end
352
379
 
@@ -358,6 +385,7 @@ module OpenCensus
358
385
  #
359
386
  def convert_optional_bool value
360
387
  return nil if value.nil?
388
+
361
389
  Google::Protobuf::BoolValue.new value: value
362
390
  end
363
391
 
@@ -369,6 +397,7 @@ module OpenCensus
369
397
  #
370
398
  def convert_optional_int32 value
371
399
  return nil if value.nil?
400
+
372
401
  Google::Protobuf::Int32Value.new value: value
373
402
  end
374
403
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencensus-stackdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-22 00:00:00.000000000 Z
11
+ date: 2018-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.31'
33
+ version: '0.33'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.31'
40
+ version: '0.33'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opencensus
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.3'
47
+ version: '0.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.3'
54
+ version: '0.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.52'
145
+ version: 0.59.2
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.52'
152
+ version: 0.59.2
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement