This repository was archived by the owner on Jun 2, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +51
-1
lines changed
Expand file tree Collapse file tree 5 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ gem 'eventmachine', '~> 1.0.9'
1010gem 'fluent-logger'
1111gem 'googleapis-common-protos'
1212gem 'hashdiff'
13+ gem 'honeycomb-beeline'
1314gem 'httpclient'
1415gem 'json-diff'
1516gem 'json-schema'
Original file line number Diff line number Diff line change 227227 google-protobuf (~> 3.1 )
228228 googleapis-common-protos-types (~> 1.0.0 )
229229 hashdiff (0.3.8 )
230+ honeycomb-beeline (2.2.0 )
231+ libhoney (~> 1.14 , >= 1.14.2 )
230232 http (4.4.1 )
231233 addressable (~> 2.3 )
232234 http-cookie (~> 1.0 )
258260 jsonpath (~> 1.0 )
259261 recursive-open-struct (~> 1.1 , >= 1.1.1 )
260262 rest-client (~> 2.0 )
263+ libhoney (1.14.6 )
264+ addressable (~> 2.0 )
265+ http (>= 2.0 , < 5.0 )
261266 listen (3.2.1 )
262267 rb-fsevent (~> 0.10 , >= 0.10.3 )
263268 rb-inotify (~> 0.9 , >= 0.9.10 )
@@ -530,6 +535,7 @@ DEPENDENCIES
530535 fog-openstack
531536 googleapis-common-protos
532537 hashdiff
538+ honeycomb-beeline
533539 httpclient
534540 json-diff
535541 json-schema
Original file line number Diff line number Diff line change 1+ require 'honeycomb-beeline'
2+
3+ module CCInitializers
4+ def self . honeycomb ( cc_config )
5+ if cc_config [ :honeycomb ]
6+ Honeycomb . configure do |hc |
7+ hc . write_key = cc_config [ :honeycomb ] [ :write_key ]
8+ hc . dataset = cc_config [ :honeycomb ] [ :dataset ]
9+ hc . sample_hook do |fields |
10+ CustomSampler . sample ( fields )
11+ end
12+ end
13+ end
14+ end
15+ end
16+
17+ class CustomSampler
18+ extend Honeycomb ::DeterministicSampler
19+ def self . sample ( fields )
20+ sample_rate = 1
21+ # Remove this if you want a closer look at our DB calls
22+ if fields [ 'meta.package' ] == 'sequel'
23+ return [ false , 0 ]
24+ end
25+
26+ # These calls will dominate the dataset if you don't filter them
27+ if fields [ 'request.path' ] == '/healthz' && fields [ 'response.status_code' ] == 200
28+ return [ false , 0 ]
29+ end
30+
31+ if should_sample ( sample_rate , fields [ 'trace.trace_id' ] )
32+ return [ true , sample_rate ]
33+ end
34+
35+ return [ false , 0 ]
36+ end
37+ end
Original file line number Diff line number Diff line change @@ -343,6 +343,11 @@ class ApiSchema < VCAP::Config
343343 default_app_lifecycle : String ,
344344 custom_metric_tag_prefix_list : Array ,
345345
346+ optional ( :honeycomb ) => {
347+ write_key : String ,
348+ dataset : String ,
349+ } ,
350+
346351 optional ( :kubernetes ) => {
347352 host_url : String ,
348353 service_account : {
@@ -388,7 +393,7 @@ class ApiSchema < VCAP::Config
388393 auth_user : String ,
389394 auth_password : String ,
390395 } ,
391- ) ,
396+ ) ,
392397
393398 }
394399 end
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def build(config, request_metrics)
2121 use CloudFoundry ::Middleware ::Cors , config . get ( :allowed_cors_domains )
2222 use CloudFoundry ::Middleware ::VcapRequestId
2323 use CloudFoundry ::Middleware ::NewRelicCustomAttributes if config . get ( :newrelic_enabled )
24+ use Honeycomb ::Rack ::Middleware , client : Honeycomb . client if config . get ( :honeycomb )
2425 use CloudFoundry ::Middleware ::SecurityContextSetter , configurer
2526 use CloudFoundry ::Middleware ::RequestLogs , Steno . logger ( 'cc.api' )
2627 if config . get ( :rate_limiter , :enabled )
You can’t perform that action at this time.
0 commit comments