use influxdb 1.8
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -99,8 +99,8 @@ gem "kaminari"
|
||||
gem "colorize"
|
||||
gem "daemons"
|
||||
gem "ripcord"
|
||||
gem "influxdb-client"
|
||||
gem "discard"
|
||||
gem "influxdb-client"
|
||||
gem "concurrent-ruby-ext", require: "concurrent"
|
||||
gem "concurrent-ruby-edge", require: "concurrent-edge"
|
||||
gem "pluck_each"
|
||||
|
||||
@@ -12,23 +12,21 @@ class Metrics::Client
|
||||
|
||||
private
|
||||
|
||||
def initialize(host: nil, token: nil, org: nil, bucket: nil, default_tags: {})
|
||||
def initialize(default_tags: {})
|
||||
unless REPORT
|
||||
logger.warn "!!! not reporting for this environment !!!"
|
||||
return
|
||||
end
|
||||
|
||||
host ||= Rails.application.config.x.influxdb.host || raise("no host")
|
||||
token ||= Rails.application.config.x.influxdb.token || raise("no token")
|
||||
org ||= Rails.application.config.x.influxdb.org || raise("no org")
|
||||
bucket ||= Rails.application.config.x.influxdb.bucket || raise("no bucket")
|
||||
host = Rails.application.config.x.influxdb.host || raise("no host")
|
||||
bucket = Rails.application.config.x.influxdb.bucket || raise("no bucket")
|
||||
|
||||
@client = InfluxDB2::Client.new(
|
||||
host, token,
|
||||
org: org,
|
||||
host, "",
|
||||
org: "",
|
||||
bucket: bucket,
|
||||
use_ssl: false,
|
||||
precision: InfluxDB2::WritePrecision::MILLISECOND,
|
||||
use_ssl: false,
|
||||
)
|
||||
|
||||
write_options = InfluxDB2::WriteOptions.new(
|
||||
@@ -50,5 +48,7 @@ class Metrics::Client
|
||||
def write_point(caller, name, tags: {}, fields: {})
|
||||
return unless REPORT
|
||||
@writer.write(data: { name: name, tags: tags, fields: fields })
|
||||
rescue => e
|
||||
logger.error("error writing influxdb metric: #{e}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class='text-lg border-b-2 border-b-slate-300 text-slate-600 p-1 italic'>Similar Users</div>
|
||||
<div class='bg-slate-100'>
|
||||
<% cache(user.disco, expires_in: 12.hours) do %>
|
||||
<% similar = similar_users_by_followed(user).includes(:avatar) %>
|
||||
<% similar = similar_users_by_followed(user)&.includes(:avatar) %>
|
||||
<% if similar %>
|
||||
<% similar.each do |user| %>
|
||||
<div class='flex flex-row py-1 px-2 border-b-2 last:border-b-0'>
|
||||
|
||||
@@ -1,29 +1,19 @@
|
||||
development:
|
||||
host: "http://grafana:8086"
|
||||
token: "cq3ytOdINIktgUynWj0tDfkpFha8iQHy0njLmpx87Rlko4bo2Gn8oxdk6dLL6y-X3jlZqXJjZ2xtpzFvk1BSMw=="
|
||||
org: "primary"
|
||||
bucket: "redux-scraper-dev"
|
||||
bucket: "redux_scraper_dev"
|
||||
|
||||
staging:
|
||||
host: "http://grafana:8086"
|
||||
token: "cq3ytOdINIktgUynWj0tDfkpFha8iQHy0njLmpx87Rlko4bo2Gn8oxdk6dLL6y-X3jlZqXJjZ2xtpzFvk1BSMw=="
|
||||
org: "primary"
|
||||
bucket: "redux-scraper-dev"
|
||||
bucket: "redux_scraper_dev"
|
||||
|
||||
production:
|
||||
host: "http://grafana.local:8086"
|
||||
token: "W2ikhmpQxQHZAStgSEK6s6aJxnOqeD4Zz2MI1m_lnD1JX57V9Esqm0zXb3DWbN7Gnj2GdmF_YrcvE8cy6NbIqQ=="
|
||||
org: "primary"
|
||||
bucket: "redux-scraper"
|
||||
bucket: "redux_scraper_prod"
|
||||
|
||||
worker:
|
||||
host: "http://grafana.local:8086"
|
||||
token: "W2ikhmpQxQHZAStgSEK6s6aJxnOqeD4Zz2MI1m_lnD1JX57V9Esqm0zXb3DWbN7Gnj2GdmF_YrcvE8cy6NbIqQ=="
|
||||
org: "primary"
|
||||
bucket: "redux-scraper"
|
||||
bucket: "redux_scraper_prod"
|
||||
|
||||
test:
|
||||
host: "http://grafana.local:8086"
|
||||
token: "P0hzfg-vKiBTmpE-wPMJKkU8wj8VjUN1_OMxNVFhKRqxSdq3msQZ0ZWpVCT9MPAzsvoR40Caaxd2kq_LEIJpxQ=="
|
||||
org: "primary"
|
||||
bucket: "redux-scraper-test"
|
||||
bucket: "redux_scraper_test"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
client = InfluxDB2::Client.new(
|
||||
Rails.application.config.x.influxdb.host || raise("no host"),
|
||||
Rails.application.config.x.influxdb.token || raise("no token"),
|
||||
"",
|
||||
bucket: Rails.application.config.x.influxdb.bucket || raise("no bucket"),
|
||||
org: Rails.application.config.x.influxdb.org || raise("no org"),
|
||||
org: "",
|
||||
precision: InfluxDB2::WritePrecision::NANOSECOND,
|
||||
use_ssl: false,
|
||||
)
|
||||
@@ -36,6 +36,6 @@ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |na
|
||||
}
|
||||
|
||||
write_api.write(data: hash)
|
||||
rescue
|
||||
Rails.logger.error("error writing influxdb metric: #{$!}")
|
||||
rescue => e
|
||||
Rails.logger.error("error writing influxdb metric: #{e}")
|
||||
end
|
||||
|
||||
@@ -6,11 +6,6 @@ class Domain::Fa::PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
@post.save!
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get domain_fa_posts_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should show domain_fa_post" do
|
||||
get domain_fa_post_url(fa_id: @post.fa_id)
|
||||
assert_response :success
|
||||
|
||||
@@ -6,11 +6,6 @@ class Domain::Fa::UsersControllerTest < ActionDispatch::IntegrationTest
|
||||
@user.save!
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get domain_fa_users_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should show user" do
|
||||
get domain_fa_user_url(@user)
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user