trace_viz 0.0.1 → 0.0.2
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 +4 -4
- data/CONTRIBUTING.md +34 -0
- data/README.md +130 -38
- data/examples/example.cast +285 -0
- data/examples/example.rb +94 -23
- data/lib/trace_viz/adapters/base_adapter.rb +0 -2
- data/lib/trace_viz/adapters/trace_point_adapter.rb +17 -11
- data/lib/trace_viz/collectors/base_collector.rb +83 -0
- data/lib/trace_viz/collectors/depth_manager.rb +37 -0
- data/lib/trace_viz/collectors/evaluators/base_evaluator.rb +23 -0
- data/lib/trace_viz/collectors/evaluators/filter_evaluator.rb +30 -0
- data/lib/trace_viz/collectors/evaluators/hidden_evaluator.rb +21 -0
- data/lib/trace_viz/collectors/filters/base_filter.rb +23 -0
- data/lib/trace_viz/collectors/filters/exclude_classes_filter.rb +28 -0
- data/lib/trace_viz/collectors/filters/exclude_default_classes_filter.rb +38 -0
- data/lib/trace_viz/collectors/filters/exclude_gems_filter.rb +30 -0
- data/lib/trace_viz/collectors/filters/exclude_internal_call_filter.rb +31 -0
- data/lib/trace_viz/collectors/filters/exclude_rails_framework_filter.rb +38 -0
- data/lib/trace_viz/collectors/filters/include_classes_filter.rb +28 -0
- data/lib/trace_viz/collectors/filters/include_gems_filter.rb +54 -0
- data/lib/trace_viz/collectors/filters/registry.rb +59 -0
- data/lib/trace_viz/collectors/matchers/trace_point_action_matcher.rb +36 -0
- data/lib/trace_viz/collectors/matchers/within_depth_matcher.rb +25 -0
- data/lib/trace_viz/collectors/trace_point_collector.rb +51 -0
- data/lib/trace_viz/collectors/trace_stats.rb +21 -0
- data/lib/trace_viz/config/copier.rb +38 -0
- data/lib/trace_viz/config/validator.rb +74 -0
- data/lib/trace_viz/configuration.rb +36 -30
- data/lib/trace_viz/context/config_context.rb +1 -1
- data/lib/trace_viz/context/manager.rb +17 -21
- data/lib/trace_viz/context/map.rb +29 -0
- data/lib/trace_viz/context/registry.rb +37 -0
- data/lib/trace_viz/context/tracking/active_calls.rb +37 -0
- data/lib/trace_viz/context/tracking_context.rb +7 -2
- data/lib/trace_viz/context.rb +2 -2
- data/lib/trace_viz/core/tracer.rb +1 -0
- data/lib/trace_viz/defaults.rb +139 -0
- data/lib/trace_viz/exporters/base_exporter.rb +84 -0
- data/lib/trace_viz/exporters/formatters/base_formatter.rb +12 -0
- data/lib/trace_viz/exporters/formatters/method_call_formatter.rb +21 -0
- data/lib/trace_viz/exporters/formatters/method_return_formatter.rb +22 -0
- data/lib/trace_viz/exporters/text_exporter.rb +15 -0
- data/lib/trace_viz/exporters/transformers/base_transformer.rb +25 -0
- data/lib/trace_viz/exporters/transformers/text_transformer.rb +28 -0
- data/lib/trace_viz/formatters/base_formatter.rb +42 -0
- data/lib/trace_viz/formatters/helpers/depth_helper.rb +21 -0
- data/lib/trace_viz/formatters/helpers/indent_helper.rb +15 -0
- data/lib/trace_viz/formatters/helpers/method_details_helper.rb +15 -0
- data/lib/trace_viz/formatters/helpers/params_helper.rb +26 -0
- data/lib/trace_viz/formatters/helpers/result_helper.rb +21 -0
- data/lib/trace_viz/formatters/helpers/source_helper.rb +21 -0
- data/lib/trace_viz/formatters/helpers/time_helper.rb +15 -0
- data/lib/trace_viz/logger.rb +37 -47
- data/lib/trace_viz/loggers/trace_builder.rb +30 -0
- data/lib/trace_viz/loggers/trace_formatters/base_formatter.rb +32 -0
- data/lib/trace_viz/loggers/trace_formatters/method_call_formatter.rb +21 -0
- data/lib/trace_viz/loggers/trace_formatters/method_return_formatter.rb +22 -0
- data/lib/trace_viz/loggers/trace_logger.rb +38 -0
- data/lib/trace_viz/loggers/trace_stats_logger.rb +33 -0
- data/lib/trace_viz/trace_data/base.rb +56 -0
- data/lib/trace_viz/trace_data/trace_point/base.rb +68 -0
- data/lib/trace_viz/trace_data/trace_point/method_call.rb +42 -0
- data/lib/trace_viz/trace_data/trace_point/method_return.rb +25 -0
- data/lib/trace_viz/trace_data/trace_point_builder.rb +23 -0
- data/lib/trace_viz/utils/colorize.rb +12 -23
- data/lib/trace_viz/utils/format_utils.rb +67 -0
- data/lib/trace_viz/version.rb +1 -1
- metadata +58 -13
- data/lib/trace_viz/adapters/trace_point/depth_manager.rb +0 -34
- data/lib/trace_viz/adapters/trace_point/event_handler.rb +0 -36
- data/lib/trace_viz/adapters/trace_point/trace_data.rb +0 -89
- data/lib/trace_viz/adapters/trace_point/trace_formatter.rb +0 -95
- data/lib/trace_viz/adapters/trace_point/trace_logger.rb +0 -44
- data/lib/trace_viz/context/manager/context_map.rb +0 -31
- data/lib/trace_viz/context/manager/context_operations.rb +0 -60
- data/lib/trace_viz/context/manager/context_registry.rb +0 -20
- data/lib/trace_viz/context/manager/context_validation.rb +0 -34
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "trace_viz/context/base_context"
|
4
|
-
|
5
|
-
module TraceViz
|
6
|
-
module Context
|
7
|
-
class Manager
|
8
|
-
module ContextOperations
|
9
|
-
def create_context(key = nil, **options)
|
10
|
-
if key
|
11
|
-
validate_key!(key)
|
12
|
-
ensure_unique_key!(key)
|
13
|
-
end
|
14
|
-
|
15
|
-
context_class = @registered_contexts[key] || BaseContext
|
16
|
-
context = context_class.new(**options)
|
17
|
-
@context_map[key] = context if key
|
18
|
-
context
|
19
|
-
end
|
20
|
-
|
21
|
-
def enter_context(key = nil, **options)
|
22
|
-
create_context(key, **options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def enter_multiple_contexts(contexts_with_options = {})
|
26
|
-
unless contexts_with_options.is_a?(Hash)
|
27
|
-
raise ContextError, "Expected a Hash of contexts and options, got #{contexts_with_options.class}"
|
28
|
-
end
|
29
|
-
|
30
|
-
contexts_with_options.each do |key, options|
|
31
|
-
enter_context(key, **options)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def exit_context(key)
|
36
|
-
validate_key!(key)
|
37
|
-
context = @context_map.delete(key)
|
38
|
-
raise ContextError, "No context found with key '#{key}' to exit" unless context
|
39
|
-
|
40
|
-
context
|
41
|
-
end
|
42
|
-
|
43
|
-
def exit_multiple_contexts(*keys)
|
44
|
-
keys.each do |key|
|
45
|
-
validate_key!(key)
|
46
|
-
exit_context(key)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Execute a block within the context(s) specified
|
51
|
-
def with_contexts(contexts_with_options = {})
|
52
|
-
enter_multiple_contexts(contexts_with_options)
|
53
|
-
yield
|
54
|
-
ensure
|
55
|
-
exit_multiple_contexts(*contexts_with_options.keys)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TraceViz
|
4
|
-
module Context
|
5
|
-
class Manager
|
6
|
-
module ContextRegistry
|
7
|
-
def register_context_type(key, context_class)
|
8
|
-
validate_key!(key)
|
9
|
-
validate_context_class!(context_class)
|
10
|
-
|
11
|
-
if @registered_contexts.key?(key)
|
12
|
-
raise ContextError, "Context type for key '#{key}' is already registered"
|
13
|
-
end
|
14
|
-
|
15
|
-
@registered_contexts[key] = context_class
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TraceViz
|
4
|
-
module Context
|
5
|
-
class Manager
|
6
|
-
module ContextValidation
|
7
|
-
private
|
8
|
-
|
9
|
-
# Validate that the key is either a Symbol or String
|
10
|
-
def validate_key!(key)
|
11
|
-
return unless key
|
12
|
-
|
13
|
-
unless key.is_a?(Symbol) || key.is_a?(String)
|
14
|
-
raise ContextError, "Key must be a Symbol or String, got #{key.class}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Ensure that the key is unique (no existing context with the same key)
|
19
|
-
def ensure_unique_key!(key)
|
20
|
-
if @context_map.key?(key)
|
21
|
-
raise ContextError, "Context with key '#{key}' already exists"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Validate that the context_class inherits from BaseContext
|
26
|
-
def validate_context_class!(context_class)
|
27
|
-
unless context_class < BaseContext
|
28
|
-
raise ContextError, "Context class must inherit from BaseContext"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|