gruf-lightstep 1.1.3 → 1.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: 12d9f9cbde62cbf6a401007a5e28fe681f5333ac991c8416b562c033427fcfd5
4
- data.tar.gz: 44d4820e0dec9ea21729e1be9910936011b6b80adb5dc7fc1d3d1140ddd10979
3
+ metadata.gz: 03171299f85c9b42debe5369c906caf4c48fd658c593e5d352cbde7d4b2cacfe
4
+ data.tar.gz: 4d877406f1f62a6830dd5716beae9b3856f7788771e62036bf86a949f613fb27
5
5
  SHA512:
6
- metadata.gz: aa69fad407c12201bde6635e3a3ce1fb95904c8a3107b9cd0782c21047278cc6324545997646800be0ab6eae1274cf30862235800a2ed9723f93c950e8c5b329
7
- data.tar.gz: 8acecdf8e4ea04dd3b50e257c124f17cb47416c1c30598694c160a76d3e505b266d0dd05f7e11255ba69be22155eaa85f8142509f9e4c880fc58a65ab9c11ab0
6
+ metadata.gz: f4d188c2a0a91c11f5d9aa6ffd47617116171a78c766d40612a54e515f2182925f9e451ee77eeb99db0ffed12f2d7e35f5f70adf87f3bbb6d894b8c80b55e080
7
+ data.tar.gz: af7280d6b9c409234d199e450e3cfd656f9ed86b5a3bb02fe39e5dbbe244f2b888026a56635a91fa70f3f16189a4bc8058247a19dd813d512e480991246fef12
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ Changelog for the gruf-zipkin gem.
2
2
 
3
3
  h3. Pending Release
4
4
 
5
+ h3. 1.2.0
6
+
7
+ - Add `frozen_string_literal: true` to all files
8
+ - Deprecate ruby 2.2 support
9
+
5
10
  h3. 1.1.3
6
11
 
7
12
  - Bump bc-lightstep-ruby to 1.2.0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # gruf-lightstep - LightStep tracing for gruf
2
2
 
3
- [![Build Status](https://travis-ci.com/bigcommerce/gruf-lightstep.svg?branch=master)](https://travis-ci.com/bigcommerce/gruf-lightstep) [![Gem Version](https://badge.fury.io/rb/gruf-lightstep.svg)](https://badge.fury.io/rb/gruf-lightstep) [![Inline docs](http://inch-ci.org/github/bigcommerce/gruf-lightstep.svg?branch=master)](http://inch-ci.org/github/bigcommerce/gruf-lightstep)
3
+ [![CircleCI](https://circleci.com/gh/bigcommerce/gruf-lightstep/tree/master.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf-lightstep/tree/master) [![Gem Version](https://badge.fury.io/rb/gruf-lightstep.svg)](https://badge.fury.io/rb/gruf-lightstep) [![Inline docs](http://inch-ci.org/github/bigcommerce/gruf-lightstep.svg?branch=master)](http://inch-ci.org/github/bigcommerce/gruf-lightstep)
4
4
 
5
5
  Adds LightStep tracing support for [gruf](https://github.com/bigcommerce/gruf) 2.0.0+.
6
6
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -42,7 +44,7 @@ module Gruf
42
44
  return unless tracer
43
45
 
44
46
  span = tracer.active_span
45
- return unless span && span.is_a?(::LightStep::Span)
47
+ return unless span&.is_a?(::LightStep::Span)
46
48
 
47
49
  span
48
50
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -21,6 +23,7 @@ module Gruf
21
23
  #
22
24
  module Configuration
23
25
  VALID_CONFIG_KEYS = {
26
+ default_error_code: GRPC::Core::StatusCodes::INTERNAL
24
27
  }.freeze
25
28
 
26
29
  attr_accessor *VALID_CONFIG_KEYS.keys
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -25,11 +27,11 @@ module Gruf
25
27
  # @property [Hash<Symbol|Array<String>>] Hash mapping of metadata keys
26
28
  #
27
29
  OT_KEYS = {
28
- parent_span_id: %w(ot-tracer-parentspanid OT-Tracer-ParentSpanId HTTP_X_OT_TRACER_PARENTSPANID),
29
- span_id: %w(ot-tracer-spanid OT-Tracer-SpanId HTTP_X_OT_TRACER_SPANID),
30
- trace_id: %w(ot-tracer-traceid OT-Tracer-TraceId HTTP_X_OT_TRACER_TRACEID),
31
- sampled: %w(ot-tracer-sampled OT-Tracer-Sampled HTTP_X_OT_TRACER_SAMPLED),
32
- flags: %w(ot-tracer-flags OT-Tracer-Flags HTTP_X_OT_TRACER_FLAGS)
30
+ parent_span_id: %w[ot-tracer-parentspanid OT-Tracer-ParentSpanId HTTP_X_OT_TRACER_PARENTSPANID],
31
+ span_id: %w[ot-tracer-spanid OT-Tracer-SpanId HTTP_X_OT_TRACER_SPANID],
32
+ trace_id: %w[ot-tracer-traceid OT-Tracer-TraceId HTTP_X_OT_TRACER_TRACEID],
33
+ sampled: %w[ot-tracer-sampled OT-Tracer-Sampled HTTP_X_OT_TRACER_SAMPLED],
34
+ flags: %w[ot-tracer-flags OT-Tracer-Flags HTTP_X_OT_TRACER_FLAGS]
33
35
  }.freeze
34
36
 
35
37
  delegate :has_key?, :key?, to: :metadata
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -46,7 +48,7 @@ module Gruf
46
48
  rescue StandardError => e
47
49
  span.set_tag('error', true) if error?(e)
48
50
  span.set_tag('grpc.error', true)
49
- span.set_tag('grpc.error_code', e.code)
51
+ span.set_tag('grpc.error_code', code_for(e))
50
52
  span.set_tag('grpc.error_class', e.class)
51
53
  raise # passthrough, we just want the annotations
52
54
  end
@@ -56,6 +58,14 @@ module Gruf
56
58
 
57
59
  private
58
60
 
61
+ ##
62
+ # @param [StandardError]
63
+ # @return [Number] that maps to one of the GRCP::Core::StatusCodes or Gruf::Lightstep.default_error_code
64
+ #
65
+ def code_for(error)
66
+ error.respond_to?(:code) ? error.code : Gruf::Lightstep.default_error_code
67
+ end
68
+
59
69
  ##
60
70
  # @return [Gruf::Lightstep::Method]
61
71
  #
@@ -83,7 +93,7 @@ module Gruf
83
93
  # @return [Array]
84
94
  #
85
95
  def error_classes
86
- options.fetch(:error_classes, %w(GRPC::Unknown GRPC::Internal GRPC::DataLoss GRPC::FailedPrecondition GRPC::Unavailable GRPC::DeadlineExceeded GRPC::Cancelled))
96
+ options.fetch(:error_classes, %w[GRPC::Unknown GRPC::Internal GRPC::DataLoss GRPC::FailedPrecondition GRPC::Unavailable GRPC::DeadlineExceeded GRPC::Cancelled])
87
97
  end
88
98
  end
89
99
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -15,6 +17,6 @@
15
17
  #
16
18
  module Gruf
17
19
  module Lightstep
18
- VERSION = '1.1.3'.freeze
20
+ VERSION = '1.2.0'
19
21
  end
20
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf-lightstep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2019-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler