Module: Labkit

Defined in:
lib/gitlab-labkit.rb,
lib/labkit/fips.rb,
lib/labkit/system.rb,
lib/labkit/context.rb,
lib/labkit/logging.rb,
lib/labkit/tracing.rb,
lib/labkit/middleware.rb,
lib/labkit/correlation.rb,
lib/labkit/logging/grpc.rb,
lib/labkit/tracing/grpc.rb,
lib/labkit/tracing/rails.rb,
lib/labkit/tracing/redis.rb,
lib/labkit/excon_publisher.rb,
lib/labkit/middleware/rack.rb,
lib/labkit/tracing/factory.rb,
lib/labkit/correlation/grpc.rb,
lib/labkit/logging/sanitizer.rb,
lib/labkit/middleware/sidekiq.rb,
lib/labkit/net_http_publisher.rb,
lib/labkit/logging/json_logger.rb,
lib/labkit/httpclient_publisher.rb,
lib/labkit/tracing/external_http.rb,
lib/labkit/tracing/tracing_utils.rb,
lib/labkit/tracing/jaeger_factory.rb,
lib/labkit/tracing/tracing_common.rb,
lib/labkit/tracing/rack_middleware.rb,
lib/labkit/tracing/grpc_interceptor.rb,
lib/labkit/middleware/sidekiq/client.rb,
lib/labkit/middleware/sidekiq/server.rb,
lib/labkit/tracing/rails/action_view.rb,
lib/labkit/correlation/correlation_id.rb,
lib/labkit/middleware/sidekiq/context.rb,
lib/labkit/middleware/sidekiq/tracing.rb,
lib/labkit/tracing/rails/active_record.rb,
lib/labkit/correlation/grpc/grpc_common.rb,
lib/labkit/tracing/rails/active_support.rb,
lib/labkit/tracing/abstract_instrumenter.rb,
lib/labkit/logging/grpc/server_interceptor.rb,
lib/labkit/tracing/grpc/client_interceptor.rb,
lib/labkit/tracing/grpc/server_interceptor.rb,
lib/labkit/tracing/redis/redis_interceptor.rb,
lib/labkit/middleware/sidekiq/context/client.rb,
lib/labkit/middleware/sidekiq/context/server.rb,
lib/labkit/middleware/sidekiq/tracing/client.rb,
lib/labkit/middleware/sidekiq/tracing/server.rb,
lib/labkit/correlation/grpc/client_interceptor.rb,
lib/labkit/correlation/grpc/server_interceptor.rb,
lib/labkit/tracing/rails/action_view/subscriber.rb,
lib/labkit/tracing/rails/active_record/subscriber.rb,
lib/labkit/tracing/redis/redis_interceptor_helper.rb,
lib/labkit/tracing/rails/active_support/subscriber.rb,
lib/labkit/middleware/sidekiq/tracing/sidekiq_common.rb,
lib/labkit/tracing/external_http/request_instrumenter.rb,
lib/labkit/tracing/rails/active_record/sql_instrumenter.rb,
lib/labkit/tracing/rails/active_support/cache_read_instrumenter.rb,
lib/labkit/tracing/rails/action_view/render_partial_instrumenter.rb,
lib/labkit/tracing/rails/active_support/cache_write_instrumenter.rb,
lib/labkit/tracing/rails/action_view/render_template_instrumenter.rb,
lib/labkit/tracing/rails/active_support/cache_delete_instrumenter.rb,
lib/labkit/tracing/rails/action_view/render_collection_instrumenter.rb,
lib/labkit/tracing/rails/active_support/cache_generate_instrumenter.rb,
lib/labkit/tracing/rails/active_support/cache_fetch_hit_instrumenter.rb

Overview

LabKit is a module for handling cross-project infrastructural concerns, partcularly related to observability.

Defined Under Namespace

Modules: Correlation, Digest, HTTPClientPublisher, Logging, Middleware, NetHttpPublisher, System, Tracing Classes: Context, ExconPublisher, FIPS

Constant Summary collapse

EXTERNAL_HTTP_NOTIFICATION_TOPIC =

Publishers to publish notifications whenever a HTTP reqeust is made. A broadcasted notification’s payload in topic “request.external_http” includes:

+ method (String): "GET"
+ code (String): "200" # This is the status code read directly from HTTP response
+ duration (Float - seconds): 0.234
+ host (String): "gitlab.com"
+ port (Integer): 80,
+ path (String): "/gitlab-org/gitlab"
+ scheme (String): "https"
+ query (String): "field_a=1&field_b=2"
+ fragment (String): "issue-number-1"
+ proxy_host (String - Optional): "proxy.gitlab.com"
+ proxy_port (Integer - Optional): 80
+ exception (Array<String> - Optional): ["Net::ReadTimeout", "Net::ReadTimeout with #<TCPSocket:(closed)>"]
+ exception_object (Error Object - Optional): #<Net::ReadTimeout: Net::ReadTimeout>

Usage:

ActiveSupport::Notifications.subscribe “request.external_http” do |name, started, finished, unique_id, data|

puts "#{name} | #{started} | #{finished} | #{unique_id} | #{data.inspect}"

end

"request.external_http"