-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
173 changed files
with
630 additions
and
697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Docker | ||
on: | ||
# Scheduled workflows run on the latest commit on the default or base branch | ||
schedule: | ||
- cron: '20 2 * * *' # Daily at 02:20 | ||
|
||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
publish: | ||
# restrict this job to base repo for now | ||
if: github.repository == 'opf/openproject' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Publish to registry | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: openproject/community-test | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
tag_semver: true | ||
cache: ${{ github.event_name != 'schedule' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
OpenProject::Application.configure do | ||
config.after_initialize do | ||
slow_sql_threshold = OpenProject::Configuration.sql_slow_query_threshold.to_i | ||
return if slow_sql_threshold == 0 | ||
|
||
ActiveSupport::Notifications.subscribe("sql.active_record") do |_name, start, finish, _id, data| | ||
# Skip transaction that may be blocked | ||
next if data[:sql].match(/BEGIN|COMMIT/) | ||
|
||
# Skip smaller durations | ||
duration = ((finish - start) * 1000).round(4) | ||
next if duration <= slow_sql_threshold | ||
|
||
payload = { | ||
duration: duration, | ||
time: start.iso8601, | ||
cached: !!data[:cache], | ||
sql: data[:sql], | ||
} | ||
|
||
sql_log_string = data[:sql].strip.gsub(/(^([\s]+)?$\n)/, "") | ||
OpenProject.logger.warn "Encountered slow SQL (#{payload[:duration]} ms): #{sql_log_string}", | ||
payload: payload, | ||
# Hash of the query for reference/fingerprinting | ||
reference: Digest::SHA1.hexdigest(data[:sql]) | ||
rescue StandardError => e | ||
OpenProject.logger.error "Failed to record slow SQL query: #{e}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.