Skip to content

Commit 1f7dbb6

Browse files
authored
feat: discourse plugin for sending apm traces to elastic (#1)
* feat: discourse plugin for sending apm traces to elastic * move all code inside the module
1 parent 96dd53b commit 1f7dbb6

17 files changed

+9947
-1
lines changed

.discourse-compatibility

Whitespace-only changes.

.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/eslint");

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
/gems
3+
/auto_generated

.prettierrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/prettier");

.rubocop.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inherit_gem:
2+
rubocop-discourse: stree-compat.yml

.template-lintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/template-lint");

Gemfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
group :development do
6+
gem "rubocop-discourse"
7+
gem "syntax_tree"
8+
end

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Civilized Discourse Construction Kit, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# discourse-plugin-elastic-apm
1+
# discourse-plugin-elastic-apm
2+
3+
Refer here for configuration options
4+
5+
https://www.elastic.co/guide/en/apm/agent/ruby/current/configuration.html
6+
7+
Currently, plugin just allows to configure via discourse admin dashboard the following options:
8+
9+
* server_url
10+
* service_name
11+
* secret_token
12+
* transaction_sample_rate
13+
* elastic_apm_log_level
14+
15+
In top of that, extra options can be configured via env variables or the elastic apm page itself. Agent will be pulling for config updates.
16+
17+
NOTE: un order to make the plugin work, rak mini profiler must be disabled. Set the following environment variables in your discourse distribution to disable it
18+
19+
```
20+
DISCOURSE_LOAD_MINI_PROFILER=false
21+
DISABLE_MINI_PROFILER=true
22+
```

assets/javascripts/.gitkeep

Whitespace-only changes.

assets/stylesheets/.gitkeep

Whitespace-only changes.

config/locales/server.en.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
en:
2+
site_settings:
3+
discourse_plugin_elastic_apm: "Enable or disable the Elastic APM integration."
4+
elastic_apm_service_name: "Name of the service for Elastic APM."
5+
elastic_apm_server_url: "URL of the Elastic APM server (leave blank for default)."
6+
elastic_apm_secret_token: "Elastic APM server secret token (leave blank for default)."
7+
elastic_apm_transaction_sample_rate: "Set the transaction sample rate for Elastic APM (value between 0.0 and 1.0)."
8+
elastic_apm_log_level: "Set the log level for Elastic APM."

config/settings.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
plugins:
2+
discourse_plugin_elastic_apm:
3+
default: false
4+
client: true
5+
type: boolean
6+
elastic_apm_service_name:
7+
default: "Discourse"
8+
type: text
9+
elastic_apm_server_url:
10+
default: "http://localhost:8200"
11+
type: text
12+
elastic_apm_secret_token:
13+
default: ""
14+
type: text
15+
elastic_apm_transaction_sample_rate:
16+
default: 1.0
17+
type: float
18+
min: 0.0
19+
max: 1.0
20+
elastic_apm_log_level:
21+
default: debug
22+
type: list
23+
choices:
24+
- debug
25+
- info
26+
- warn
27+
- error

0 commit comments

Comments
 (0)