hyperprobe-agent 1.2.27.pre.1
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 +7 -0
- data/LICENSE +13 -0
- data/README.md +157 -0
- data/lib/hyperprobe/agent.rb +438 -0
- data/lib/hyperprobe/core/broker.rb +213 -0
- data/lib/hyperprobe/core/evaluator.rb +128 -0
- data/lib/hyperprobe/core/logger.rb +177 -0
- data/lib/hyperprobe/core/monitoring_engine.rb +683 -0
- data/lib/hyperprobe/core/quota.rb +111 -0
- data/lib/hyperprobe/core/safe_ast_validator.rb +91 -0
- data/lib/hyperprobe/core/safety.rb +179 -0
- data/lib/hyperprobe/core/serializer.rb +425 -0
- data/lib/hyperprobe/core/trace_extractor.rb +158 -0
- data/lib/hyperprobe/lambda.rb +90 -0
- data/lib/hyperprobe/protos/agent_pb.rb +33 -0
- data/lib/hyperprobe/protos/agent_services_pb.rb +31 -0
- data/lib/hyperprobe/protos.rb +14 -0
- data/lib/hyperprobe/railtie.rb +16 -0
- data/lib/hyperprobe/version.rb +5 -0
- data/lib/hyperprobe-agent.rb +3 -0
- data/lib/hyperprobe.rb +153 -0
- metadata +149 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: agent.proto
|
|
4
|
+
|
|
5
|
+
require 'google/protobuf'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x0b\x61gent.proto\x12\x13hyperprobe.agent.v1\"\x9c\x01\n\x10GetProbesRequest\x12\x10\n\x08\x61gent_id\x18\x01 \x01(\t\x12\x12\n\nservice_id\x18\x02 \x01(\t\x12\x13\n\x0b\x65nvironment\x18\x03 \x01(\t\x12\x12\n\ncommit_sha\x18\x04 \x01(\t\x12\x10\n\x08language\x18\x05 \x01(\t\x12\x15\n\ragent_version\x18\x06 \x01(\t\x12\x10\n\x08hostname\x18\x07 \x01(\t\"\xbc\x01\n\x11GetProbesResponse\x12*\n\x06probes\x18\x01 \x03(\x0b\x32\x1a.hyperprobe.agent.v1.Probe\x12\"\n\x15next_sync_interval_ms\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12=\n\rglobal_config\x18\x03 \x01(\x0b\x32&.hyperprobe.agent.v1.AgentGlobalConfigB\x18\n\x16_next_sync_interval_ms\"U\n\x16SourceMapStatusRequest\x12\x12\n\nservice_id\x18\x01 \x01(\t\x12\x13\n\x0b\x65nvironment\x18\x02 \x01(\t\x12\x12\n\ncommit_sha\x18\x03 \x01(\t\"C\n\x17SourceMapStatusResponse\x12\x13\n\x0bis_uploader\x18\x01 \x01(\x08\x12\x13\n\x0bis_complete\x18\x02 \x01(\x08\"n\n\x0eSourceMapChunk\x12\x12\n\nservice_id\x18\x01 \x01(\t\x12\x13\n\x0b\x65nvironment\x18\x02 \x01(\t\x12\x12\n\ncommit_sha\x18\x03 \x01(\t\x12\x11\n\tfile_name\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x05 \x01(\x0c\"!\n\x0eUploadResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"[\n\x1cMarkSourceMapCompleteRequest\x12\x12\n\nservice_id\x18\x01 \x01(\t\x12\x13\n\x0b\x65nvironment\x18\x02 \x01(\t\x12\x12\n\ncommit_sha\x18\x03 \x01(\t\"0\n\x1dMarkSourceMapCompleteResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"\x85\x03\n\x11\x41gentGlobalConfig\x12\x13\n\x0bredact_keys\x18\x01 \x03(\t\x12\x15\n\rredact_values\x18\x02 \x03(\t\x12\x1d\n\x10max_object_depth\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10max_array_length\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x1e\n\x11stack_frame_depth\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\"\n\x15max_object_properties\x18\x06 \x01(\x05H\x03\x88\x01\x01\x12\x1e\n\x11max_string_length\x18\x07 \x01(\x05H\x04\x88\x01\x01\x12\x1d\n\x10\x63\x61pture_closures\x18\x08 \x01(\x08H\x05\x88\x01\x01\x42\x13\n\x11_max_object_depthB\x13\n\x11_max_array_lengthB\x14\n\x12_stack_frame_depthB\x18\n\x16_max_object_propertiesB\x14\n\x12_max_string_lengthB\x13\n\x11_capture_closures\"\x91\x07\n\x05Probe\x12\n\n\x02id\x18\x01 \x01(\t\x12,\n\x04type\x18\x02 \x01(\x0e\x32\x1e.hyperprobe.agent.v1.ProbeType\x12\x18\n\x10runtime_location\x18\x03 \x01(\t\x12\x14\n\x0cruntime_line\x18\x04 \x01(\x05\x12\"\n\x1asecondary_runtime_location\x18\x05 \x01(\t\x12\x1e\n\x16secondary_runtime_line\x18\x06 \x01(\x05\x12\x11\n\tcondition\x18\x07 \x01(\t\x12\x10\n\x08template\x18\x08 \x01(\t\x12\x13\n\x0bmetric_name\x18\t \x01(\t\x12\x19\n\x11metric_expression\x18\n \x01(\t\x12\x19\n\x11watch_expressions\x18\x0b \x03(\t\x12\x11\n\thit_limit\x18\x0c \x01(\x05\x12\x13\n\x0b\x65xpiry_time\x18\r \x01(\x03\x12\x16\n\x0eruntime_column\x18\x0e \x01(\x05\x12 \n\x18secondary_runtime_column\x18\x0f \x01(\x05\x12\x1e\n\x16\x63orrelation_expression\x18\x10 \x01(\t\x12\x1d\n\x10max_object_depth\x18\x11 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10max_array_length\x18\x12 \x01(\x05H\x01\x88\x01\x01\x12\x1e\n\x11stack_frame_depth\x18\x13 \x01(\x05H\x02\x88\x01\x01\x12\"\n\x15max_object_properties\x18\x14 \x01(\x05H\x03\x88\x01\x01\x12\x1e\n\x11max_string_length\x18\x15 \x01(\x05H\x04\x88\x01\x01\x12$\n\x17should_capture_trace_id\x18\x16 \x01(\x08H\x05\x88\x01\x01\x12\x16\n\tlog_level\x18\x17 \x01(\tH\x06\x88\x01\x01\x12!\n\x14should_log_to_stdout\x18\x18 \x01(\x08H\x07\x88\x01\x01\x12\x1d\n\x10\x63\x61pture_closures\x18\x19 \x01(\x08H\x08\x88\x01\x01\x42\x13\n\x11_max_object_depthB\x13\n\x11_max_array_lengthB\x14\n\x12_stack_frame_depthB\x18\n\x16_max_object_propertiesB\x14\n\x12_max_string_lengthB\x1a\n\x18_should_capture_trace_idB\x0c\n\n_log_levelB\x17\n\x15_should_log_to_stdoutB\x13\n\x11_capture_closures\"W\n\x0eTelemetryBatch\x12\x10\n\x08\x61gent_id\x18\x01 \x01(\t\x12\x33\n\x06\x65vents\x18\x02 \x03(\x0b\x32#.hyperprobe.agent.v1.TelemetryEvent\"\x8a\x01\n\nStackFrame\x12\x15\n\rfunction_name\x18\x01 \x01(\t\x12\x11\n\tfile_name\x18\x02 \x01(\t\x12\x13\n\x0bline_number\x18\x03 \x01(\x05\x12\x15\n\rcolumn_number\x18\x04 \x01(\x05\x12\x17\n\nclass_name\x18\x05 \x01(\tH\x00\x88\x01\x01\x42\r\n\x0b_class_name\"\x8f\x02\n\x0eTelemetryEvent\x12\x10\n\x08probe_id\x18\x01 \x01(\t\x12\x14\n\x0ctimestamp_ms\x18\x02 \x01(\x03\x12\x35\n\x0cstack_frames\x18\x03 \x03(\x0b\x32\x1f.hyperprobe.agent.v1.StackFrame\x12\x1a\n\x12\x63\x61ptured_vars_json\x18\x04 \x01(\t\x12\x1a\n\x12watch_results_json\x18\x05 \x01(\t\x12\x15\n\revaluated_log\x18\x06 \x01(\t\x12\x14\n\x0cmetric_value\x18\x07 \x01(\x01\x12\x15\n\rcapture_error\x18\x08 \x01(\t\x12\x15\n\x08trace_id\x18\t \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_trace_id\"/\n\x11TelemetryResponse\x12\x1a\n\x12\x66inished_probe_ids\x18\x01 \x03(\t*\x9c\x01\n\tProbeType\x12\x1a\n\x16PROBE_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13PROBE_TYPE_SNAPSHOT\x10\x01\x12\x12\n\x0ePROBE_TYPE_LOG\x10\x02\x12\x16\n\x12PROBE_TYPE_COUNTER\x10\x03\x12\x15\n\x11PROBE_TYPE_METRIC\x10\x04\x12\x17\n\x13PROBE_TYPE_DURATION\x10\x05\x32\x99\x04\n\x0b\x41gentBroker\x12Z\n\tGetProbes\x12%.hyperprobe.agent.v1.GetProbesRequest\x1a&.hyperprobe.agent.v1.GetProbesResponse\x12^\n\x0fReportTelemetry\x12#.hyperprobe.agent.v1.TelemetryBatch\x1a&.hyperprobe.agent.v1.TelemetryResponse\x12o\n\x12GetSourceMapStatus\x12+.hyperprobe.agent.v1.SourceMapStatusRequest\x1a,.hyperprobe.agent.v1.SourceMapStatusResponse\x12]\n\x0fUploadSourceMap\x12#.hyperprobe.agent.v1.SourceMapChunk\x1a#.hyperprobe.agent.v1.UploadResponse(\x01\x12~\n\x15MarkSourceMapComplete\x12\x31.hyperprobe.agent.v1.MarkSourceMapCompleteRequest\x1a\x32.hyperprobe.agent.v1.MarkSourceMapCompleteResponseB\tB\x05\x41gentP\x00\x62\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
12
|
+
|
|
13
|
+
module Hyperprobe
|
|
14
|
+
module Agent
|
|
15
|
+
module V1
|
|
16
|
+
GetProbesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.GetProbesRequest").msgclass
|
|
17
|
+
GetProbesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.GetProbesResponse").msgclass
|
|
18
|
+
SourceMapStatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.SourceMapStatusRequest").msgclass
|
|
19
|
+
SourceMapStatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.SourceMapStatusResponse").msgclass
|
|
20
|
+
SourceMapChunk = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.SourceMapChunk").msgclass
|
|
21
|
+
UploadResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.UploadResponse").msgclass
|
|
22
|
+
MarkSourceMapCompleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.MarkSourceMapCompleteRequest").msgclass
|
|
23
|
+
MarkSourceMapCompleteResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.MarkSourceMapCompleteResponse").msgclass
|
|
24
|
+
AgentGlobalConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.AgentGlobalConfig").msgclass
|
|
25
|
+
Probe = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.Probe").msgclass
|
|
26
|
+
TelemetryBatch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.TelemetryBatch").msgclass
|
|
27
|
+
StackFrame = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.StackFrame").msgclass
|
|
28
|
+
TelemetryEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.TelemetryEvent").msgclass
|
|
29
|
+
TelemetryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.TelemetryResponse").msgclass
|
|
30
|
+
ProbeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hyperprobe.agent.v1.ProbeType").enummodule
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# Source: agent.proto for package 'hyperprobe.agent.v1'
|
|
3
|
+
|
|
4
|
+
require 'grpc'
|
|
5
|
+
require 'agent_pb'
|
|
6
|
+
|
|
7
|
+
module Hyperprobe
|
|
8
|
+
module Agent
|
|
9
|
+
module V1
|
|
10
|
+
module AgentBroker
|
|
11
|
+
class Service
|
|
12
|
+
|
|
13
|
+
include ::GRPC::GenericService
|
|
14
|
+
|
|
15
|
+
self.marshal_class_method = :encode
|
|
16
|
+
self.unmarshal_class_method = :decode
|
|
17
|
+
self.service_name = 'hyperprobe.agent.v1.AgentBroker'
|
|
18
|
+
|
|
19
|
+
rpc :GetProbes, ::Hyperprobe::Agent::V1::GetProbesRequest, ::Hyperprobe::Agent::V1::GetProbesResponse
|
|
20
|
+
rpc :ReportTelemetry, ::Hyperprobe::Agent::V1::TelemetryBatch, ::Hyperprobe::Agent::V1::TelemetryResponse
|
|
21
|
+
# Handshake for JS source maps
|
|
22
|
+
rpc :GetSourceMapStatus, ::Hyperprobe::Agent::V1::SourceMapStatusRequest, ::Hyperprobe::Agent::V1::SourceMapStatusResponse
|
|
23
|
+
rpc :UploadSourceMap, stream(::Hyperprobe::Agent::V1::SourceMapChunk), ::Hyperprobe::Agent::V1::UploadResponse
|
|
24
|
+
rpc :MarkSourceMapComplete, ::Hyperprobe::Agent::V1::MarkSourceMapCompleteRequest, ::Hyperprobe::Agent::V1::MarkSourceMapCompleteResponse
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Stub = Service.rpc_stub_class
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
protos_dir = File.expand_path('protos', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(protos_dir) unless $LOAD_PATH.include?(protos_dir)
|
|
5
|
+
|
|
6
|
+
require 'agent_pb'
|
|
7
|
+
|
|
8
|
+
if RUBY_PLATFORM !~ /java/
|
|
9
|
+
begin
|
|
10
|
+
require 'agent_services_pb'
|
|
11
|
+
rescue LoadError
|
|
12
|
+
# JRuby or environments without C-grpc gem
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HyperProbe
|
|
4
|
+
if defined?(::Rails::Railtie)
|
|
5
|
+
class Railtie < ::Rails::Railtie
|
|
6
|
+
config.after_initialize do
|
|
7
|
+
enabled = ENV['HYPERPROBE_ENABLED'] != 'false' && ENV['HYPERPROBE_DISABLED'] != 'YES'
|
|
8
|
+
has_service_id = !ENV['HYPERPROBE_SERVICE_ID'].nil? && !ENV['HYPERPROBE_SERVICE_ID'].empty?
|
|
9
|
+
|
|
10
|
+
if enabled && has_service_id
|
|
11
|
+
HyperProbe.start
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/hyperprobe.rb
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'hyperprobe/version'
|
|
4
|
+
require_relative 'hyperprobe/protos'
|
|
5
|
+
require_relative 'hyperprobe/core/logger'
|
|
6
|
+
require_relative 'hyperprobe/agent'
|
|
7
|
+
require_relative 'hyperprobe/lambda'
|
|
8
|
+
require_relative 'hyperprobe/railtie' if defined?(::Rails::Railtie)
|
|
9
|
+
|
|
10
|
+
module HyperProbe
|
|
11
|
+
@instance = nil
|
|
12
|
+
@mutex = Mutex.new
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def logger(namespace = 'hyperprobe:agent')
|
|
16
|
+
Core::Logger.get_logger(namespace)
|
|
17
|
+
end
|
|
18
|
+
def start(options = {})
|
|
19
|
+
@mutex.synchronize do
|
|
20
|
+
return @instance if @instance
|
|
21
|
+
|
|
22
|
+
if ENV['HYPERPROBE_DISABLED']&.strip&.upcase == 'YES'
|
|
23
|
+
puts '[HyperProbe] Explicitly disabled via ENV["HYPERPROBE_DISABLED"].'
|
|
24
|
+
return nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
opts = (options || {}).dup
|
|
28
|
+
commit_sha = opts[:commit_sha] || opts[:commitSha] || opts['commit_sha'] || opts['commitSha'] || ENV['GIT_COMMIT'] || ENV['HYPERPROBE_COMMIT_SHA']
|
|
29
|
+
if commit_sha.nil? || commit_sha.to_s.strip.empty? || commit_sha.to_s.strip.downcase == 'unknown'
|
|
30
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] CRITICAL: Failed to start agent. A valid \"commit_sha\" is required via options or the GIT_COMMIT environment variable to ensure accurate source map resolution and prevent cross-deployment collisions.\e[0m"
|
|
31
|
+
return nil
|
|
32
|
+
end
|
|
33
|
+
opts[:commit_sha] = commit_sha
|
|
34
|
+
|
|
35
|
+
service_id = opts[:service_id] || opts[:serviceId] || opts['service_id'] || opts['serviceId'] || ENV['HYPERPROBE_SERVICE_ID']
|
|
36
|
+
if service_id.nil? || service_id.to_s.strip.empty?
|
|
37
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] CRITICAL: Failed to start agent. HYPERPROBE_SERVICE_ID is required.\e[0m"
|
|
38
|
+
return nil
|
|
39
|
+
end
|
|
40
|
+
if service_id && !UUID_REGEX.match?(service_id.to_s)
|
|
41
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] WARN: service_id is not a valid UUID, please check again.\e[0m"
|
|
42
|
+
end
|
|
43
|
+
opts[:service_id] = service_id
|
|
44
|
+
|
|
45
|
+
environment = opts[:environment] || opts['environment'] || ENV['HYPERPROBE_ENVIRONMENT']
|
|
46
|
+
if environment.nil? || environment.to_s.strip.empty?
|
|
47
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] CRITICAL: Failed to start agent. HYPERPROBE_ENVIRONMENT is required.\e[0m"
|
|
48
|
+
return nil
|
|
49
|
+
end
|
|
50
|
+
opts[:environment] = environment
|
|
51
|
+
|
|
52
|
+
broker_url = opts[:broker_url] || opts[:brokerUrl] || opts['broker_url'] || opts['brokerUrl'] || ENV['HYPERPROBE_BROKER_URL']
|
|
53
|
+
unless valid_broker_url?(broker_url)
|
|
54
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] CRITICAL: Failed to start agent. Invalid broker_url \"#{broker_url}\". It must be a valid URL (http:// or https://) or a raw gRPC target (e.g. localhost:60051), with no query parameters and no trailing slash.\e[0m"
|
|
55
|
+
return nil
|
|
56
|
+
end
|
|
57
|
+
opts[:broker_url] = broker_url
|
|
58
|
+
|
|
59
|
+
if defined?(JRUBY_VERSION) || (defined?(RUBY_PLATFORM) && RUBY_PLATFORM =~ /java/)
|
|
60
|
+
raw_jruby_ver = defined?(JRUBY_VERSION) ? JRUBY_VERSION.to_s : '0'
|
|
61
|
+
jruby_ver = Gem::Version.new(raw_jruby_ver)
|
|
62
|
+
if jruby_ver < Gem::Version.new('9.3.0.0')
|
|
63
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] Unsupported JRuby version (#{raw_jruby_ver}). HyperProbe requires JRuby 9.3+ or 9.4+.\e[0m"
|
|
64
|
+
return nil
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
unless jruby_debug_enabled?
|
|
68
|
+
warn "\e[1m\e[31m❌ [HyperProbe] CRITICAL: Failed to start agent on JRuby. The '--debug' launch flag (or JRUBY_OPTS=\"--debug\") is required for JRuby to preserve line boundaries and local variables. Please add 'ENV JRUBY_OPTS=\"--debug\"' to your deployment environment or start with 'jruby --debug'.\e[0m"
|
|
69
|
+
return nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
begin
|
|
73
|
+
require 'java'
|
|
74
|
+
java_ver_str = java.lang.System.getProperty('java.specification.version') || '11'
|
|
75
|
+
java_major = java_ver_str.sub(/^1\./, '').to_i
|
|
76
|
+
if java_major.positive? && java_major < 11
|
|
77
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] Unsupported Java runtime (#{java_ver_str}). HyperProbe on JRuby requires Java 11+ for native HTTP/2 gRPC.\e[0m"
|
|
78
|
+
return nil
|
|
79
|
+
end
|
|
80
|
+
rescue LoadError, StandardError
|
|
81
|
+
# Pass through if on non-JVM or property read is restricted
|
|
82
|
+
end
|
|
83
|
+
else
|
|
84
|
+
ruby_ver = Gem::Version.new(RUBY_VERSION)
|
|
85
|
+
if ruby_ver < Gem::Version.new('3.0.0')
|
|
86
|
+
warn "\e[1m\e[33m⚠️ [HyperProbe] Unsupported Ruby version (#{RUBY_VERSION}). HyperProbe requires Ruby 3.0+ for targeted line hooks.\e[0m"
|
|
87
|
+
return nil
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
@instance = Agent.new(opts)
|
|
92
|
+
@instance
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def shutdown
|
|
97
|
+
@mutex.synchronize do
|
|
98
|
+
return unless @instance
|
|
99
|
+
|
|
100
|
+
@instance.shutdown
|
|
101
|
+
@instance = nil
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def instance
|
|
106
|
+
@mutex.synchronize { @instance }
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def after_fork
|
|
110
|
+
return unless Process.respond_to?(:fork) && !defined?(JRUBY_VERSION)
|
|
111
|
+
|
|
112
|
+
@mutex.synchronize do
|
|
113
|
+
@instance&.after_fork
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def wrap_lambda(options = {}, &handler)
|
|
118
|
+
Lambda.wrap(options, &handler)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def stop_lambda
|
|
122
|
+
Lambda.stop
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def jruby_debug_enabled?
|
|
126
|
+
begin
|
|
127
|
+
require 'java'
|
|
128
|
+
return true if Java::OrgJrubyUtilCli::Options::DEBUG_FULLTRACE.load == true
|
|
129
|
+
rescue StandardError, ScriptError, NameError
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
opts = ENV['JRUBY_OPTS'] || ''
|
|
133
|
+
opts.include?('--debug') || opts.include?('-Xdebug.fullTrace=true')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def valid_broker_url?(url)
|
|
137
|
+
return false if url.nil? || url.to_s.strip.empty?
|
|
138
|
+
|
|
139
|
+
raw = url.to_s.strip
|
|
140
|
+
if raw.start_with?('http://', 'https://')
|
|
141
|
+
begin
|
|
142
|
+
uri = URI.parse(raw)
|
|
143
|
+
return !raw.end_with?('/') && (uri.query.nil? || uri.query.empty?) && !uri.host.nil? && !uri.host.empty?
|
|
144
|
+
rescue URI::InvalidURIError
|
|
145
|
+
return false
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Raw gRPC target
|
|
150
|
+
!raw.include?('://') && !raw.include?('/') && !raw.include?('?')
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hyperprobe-agent
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.27.pre.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Arif Khan
|
|
8
|
+
- Karan Raina
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: google-protobuf
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.21.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 3.21.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: binding_of_caller
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 1.0.0
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.0.0
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: grpc
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.50.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.50.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bundler
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.17'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.17'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rake
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '12.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '12.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.12'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.12'
|
|
97
|
+
description: HyperProbe agent for Ruby applications, capturing snapshots, logs, metrics,
|
|
98
|
+
and durations non-breakingly using TracePoint and gRPC.
|
|
99
|
+
email:
|
|
100
|
+
- arif@hypertest.co
|
|
101
|
+
- karan@hypertest.co
|
|
102
|
+
executables: []
|
|
103
|
+
extensions: []
|
|
104
|
+
extra_rdoc_files: []
|
|
105
|
+
files:
|
|
106
|
+
- LICENSE
|
|
107
|
+
- README.md
|
|
108
|
+
- lib/hyperprobe-agent.rb
|
|
109
|
+
- lib/hyperprobe.rb
|
|
110
|
+
- lib/hyperprobe/agent.rb
|
|
111
|
+
- lib/hyperprobe/core/broker.rb
|
|
112
|
+
- lib/hyperprobe/core/evaluator.rb
|
|
113
|
+
- lib/hyperprobe/core/logger.rb
|
|
114
|
+
- lib/hyperprobe/core/monitoring_engine.rb
|
|
115
|
+
- lib/hyperprobe/core/quota.rb
|
|
116
|
+
- lib/hyperprobe/core/safe_ast_validator.rb
|
|
117
|
+
- lib/hyperprobe/core/safety.rb
|
|
118
|
+
- lib/hyperprobe/core/serializer.rb
|
|
119
|
+
- lib/hyperprobe/core/trace_extractor.rb
|
|
120
|
+
- lib/hyperprobe/lambda.rb
|
|
121
|
+
- lib/hyperprobe/protos.rb
|
|
122
|
+
- lib/hyperprobe/protos/agent_pb.rb
|
|
123
|
+
- lib/hyperprobe/protos/agent_services_pb.rb
|
|
124
|
+
- lib/hyperprobe/railtie.rb
|
|
125
|
+
- lib/hyperprobe/version.rb
|
|
126
|
+
homepage: https://www.hyperprobe.co
|
|
127
|
+
licenses:
|
|
128
|
+
- Nonstandard
|
|
129
|
+
metadata:
|
|
130
|
+
homepage_uri: https://www.hyperprobe.co
|
|
131
|
+
source_code_uri: https://github.com/hypertestco/prodprobe
|
|
132
|
+
rdoc_options: []
|
|
133
|
+
require_paths:
|
|
134
|
+
- lib
|
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
|
+
requirements:
|
|
137
|
+
- - ">="
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: 3.0.0
|
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
requirements: []
|
|
146
|
+
rubygems_version: 4.0.16
|
|
147
|
+
specification_version: 4
|
|
148
|
+
summary: Production-grade, non-breaking live debugger and telemetry agent for Ruby.
|
|
149
|
+
test_files: []
|