rails_loki_exporter 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93cc7ab2fe4c6fadb43616ca5f9416b0f82bc1f8434bfa8c389329c016d4528a
|
4
|
+
data.tar.gz: b70e7a5189a35825e996c582658d5b062f2849891dd2262181eacc025e5e52dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06fbb48beee20de45796edfbd1c58299649b919d9ec5551d4701c7dbae04a4033e07c5dfed3f83719f388d7e2b54285cd6eccd8e0afc5396ab79c2110b0f0b78
|
7
|
+
data.tar.gz: 425291ee06d0bff6430703a46894d2436f3116edb7b6d0def9e121b8685d7834e0e344f319c846833fdc7aa7645e4349d6351656b4df601bf967a78492fc531e
|
@@ -44,10 +44,10 @@ module RailsLokiExporter
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def format_message(severity, datetime, progname, msg)
|
47
|
-
puts "severity: #{severity}"
|
48
|
-
puts "datetime: #{datetime}"
|
49
|
-
puts "progname: #{progname}"
|
50
|
-
puts "msg: #{msg}"
|
47
|
+
# puts "severity: #{severity}"
|
48
|
+
# puts "datetime: #{datetime}"
|
49
|
+
# puts "progname: #{progname}"
|
50
|
+
# puts "msg: #{msg}"
|
51
51
|
"#{severity} #{progname}: #{msg}\n"
|
52
52
|
end
|
53
53
|
|
@@ -32,27 +32,30 @@ module RailsLokiExporter
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def send_log(log_message)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
current_timestamp = Time.now.to_f * 1_000_000_000
|
36
|
+
@log_buffer << [current_timestamp.to_i.to_s, log_message.chomp]
|
37
|
+
if @log_buffer.size >= @max_buffer_size || can_send_log?
|
38
|
+
send_buffered_logs
|
39
|
+
@last_interaction_time = Time.now
|
40
|
+
else
|
41
|
+
# @logger.info('Log buffered. Waiting for more logs or interaction interval.')
|
42
|
+
end
|
42
43
|
end
|
43
44
|
|
44
45
|
private
|
45
46
|
def send_buffered_logs
|
46
47
|
return if @log_buffer.empty?
|
47
48
|
|
48
|
-
curr_datetime = Time.now.to_i * 1_000_000_000
|
49
49
|
msg = "On server #{@host_name} detected error"
|
50
50
|
payload = {
|
51
51
|
'streams' => [
|
52
|
-
{
|
53
|
-
'
|
54
|
-
|
55
|
-
|
52
|
+
{
|
53
|
+
'stream' => {
|
54
|
+
'job' => @job_name,
|
55
|
+
'host' => @host_name,
|
56
|
+
},
|
57
|
+
'values' => @log_buffer,
|
58
|
+
}
|
56
59
|
]
|
57
60
|
}
|
58
61
|
|
data/rails_loki_exporter.gemspec
CHANGED
@@ -17,5 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.extra_rdoc_files = ['README.md']
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.add_dependency 'zeitwerk', '~> 2.4'
|
20
|
-
spec.
|
20
|
+
spec.add_development_dependency 'rspec'
|
21
|
+
spec.add_development_dependency 'rake'
|
21
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_loki_exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- planning.how
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: zeitwerk
|
@@ -33,7 +33,21 @@ dependencies:
|
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
|
-
type: :
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rake
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
37
51
|
prerelease: false
|
38
52
|
version_requirements: !ruby/object:Gem::Requirement
|
39
53
|
requirements:
|