chili_logger 0.0.0
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/.byebug_history +55 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +6 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +88 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/chili_logger.gemspec +25 -0
- data/lib/brokers/rabbit_broker.rb +65 -0
- data/lib/chili_logger/version.rb +3 -0
- data/lib/chili_logger.rb +76 -0
- data/lib/current_log_accessor.rb +120 -0
- data/lib/errors/config_error.rb +9 -0
- data/lib/errors/rabbitmq_error.rb +9 -0
- data/lib/helpers/rails_backtrace_cleaner.rb +130 -0
- data/lib/logs_coverage/chili_logger_coverage.yml +14 -0
- data/lib/logs_coverage/coverage_writer.rb +32 -0
- data/lib/logs_coverage/levantamento_provis/303/263rio.yaml +398 -0
- data/lib/message_writer/aws_ops_metadata.rb +51 -0
- data/lib/message_writer/message_writer.rb +77 -0
- metadata +96 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
# Backtraces often include many lines that are not relevant for the context
|
2
|
+
# under review. This makes it hard to find the signal amongst the backtrace
|
3
|
+
# noise, and adds debugging time. With a BacktraceCleaner, filters and
|
4
|
+
# silencers are used to remove the noisy lines, so that only the most relevant
|
5
|
+
# lines remain.
|
6
|
+
#
|
7
|
+
# Filters are used to modify lines of data, while silencers are used to remove
|
8
|
+
# lines entirely. The typical filter use case is to remove lengthy path
|
9
|
+
# information from the start of each line, and view file paths relevant to the
|
10
|
+
# app directory instead of the file system root. The typical silencer use case
|
11
|
+
# is to exclude the output of a noisy library from the backtrace, so that you
|
12
|
+
# can focus on the rest.
|
13
|
+
#
|
14
|
+
# bc = ActiveSupport::BacktraceCleaner.new
|
15
|
+
# bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix
|
16
|
+
# bc.add_silencer { |line| line =~ /puma|rubygems/ } # skip any lines from puma or rubygems
|
17
|
+
# bc.clean(exception.backtrace) # perform the cleanup
|
18
|
+
#
|
19
|
+
# To reconfigure an existing BacktraceCleaner (like the default one in Rails)
|
20
|
+
# and show as much data as possible, you can always call
|
21
|
+
# <tt>BacktraceCleaner#remove_silencers!</tt>, which will restore the
|
22
|
+
# backtrace to a pristine state. If you need to reconfigure an existing
|
23
|
+
# BacktraceCleaner so that it does not filter or modify the paths of any lines
|
24
|
+
# of the backtrace, you can call <tt>BacktraceCleaner#remove_filters!</tt>
|
25
|
+
# These two methods will give you a completely untouched backtrace.
|
26
|
+
|
27
|
+
# BacktraceCleaner from Rails, copied ipsis literis
|
28
|
+
# github: https://github.com/rails/rails/blob/fbe2433be6e052a1acac63c7faf287c52ed3c5ba/activesupport/lib/active_support/backtrace_cleaner.rb#L41
|
29
|
+
class RailsBacktraceCleaner
|
30
|
+
def initialize
|
31
|
+
@filters = []
|
32
|
+
@silencers = []
|
33
|
+
add_gem_filter
|
34
|
+
add_gem_silencer
|
35
|
+
add_stdlib_silencer
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns the backtrace after all filters and silencers have been run
|
39
|
+
# against it. Filters run first, then silencers.
|
40
|
+
def clean(backtrace, kind = :silent)
|
41
|
+
filtered = filter_backtrace(backtrace)
|
42
|
+
|
43
|
+
case kind
|
44
|
+
when :silent
|
45
|
+
silence(filtered)
|
46
|
+
when :noise
|
47
|
+
noise(filtered)
|
48
|
+
else
|
49
|
+
filtered
|
50
|
+
end
|
51
|
+
end
|
52
|
+
alias filter clean
|
53
|
+
|
54
|
+
# Adds a filter from the block provided. Each line in the backtrace will be
|
55
|
+
# mapped against this filter.
|
56
|
+
#
|
57
|
+
# # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
|
58
|
+
# backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
|
59
|
+
def add_filter(&block)
|
60
|
+
@filters << block
|
61
|
+
end
|
62
|
+
|
63
|
+
# Adds a silencer from the block provided. If the silencer returns +true+
|
64
|
+
# for a given line, it will be excluded from the clean backtrace.
|
65
|
+
#
|
66
|
+
# # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb"
|
67
|
+
# backtrace_cleaner.add_silencer { |line| line =~ /puma/ }
|
68
|
+
def add_silencer(&block)
|
69
|
+
@silencers << block
|
70
|
+
end
|
71
|
+
|
72
|
+
# Removes all silencers, but leaves in the filters. Useful if your
|
73
|
+
# context of debugging suddenly expands as you suspect a bug in one of
|
74
|
+
# the libraries you use.
|
75
|
+
def remove_silencers!
|
76
|
+
@silencers = []
|
77
|
+
end
|
78
|
+
|
79
|
+
# Removes all filters, but leaves in the silencers. Useful if you suddenly
|
80
|
+
# need to see entire filepaths in the backtrace that you had already
|
81
|
+
# filtered out.
|
82
|
+
def remove_filters!
|
83
|
+
@filters = []
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
FORMATTED_GEMS_PATTERN = %r{/\A[^\/]+ \([\w.]+\) /}.freeze
|
89
|
+
|
90
|
+
def add_gem_filter
|
91
|
+
gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
|
92
|
+
return if gems_paths.empty?
|
93
|
+
|
94
|
+
gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
|
95
|
+
gems_result = '\3 (\4) \5'
|
96
|
+
add_filter { |line| line.sub(gems_regexp, gems_result) }
|
97
|
+
end
|
98
|
+
|
99
|
+
def add_gem_silencer
|
100
|
+
add_silencer { |line| FORMATTED_GEMS_PATTERN.match?(line) }
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_stdlib_silencer
|
104
|
+
add_silencer { |line| line.start_with?(RbConfig::CONFIG['rubylibdir']) }
|
105
|
+
end
|
106
|
+
|
107
|
+
def filter_backtrace(backtrace)
|
108
|
+
@filters.each do |f|
|
109
|
+
backtrace = backtrace.map { |line| f.call(line) }
|
110
|
+
end
|
111
|
+
|
112
|
+
backtrace
|
113
|
+
end
|
114
|
+
|
115
|
+
def silence(backtrace)
|
116
|
+
@silencers.each do |s|
|
117
|
+
backtrace = backtrace.reject { |line| s.call(line) }
|
118
|
+
end
|
119
|
+
|
120
|
+
backtrace
|
121
|
+
end
|
122
|
+
|
123
|
+
def noise(backtrace)
|
124
|
+
backtrace.select do |line|
|
125
|
+
@silencers.any? do |s|
|
126
|
+
s.call(line)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
EXAMPLE OF HOW THIS INVENTORY IS STRUCTURED:
|
3
|
+
example_log_type:
|
4
|
+
example_log_service:
|
5
|
+
example_log_action:
|
6
|
+
- backtrace[0]
|
7
|
+
- backtrace[1]
|
8
|
+
example_log_action:
|
9
|
+
- backtrace[0]
|
10
|
+
- backtrace[1]
|
11
|
+
error:
|
12
|
+
campaigns:
|
13
|
+
index:
|
14
|
+
- app/controllers/application_controller.rb:95:in `publish_error_log'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
# class for centralizing Creative's logging logic
|
4
|
+
class ChiliLogger
|
5
|
+
# class for keeping logs coverage up to date
|
6
|
+
class CoverageWriter
|
7
|
+
def self.write(desc, backtrace)
|
8
|
+
coverage_path = './log/chili_logger_coverage.yml'
|
9
|
+
coverage = YAML.load_file(coverage_path) || {}
|
10
|
+
|
11
|
+
type = desc[:type]
|
12
|
+
service = desc[:service]
|
13
|
+
action = desc[:action]
|
14
|
+
|
15
|
+
keys = [type, service, action]
|
16
|
+
coverage = add_nested_value(coverage, keys, backtrace)
|
17
|
+
|
18
|
+
File.open(coverage_path, 'w') { |f| YAML.dump(coverage, f) }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.add_nested_value(object, keys, final_value)
|
22
|
+
return final_value if keys.empty?
|
23
|
+
|
24
|
+
current_key = keys.first
|
25
|
+
nested_object = object[current_key] || {}
|
26
|
+
nested_keys = keys.drop(1)
|
27
|
+
object[current_key] = add_nested_value(nested_object, nested_keys, final_value)
|
28
|
+
|
29
|
+
object
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,398 @@
|
|
1
|
+
# para salvar os registros, investigar se usa campaign.inspect ou campaign.to_json
|
2
|
+
# inspect não mostra links dos campos assinados do cloudfront
|
3
|
+
# to_json mostra, mas o link vai expirar antes de usarmos numa eventual auditoria, então talvez nem valha a pena guardar isso
|
4
|
+
|
5
|
+
{
|
6
|
+
desc: "transaction.#{layer}.#{service}.#{action}", #pode ser o topic do rabbitmq tb!
|
7
|
+
layer: "creatives",
|
8
|
+
service: "campaigns",
|
9
|
+
action: "create",
|
10
|
+
timestamp: Time.zone.now,
|
11
|
+
transaction: {
|
12
|
+
company: User.http_request_user.company.as_json || 'undefined',
|
13
|
+
user: User.http_request_user.as_json || 'undefined',
|
14
|
+
campaigns: [
|
15
|
+
{ ...campaign.as_json, changes: [] }
|
16
|
+
],
|
17
|
+
errors: errors.messages,
|
18
|
+
call_stack: Rails.backtrace_cleaner.clean(caller)
|
19
|
+
},
|
20
|
+
ops_metadata: {
|
21
|
+
layer_url: ENV['SERVER_URL'] || 'undefined',
|
22
|
+
server_ip: 'undefined',
|
23
|
+
# CLOUD METADATA
|
24
|
+
# https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
|
25
|
+
cloud: {
|
26
|
+
provider: 'AWS',
|
27
|
+
region: ENV['AWS_REGION'] || 'undefined', #usar código dos provedores de cloud computing(AWS, Azure, etc...) mesmo
|
28
|
+
machine_id: 'undefined',
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
# SERVIÇOS E ACTIONS PARA LOGS DE ERRO
|
34
|
+
service: [request_processing, automated_task]
|
35
|
+
action: [uncaught_error]
|
36
|
+
|
37
|
+
#CREATIVES
|
38
|
+
banners:
|
39
|
+
#*********************************************************************************************************#
|
40
|
+
create: # never used, banners arereated as part of campaign flow
|
41
|
+
# pra facilitar gerar os gráficos iguais do analytics
|
42
|
+
template_name
|
43
|
+
category_name
|
44
|
+
# pra facilitar gerar os gráficos iguais do analytics
|
45
|
+
|
46
|
+
banner
|
47
|
+
# Spreadsheet::FileReader::Xlsx.create_banner
|
48
|
+
#*********************************************************************************************************#
|
49
|
+
send_to_rendering_queue:
|
50
|
+
sentData
|
51
|
+
# task campaign_banner:api
|
52
|
+
#*********************************************************************************************************#
|
53
|
+
receive_processed_creatives:
|
54
|
+
banners
|
55
|
+
# PostbacksController#create
|
56
|
+
#*********************************************************************************************************#
|
57
|
+
accept:
|
58
|
+
last_accepted_video
|
59
|
+
# Video.log_acceptance
|
60
|
+
campaigns:
|
61
|
+
#*********************************************************************************************************#
|
62
|
+
create:
|
63
|
+
campaign_after_action #(campaign.inspect)
|
64
|
+
# Dashboard::CampaignsController#create
|
65
|
+
#*********************************************************************************************************#
|
66
|
+
update:
|
67
|
+
campaign_before_action
|
68
|
+
campaignErrors
|
69
|
+
campaign_after_action
|
70
|
+
# Dashboard::CampaignsController#update
|
71
|
+
#*********************************************************************************************************#
|
72
|
+
create_draft:
|
73
|
+
draft_after_action
|
74
|
+
spreadsheetLink # se tiver a campanha como string, não precisa do link pq já vai estar na campanha stringifada
|
75
|
+
# Dashboard::DraftsController#create
|
76
|
+
#*********************************************************************************************************#
|
77
|
+
validate_sheet:
|
78
|
+
draft_after_action
|
79
|
+
# task excel:validation
|
80
|
+
#*********************************************************************************************************#
|
81
|
+
discard:
|
82
|
+
campaign_before_action
|
83
|
+
campaignErrors
|
84
|
+
campaign_after_action
|
85
|
+
# Dashboard::CampaignsController#update
|
86
|
+
#*********************************************************************************************************#
|
87
|
+
update_name:
|
88
|
+
campaign_before_action
|
89
|
+
campaignErrors
|
90
|
+
campaign_after_action
|
91
|
+
# Dashboard::CampaignsController#update_name
|
92
|
+
#*********************************************************************************************************#
|
93
|
+
delete:
|
94
|
+
campaign
|
95
|
+
# Dashboard::CampaignsController#destroy
|
96
|
+
youtube_spreadsheet_download: # parece não existir mais esse método
|
97
|
+
campaign
|
98
|
+
spreadsheetLink # se tiver a campanha como string, não precisa do link pq já vai estar na campanha stringifada
|
99
|
+
# Dashboard::CampaignsController#upload_youtube
|
100
|
+
campaign_spreadsheet_download: # parece não existir mais esse método
|
101
|
+
campaign
|
102
|
+
spreadsheetLink # se tiver a campanha como string, não precisa do link pq já vai estar na campanha stringifada
|
103
|
+
# Dashboard::CampaignsController#campaign_download
|
104
|
+
banner_zip_download:
|
105
|
+
campaign
|
106
|
+
# Dashboard::CampaignsController#zip_banner
|
107
|
+
|
108
|
+
# index: Dashboard::CampaignsController#index
|
109
|
+
# show: Dashboard::CampaignsController#show
|
110
|
+
# edit: Dashboard::CampaignsController#edit
|
111
|
+
|
112
|
+
# new: Dashboard::CampaignsController#new
|
113
|
+
|
114
|
+
###########################################################################################################
|
115
|
+
db_change: # ideia desconsiderada, mudanças na BD são acrescentadas aos logs dos controllers e das tasks
|
116
|
+
toda vez que algo mudar na base, cria um log do serviço 'db', para auditoria
|
117
|
+
# ApplicationRecord
|
118
|
+
|
119
|
+
#*********************************************************************************************************#
|
120
|
+
errors:
|
121
|
+
error
|
122
|
+
# Creatives::Application
|
123
|
+
# example: https://gist.github.com/steve9001/1443408/3917792198d7f93b129c6009fcc9292ec4b7b664
|
124
|
+
# enviar alertas a cada erro!
|
125
|
+
|
126
|
+
gallery:
|
127
|
+
#*********************************************************************************************************#
|
128
|
+
filter:
|
129
|
+
gallery_files:
|
130
|
+
file_names:
|
131
|
+
search_tags:
|
132
|
+
#*********************************************************************************************************#
|
133
|
+
download:
|
134
|
+
gallery_files:
|
135
|
+
galleryFile1:
|
136
|
+
galleryFile
|
137
|
+
tagsIds
|
138
|
+
galleryFile2:
|
139
|
+
galleryFile
|
140
|
+
tagsIds
|
141
|
+
galleryFileEtc...
|
142
|
+
# Dashboard::GalleryFilesController#download
|
143
|
+
#*********************************************************************************************************#
|
144
|
+
create:
|
145
|
+
galleryFiles:
|
146
|
+
galleryFile1:
|
147
|
+
galleryFile
|
148
|
+
tagsIds
|
149
|
+
galleryFile2:
|
150
|
+
galleryFile
|
151
|
+
tagsIds
|
152
|
+
galleryFileEtc...
|
153
|
+
# Dashboard::GalleryFilesController#create
|
154
|
+
#*********************************************************************************************************#
|
155
|
+
update:
|
156
|
+
galleryFiles:
|
157
|
+
galleryFile1:
|
158
|
+
galleryFile
|
159
|
+
tagsIds
|
160
|
+
galleryFile2:
|
161
|
+
galleryFile
|
162
|
+
tagsIds
|
163
|
+
galleryFileEtc...
|
164
|
+
# Dashboard::GalleryFilesController#update
|
165
|
+
#*********************************************************************************************************#
|
166
|
+
delete:
|
167
|
+
galleryFiles:
|
168
|
+
galleryFile1:
|
169
|
+
galleryFile
|
170
|
+
tagsIds
|
171
|
+
galleryFile2:
|
172
|
+
galleryFile
|
173
|
+
tagsIds
|
174
|
+
galleryFileEtc...
|
175
|
+
# Dashboard::GalleryFilesController#destroy
|
176
|
+
# index: Dashboard::GalleryFilesController#index
|
177
|
+
# show: Dashboard::GalleryFilesController#show
|
178
|
+
# filter_files: Dashboard::GalleryFilesController#filter_files
|
179
|
+
# edit: Dashboard::GalleryFilesController#edit
|
180
|
+
|
181
|
+
facebook:
|
182
|
+
#*********************************************************************************************************#
|
183
|
+
update_accounts:
|
184
|
+
facebook_before_action
|
185
|
+
facebookP_after_action
|
186
|
+
# lib/tasks/facebook.rake facebook:update_ad_account_status
|
187
|
+
#*********************************************************************************************************#
|
188
|
+
upload_videos:
|
189
|
+
adVideo
|
190
|
+
adImage
|
191
|
+
# lib/tasks/facebook.rake facebook:upload_videos
|
192
|
+
|
193
|
+
|
194
|
+
marketing_cloud:
|
195
|
+
#*********************************************************************************************************#
|
196
|
+
update:
|
197
|
+
marketingCloud_before_action
|
198
|
+
marketingCloud_after_action
|
199
|
+
# Dashboard::Users::MarketingCloudsController#update
|
200
|
+
#*********************************************************************************************************#
|
201
|
+
refresh_token:
|
202
|
+
marketingCloud_before_action
|
203
|
+
marketingCloud_after_action
|
204
|
+
# lib/tasks/integration.rake
|
205
|
+
|
206
|
+
player: # vai deixar de existir!
|
207
|
+
send_videos:
|
208
|
+
video_before_action
|
209
|
+
video_after_action
|
210
|
+
# lib/tasks/full_service.rake full_service:videos
|
211
|
+
create_analytics:
|
212
|
+
analytic_before_action
|
213
|
+
analytic_after_action
|
214
|
+
# lib/tasks/full_service.rake full_service:analytics
|
215
|
+
send_report:
|
216
|
+
analyticReport_before_action
|
217
|
+
analyticReport_after_action
|
218
|
+
emailContent #????????????
|
219
|
+
# lib/tasks/full_service.rake full_service:results
|
220
|
+
|
221
|
+
template_collections:
|
222
|
+
#*********************************************************************************************************#
|
223
|
+
create:
|
224
|
+
collection
|
225
|
+
collectionErrors
|
226
|
+
templates:
|
227
|
+
template1
|
228
|
+
template2
|
229
|
+
templateEtc
|
230
|
+
# Admin::TemplateCollectionsController#create
|
231
|
+
#*********************************************************************************************************#
|
232
|
+
update:
|
233
|
+
collection
|
234
|
+
collectionErrors
|
235
|
+
templates:
|
236
|
+
template1
|
237
|
+
template2
|
238
|
+
templateEtc
|
239
|
+
# Admin::TemplateCollectionsController#update
|
240
|
+
#*********************************************************************************************************#
|
241
|
+
delete:
|
242
|
+
collection
|
243
|
+
# Admin::TemplateCollectionsController#destroy
|
244
|
+
# Admin::CategoriesCollectionsController#destroy
|
245
|
+
# index: Dashboard::TemplatesController#index
|
246
|
+
# index_collections: Dashboard::TemplateCollectionsController#index
|
247
|
+
# paginate: Dashboard::TemplatesController#templates
|
248
|
+
# paginate_collections: Dashboard::TemplateCollectionsController#paginate
|
249
|
+
# index_collections: Admin::TemplateCollectionsController#index
|
250
|
+
# show_collection: Admin::TemplateCollectionsController#show
|
251
|
+
# new_collection: Admin::TemplateCollectionsController#new
|
252
|
+
# edit_collection: Admin::TemplateCollectionsController#edit
|
253
|
+
# show: Dashboard::TemplatesController#show
|
254
|
+
|
255
|
+
template_categories:
|
256
|
+
#*********************************************************************************************************#
|
257
|
+
create:
|
258
|
+
category
|
259
|
+
# Admin::CategoriesCollectionsController#create
|
260
|
+
#*********************************************************************************************************#
|
261
|
+
update:
|
262
|
+
category_before_action
|
263
|
+
category_after_action
|
264
|
+
# Admin::CategoriesCollectionsController#update
|
265
|
+
#*********************************************************************************************************#
|
266
|
+
delete:
|
267
|
+
category
|
268
|
+
category
|
269
|
+
# index_category: Admin::CategoriesCollectionsController#index
|
270
|
+
# edit_category: Admin::CategoriesCollectionsController#edit
|
271
|
+
# edit_category: Admin::CategoriesCollectionsController#edit
|
272
|
+
# new_category: Admin::CategoriesCollectionsController#new
|
273
|
+
|
274
|
+
users_management:
|
275
|
+
#*********************************************************************************************************#
|
276
|
+
update:
|
277
|
+
user_before_action
|
278
|
+
user_after_action
|
279
|
+
# Dashboard::UsersController#update
|
280
|
+
#*********************************************************************************************************#
|
281
|
+
admin_update:
|
282
|
+
user_before_action
|
283
|
+
quota_before_action
|
284
|
+
organization_before_action
|
285
|
+
company_before_action
|
286
|
+
|
287
|
+
user_after_action
|
288
|
+
quota_after_action
|
289
|
+
organization_after_action
|
290
|
+
company_after_action
|
291
|
+
# Dashboard::UsersController#update
|
292
|
+
#*********************************************************************************************************#
|
293
|
+
upgrade:
|
294
|
+
# REALMENTE É USADO AINDA???????
|
295
|
+
# Dashboard::UsersController#upgrade
|
296
|
+
#*********************************************************************************************************#
|
297
|
+
invite_user:
|
298
|
+
invitedUser
|
299
|
+
# Dashboard::UsersController#invite_user
|
300
|
+
#*********************************************************************************************************#
|
301
|
+
email_link:
|
302
|
+
sentEmail # ????????
|
303
|
+
# UserMailer.send_link
|
304
|
+
#*********************************************************************************************************#
|
305
|
+
login_as_user:
|
306
|
+
hijackedUser
|
307
|
+
# Admin::UsersController#login_as_user
|
308
|
+
#*********************************************************************************************************#
|
309
|
+
download_users_info:
|
310
|
+
sem payload
|
311
|
+
# Admin::UsersController#download_users_info
|
312
|
+
#*********************************************************************************************************#
|
313
|
+
update_quota:
|
314
|
+
quota
|
315
|
+
# MultiUser::Quota.update && MultiUser::Quota.decrease
|
316
|
+
#*********************************************************************************************************#
|
317
|
+
quota_renewal:
|
318
|
+
quota_before_action
|
319
|
+
quota_after_action
|
320
|
+
# lib/tasks/renew_quotas.rake
|
321
|
+
# edit: Dashboard::UsersController#edit
|
322
|
+
# index: Admin::UsersController#index
|
323
|
+
|
324
|
+
videos:
|
325
|
+
#*********************************************************************************************************#
|
326
|
+
create:
|
327
|
+
# pra facilitar gerar os gráficos iguais do analytics
|
328
|
+
template_name
|
329
|
+
category_name
|
330
|
+
track_name
|
331
|
+
videos:
|
332
|
+
galleryFile1Name
|
333
|
+
galleryFileEtcName
|
334
|
+
# pra facilitar gerar os gráficos iguais do analytics
|
335
|
+
|
336
|
+
video
|
337
|
+
# Dashboard::VideosController#create -> realmente é usado esse controller?
|
338
|
+
# Spreadsheet::FileReader::Xlsx.create_video
|
339
|
+
#*********************************************************************************************************#
|
340
|
+
update:
|
341
|
+
video_before_action
|
342
|
+
video_after_action
|
343
|
+
# Dashboard::VideosController#update -> realmente é usado esse controller?
|
344
|
+
#*********************************************************************************************************#
|
345
|
+
send_to_rendering_queue:
|
346
|
+
sentData
|
347
|
+
# lib/tasks/campaign.rake campaign:api
|
348
|
+
#*********************************************************************************************************#
|
349
|
+
receive_processed_creatives:
|
350
|
+
video_before_action
|
351
|
+
video_after_action
|
352
|
+
# PostbacksController#create
|
353
|
+
#*********************************************************************************************************#
|
354
|
+
accept:
|
355
|
+
last_accepted_video
|
356
|
+
# Video.log_acceptance
|
357
|
+
|
358
|
+
youtube:
|
359
|
+
#*********************************************************************************************************#
|
360
|
+
create_youtube_upload:
|
361
|
+
uploadSocial
|
362
|
+
# Dashboard::YoutubeUploadsController#create
|
363
|
+
#*********************************************************************************************************#
|
364
|
+
update_upload_social:
|
365
|
+
uploadSocial_before_action
|
366
|
+
uploadSocial_after_action
|
367
|
+
# Dashboard::YoutubeUploadsController#update
|
368
|
+
#*********************************************************************************************************#
|
369
|
+
validate_videos:
|
370
|
+
video_before_action
|
371
|
+
video_after_action
|
372
|
+
# lib/tasks/youtube.rake videos_to_validation.each (linhas 34-56)
|
373
|
+
#*********************************************************************************************************#
|
374
|
+
upload_videos:
|
375
|
+
video_before_action
|
376
|
+
video_after_action
|
377
|
+
# lib/tasks/youtube.rake videos_to_validation.each (linhas 58-74)
|
378
|
+
|
379
|
+
zendesk_sessions:
|
380
|
+
#*********************************************************************************************************#
|
381
|
+
create_session:
|
382
|
+
sem payload
|
383
|
+
# ZendeskSessionsController#create
|
384
|
+
#*********************************************************************************************************#
|
385
|
+
create_ticket:
|
386
|
+
ticket
|
387
|
+
# Dashboard::TicketsController#create
|
388
|
+
|
389
|
+
|
390
|
+
# MÁQUINAS
|
391
|
+
# logs do nginx (apache) stdin, stdout
|
392
|
+
|
393
|
+
|
394
|
+
# AUTH
|
395
|
+
# login(horários)
|
396
|
+
|
397
|
+
|
398
|
+
#API
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'logs_coverage/coverage_writer'
|
3
|
+
require 'helpers/rails_backtrace_cleaner'
|
4
|
+
require 'message_writer/aws_ops_metadata'
|
5
|
+
|
6
|
+
# class for centralizing Creative's logging logic
|
7
|
+
class ChiliLogger
|
8
|
+
# class for writing log cloud metadata when AWS is the cloud provider
|
9
|
+
class AwsOpsMetadata
|
10
|
+
# rubocop:disable Metrics/MethodLength
|
11
|
+
# rubocop:disable Metrics/AbcSize
|
12
|
+
def self.write
|
13
|
+
{
|
14
|
+
provider: 'AWS',
|
15
|
+
instance: {
|
16
|
+
ami_id: aws_metadata('ami-id'),
|
17
|
+
ami_launch_index: aws_metadata('ami-launch-index'),
|
18
|
+
ami_manifest_path: aws_metadata('ami-manifest-path'),
|
19
|
+
block_device_mapping: aws_metadata('block-device-mapping/'),
|
20
|
+
events: aws_metadata('events/'),
|
21
|
+
hostname: aws_metadata('hostname'),
|
22
|
+
iam: aws_metadata('iam/'),
|
23
|
+
instance_action: aws_metadata('instance-action'),
|
24
|
+
instance_id: aws_metadata('instance-id'),
|
25
|
+
instance_type: aws_metadata('instance-type'),
|
26
|
+
local_hostname: aws_metadata('local-hostname'),
|
27
|
+
local_ipv4: aws_metadata('local-ipv4'),
|
28
|
+
mac: aws_metadata('mac'),
|
29
|
+
metrics: aws_metadata('metrics/'),
|
30
|
+
network: aws_metadata('network/'),
|
31
|
+
placement: aws_metadata('placement/'),
|
32
|
+
profile: aws_metadata('profile'),
|
33
|
+
public_hostname: aws_metadata('public-hostname'),
|
34
|
+
public_ipv4: aws_metadata('public-ipv4'),
|
35
|
+
public_keys: aws_metadata('public-keys/'),
|
36
|
+
reservation_id: aws_metadata('reservation-id'),
|
37
|
+
security_groups: aws_metadata('security-groups'),
|
38
|
+
services: aws_metadata('services/')
|
39
|
+
}
|
40
|
+
}
|
41
|
+
end
|
42
|
+
# rubocop:enable Metrics/MethodLength
|
43
|
+
# rubocop:enable Metrics/AbcSize
|
44
|
+
|
45
|
+
def self.aws_metadata(metadata)
|
46
|
+
# how it works: https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
|
47
|
+
base_url = 'http://169.254.169.254/latest/meta-data/'
|
48
|
+
HTTParty.get(base_url + metadata).body
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|