39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/generators/tasker/subscriber_generator.rb', line 39
def show_usage_instructions
say "\n#{set_color('Subscriber created successfully!', :green)}"
if options[:metrics]
say "\n#{set_color('Metrics subscriber features:', :cyan)}"
say ' - Built-in helper methods for extracting timing, error, and performance metrics'
say ' - Automatic tag generation for categorization'
say ' - Examples for StatsD, DataDog, Prometheus, and other metrics systems'
say ' - Safe numeric value extraction with defaults'
end
say "\nTo register your subscriber, add this to an initializer:"
say set_color(" #{class_name}Subscriber.subscribe(Tasker::Events::Publisher.instance)", :cyan)
if options[:events].any?
say "\nYour subscriber will handle these events:"
options[:events].each do |event|
method_name = "handle_#{event.tr('.', '_')}"
say set_color(" #{event} -> #{method_name}", :yellow)
end
end
say "\nAvailable events can be viewed with:"
say set_color(' Tasker::Events.catalog.keys', :cyan)
return unless options[:metrics]
say "\n#{set_color('Metrics collection examples:', :green)}"
say ' - Task completion rates and durations'
say ' - Error categorization and retry patterns'
say ' - Performance monitoring and resource usage'
say ' - Business metrics with proper tagging'
end
|