gruf-lightstep 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/gruf-lightstep.gemspec +2 -0
- data/lib/gruf/lightstep.rb +2 -0
- data/lib/gruf/lightstep/client_interceptor.rb +3 -1
- data/lib/gruf/lightstep/configuration.rb +3 -0
- data/lib/gruf/lightstep/headers.rb +7 -5
- data/lib/gruf/lightstep/method.rb +2 -0
- data/lib/gruf/lightstep/server_interceptor.rb +12 -2
- data/lib/gruf/lightstep/version.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03171299f85c9b42debe5369c906caf4c48fd658c593e5d352cbde7d4b2cacfe
|
4
|
+
data.tar.gz: 4d877406f1f62a6830dd5716beae9b3856f7788771e62036bf86a949f613fb27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d188c2a0a91c11f5d9aa6ffd47617116171a78c766d40612a54e515f2182925f9e451ee77eeb99db0ffed12f2d7e35f5f70adf87f3bbb6d894b8c80b55e080
|
7
|
+
data.tar.gz: af7280d6b9c409234d199e450e3cfd656f9ed86b5a3bb02fe39e5dbbe244f2b888026a56635a91fa70f3f16189a4bc8058247a19dd813d512e480991246fef12
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gruf-lightstep - LightStep tracing for gruf
|
2
2
|
|
3
|
-
[![
|
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
|
|
data/gruf-lightstep.gemspec
CHANGED
data/lib/gruf/lightstep.rb
CHANGED
@@ -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
|
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
|
29
|
-
span_id: %w
|
30
|
-
trace_id: %w
|
31
|
-
sampled: %w
|
32
|
-
flags: %w
|
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
|
@@ -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
|
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
|
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.
|
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.
|
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:
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|