boards#index性能优化
This commit is contained in:
parent
2e01a1f17b
commit
2c23b88998
9
Gemfile
9
Gemfile
|
@ -1,5 +1,5 @@
|
|||
source 'https://ruby.taobao.org'
|
||||
#source 'http://ruby.sdutlinux.org/'
|
||||
source 'https://rubygems.org/'
|
||||
### 这里执行bundle config mirror.https://rubygems.org https://gems.ruby-china.org 切换到ruby-china源
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
|
@ -42,6 +42,11 @@ gem 'kaminari'
|
|||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
|
||||
### profile
|
||||
gem 'oneapm_rpm'
|
||||
gem "query_reviewer", group: :development
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'better_errors', '~> 1.1.0'
|
||||
|
|
|
@ -88,4 +88,11 @@ class PraiseTread < ActiveRecord::Base
|
|||
UserLevels.update_user_level(target_user)
|
||||
end
|
||||
end
|
||||
|
||||
def self.praised(activity)
|
||||
self.where(praise_tread_object_id: activity.id,
|
||||
praise_tread_object_type: activity.class.to_s,
|
||||
user_id: User.current.id).empty?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% if PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",activity.id,activity.class.to_s,User.current.id).empty? %>
|
||||
<% if PraiseTread.praised(activity) %>
|
||||
<a href='<%= Setting.protocol+"://"+Setting.host_name+"/praise_tread/praise_plus?obj_id="+activity.id.to_s+"&obj_type="+activity.class.name+"&user_activity_id="+user_activity_id.to_s+"&type="+type.to_s %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
|
||||
<span class="likeText">赞</span>
|
||||
<% num = get_praise_num(activity) %>
|
||||
|
|
|
@ -1,134 +1,36 @@
|
|||
#
|
||||
# OneApm RubyAgent Configuration
|
||||
# OneApm Ruby探针配置
|
||||
#
|
||||
|
||||
# Here are the settings that are common to all environments
|
||||
common: &default_settings
|
||||
# ============================== LICENSE KEY ===============================
|
||||
|
||||
#
|
||||
# Get your license key from oneapm.com
|
||||
#
|
||||
license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ='
|
||||
|
||||
# Agent Enabled (Ruby/Rails Only)
|
||||
# Valid values are true, false and auto.
|
||||
# 您在这里填写的app_name会显示在OneAPM的管理后台界面中。
|
||||
#
|
||||
# agent_enabled: auto
|
||||
# 如果您修改了此处的app_name,一个新的应用会出现在后台,
|
||||
# 数据会上传到这个新应用,并停止向旧的应用上传数据。
|
||||
#
|
||||
app_name: trustie
|
||||
|
||||
# This app_name will be the application name in oneapm.com in your account.
|
||||
#
|
||||
# Caution: If you change this name, a new application will appear in the OneApm
|
||||
# user interface with the new name, and data will stop reporting to the
|
||||
# app with the old name.
|
||||
#
|
||||
app_name: trusite
|
||||
#
|
||||
# 环境相关配置
|
||||
#
|
||||
|
||||
# When "true", the agent collects performance data about your
|
||||
# application and reports this data to the OneApm service at
|
||||
# oneapm.com. This global switch is normally overridden for each
|
||||
# environment below. (formerly called 'enabled')
|
||||
production:
|
||||
<<: *default_settings
|
||||
monitor_mode: true
|
||||
|
||||
# Specify its log level here.
|
||||
log_level: info
|
||||
|
||||
# log_file_path: 'log'
|
||||
# log_file_name: 'oneapm_agent.log'
|
||||
|
||||
# The oneapm agent communicates with the service via https by default.
|
||||
# ssl: true
|
||||
|
||||
# ======================== Browser Monitoring =============================
|
||||
browser_monitoring:
|
||||
# By default the agent automatically injects the monitoring JavaScript
|
||||
# into web pages. Set this attribute to false to turn off this behavior.
|
||||
auto_instrument: true
|
||||
|
||||
# Proxy settings for connecting to the OneApm server.
|
||||
#
|
||||
# proxy_host: hostname
|
||||
# proxy_port: 8080
|
||||
# proxy_user:
|
||||
# proxy_pass:
|
||||
|
||||
# Tells transaction tracer and error collector (when enabled)
|
||||
# whether or not to capture HTTP params. When true, frameworks can
|
||||
# exclude HTTP parameters from being captured.
|
||||
# Rails: the RoR filter_parameter_logging excludes parameters
|
||||
capture_params: false
|
||||
|
||||
# Transaction tracer captures deep information about slow
|
||||
# transactions and sends this to the OneApm service once a
|
||||
# minute. Included in the transaction is the exact call sequence of
|
||||
# the transactions including any SQL statements issued.
|
||||
transaction_tracer:
|
||||
|
||||
# Transaction tracer is enabled by default.
|
||||
enabled: true
|
||||
|
||||
# Threshold in seconds for when to collect a transaction
|
||||
# trace. When the response time of a controller action exceeds
|
||||
# this threshold, a transaction trace will be recorded and sent to
|
||||
# OneApm. Valid values are any float value, or (default) "apdex_f",
|
||||
# which will use the threshold for an dissatisfying Apdex
|
||||
# controller action - four times the Apdex T value.
|
||||
transaction_threshold: apdex_f
|
||||
|
||||
# When transaction tracer is on, SQL statements can optionally be
|
||||
# recorded. The recorder has three modes, "off" which sends no
|
||||
# SQL, "raw" which sends the SQL statement in its original form,
|
||||
# and "obfuscated", which strips out numeric and string literals.
|
||||
record_sql: obfuscated
|
||||
|
||||
# Threshold in seconds for when to collect stack trace for a SQL
|
||||
# call. In other words, when SQL statements exceed this threshold,
|
||||
# then capture and send to OneApm the current stack trace. This is
|
||||
# helpful for pinpointing where long SQL calls originate from.
|
||||
stack_trace_threshold: 0.500
|
||||
|
||||
# Determines whether the agent will capture query plans for slow
|
||||
# SQL queries. Only supported in mysql and postgres. Should be
|
||||
# set to false when using other adapters.
|
||||
# explain_enabled: true
|
||||
|
||||
# Threshold for query execution time below which query plans will
|
||||
# not be captured. Relevant only when `explain_enabled` is true.
|
||||
# explain_threshold: 0.5
|
||||
|
||||
# Error collector captures information about uncaught exceptions and
|
||||
# sends them to OneApm for viewing
|
||||
error_collector:
|
||||
|
||||
# Error collector is enabled by default.
|
||||
enabled: true
|
||||
|
||||
# Ignore the following errors, add your own.
|
||||
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
|
||||
|
||||
# ===================== Application Environments ========================
|
||||
# Environment-specific settings are in this section.
|
||||
# For Rails applications, RAILS_ENV is used to determine the environment.
|
||||
|
||||
# NOTE if your application has other named environments, you should
|
||||
# provide oneapm configuration settings for these environments here.
|
||||
|
||||
development:
|
||||
<<: *default_settings
|
||||
# Turn on communication to OneApm service in development mode
|
||||
# development模式下,探针开启并上传性能数据
|
||||
monitor_mode: true
|
||||
app_name: My Application (Development)
|
||||
app_name: trustie(Development)
|
||||
|
||||
test:
|
||||
<<: *default_settings
|
||||
monitor_mode: false
|
||||
|
||||
# Turn on the agent in production for 24x7 monitoring.
|
||||
production:
|
||||
<<: *default_settings
|
||||
monitor_mode: true
|
||||
|
||||
# Staging environment which behaves identically to production.
|
||||
staging:
|
||||
<<: *default_settings
|
||||
monitor_mode: true
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
all:
|
||||
inject_view: true
|
||||
stack_trace_lines: 3
|
||||
trace_includes_vendor: false
|
||||
trace_includes_lib: true
|
||||
profiling: enabled
|
||||
production_data: true
|
||||
max_safe_key_length: 100
|
||||
disable_sql_cache: true
|
||||
|
||||
warn_severity: 3
|
||||
critical_severity: 7
|
||||
|
||||
warn_select_count: 20
|
||||
critical_select_count: 50
|
||||
|
||||
warn_update_count: 5
|
||||
critical_update_count: 10
|
||||
|
||||
warn_insert_count: 5
|
||||
critical_insert_count: 10
|
||||
|
||||
warn_delete_count: 5
|
||||
critical_delete_count: 10
|
||||
|
||||
warn_duration_threshold: 0.2
|
||||
critical_duration_threshold: 1.0
|
||||
|
||||
warn_affected_rows: 10
|
||||
critical_affected_rows: 100
|
||||
|
||||
development:
|
||||
enabled: true
|
||||
|
||||
production:
|
||||
enabled: false
|
||||
|
||||
test:
|
||||
enabled: false
|
Loading…
Reference in New Issue