decidim-telemetry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.docker/entrypoint.sh +153 -0
- data/.dockerignore +1 -0
- data/.erb-lint.yml +2134 -0
- data/.github/workflows/website.yml +52 -0
- data/.gitignore +13 -0
- data/.gitlab-ci.yml +157 -0
- data/.markdownlint.yaml +11 -0
- data/.prettierrc +4 -0
- data/.rspec +1 -0
- data/.rubocop.yml +2 -0
- data/CONTRIBUTING.md +21 -0
- data/Gemfile +39 -0
- data/Gemfile.lock +1094 -0
- data/LICENSE.md +661 -0
- data/README.md +58 -0
- data/Rakefile +42 -0
- data/app/controllers/decidim/telemetry/application_controller.rb +11 -0
- data/app/controllers/decidim/telemetry/health_controller.rb +68 -0
- data/bin/check +8 -0
- data/bin/ci-setup +21 -0
- data/bin/postversion +22 -0
- data/crowdin.yaml +23 -0
- data/decidim-telemetry.gemspec +39 -0
- data/docker-compose.ci.yml +48 -0
- data/docker-compose.yml +70 -0
- data/lib/decidim/telemetry/configuration.rb +33 -0
- data/lib/decidim/telemetry/engine.rb +138 -0
- data/lib/decidim/telemetry/middleware/basic_auth.rb +44 -0
- data/lib/decidim/telemetry/open_telemetry/configuration.rb +61 -0
- data/lib/decidim/telemetry/open_telemetry/configurator.rb +146 -0
- data/lib/decidim/telemetry/open_telemetry/decidim_context_attributes.rb +58 -0
- data/lib/decidim/telemetry/open_telemetry/logger_provider_resolver.rb +15 -0
- data/lib/decidim/telemetry/open_telemetry/logs_setup.rb +163 -0
- data/lib/decidim/telemetry/open_telemetry/otel_decidim_context.rb +36 -0
- data/lib/decidim/telemetry/open_telemetry/otel_error_subscriber.rb +101 -0
- data/lib/decidim/telemetry/open_telemetry/otel_logger.rb +127 -0
- data/lib/decidim/telemetry/open_telemetry/request_env.rb +37 -0
- data/lib/decidim/telemetry/open_telemetry.rb +18 -0
- data/lib/decidim/telemetry/overrides/decidim_application_controller.rb +20 -0
- data/lib/decidim/telemetry/overrides/decidim_proposal_command.rb +25 -0
- data/lib/decidim/telemetry/test/factories.rb +3 -0
- data/lib/decidim/telemetry/version.rb +11 -0
- data/lib/decidim/telemetry.rb +52 -0
- data/lib/tasks/decidim/telemetry/opentelemetry.rake +96 -0
- data/lib/tasks/decidim/telemetry/telemetry_upgrade.rake +13 -0
- data/lib/tasks/decidim/telemetry/telemetry_webpacker.rake +58 -0
- data/package.json +15 -0
- data/svgo.config.js +14 -0
- data/website/docs/configuration.md +78 -0
- data/website/docs/developer/_category_.json +4 -0
- data/website/docs/developer/code-of-conduct.md +16 -0
- data/website/docs/developer/contribute.md +70 -0
- data/website/docs/developer/documentation.md +47 -0
- data/website/docs/endpoints.md +62 -0
- data/website/docs/faq.md +61 -0
- data/website/docs/index.md +47 -0
- data/website/docs/install.md +79 -0
- data/website/docs/metrics.md +57 -0
- data/website/docs/opentelemetry.md +80 -0
- data/website/docs/prometheus.md +69 -0
- data/website/docs/security.md +50 -0
- data/website/docusaurus.config.ts +88 -0
- data/website/package.json +31 -0
- data/website/sidebars.ts +7 -0
- data/website/src/css/custom.css +22 -0
- data/website/static/img/logo.svg +1 -0
- data/website/tsconfig.json +6 -0
- data/website/yarn.lock +8336 -0
- metadata +294 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build Docusaurus
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
- name: Enable Corepack
|
|
17
|
+
run: corepack enable
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 22
|
|
21
|
+
cache: yarn
|
|
22
|
+
cache-dependency-path: website/yarn.lock
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
working-directory: website
|
|
25
|
+
run: yarn install --frozen-lockfile
|
|
26
|
+
|
|
27
|
+
- name: Build website
|
|
28
|
+
working-directory: website
|
|
29
|
+
run: yarn build
|
|
30
|
+
|
|
31
|
+
- name: Upload Build Artifact
|
|
32
|
+
uses: actions/upload-pages-artifact@v3
|
|
33
|
+
with:
|
|
34
|
+
path: website/build
|
|
35
|
+
|
|
36
|
+
deploy:
|
|
37
|
+
name: Deploy to GitHub Pages
|
|
38
|
+
needs: build
|
|
39
|
+
|
|
40
|
+
permissions:
|
|
41
|
+
pages: write
|
|
42
|
+
id-token: write
|
|
43
|
+
|
|
44
|
+
environment:
|
|
45
|
+
name: github-pages
|
|
46
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
47
|
+
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: Deploy to GitHub Pages
|
|
51
|
+
id: deployment
|
|
52
|
+
uses: actions/deploy-pages@v4
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
##
|
|
2
|
+
# Set of re-usable rules for decidim module development.
|
|
3
|
+
# You are required to set the following CI/CD variables:
|
|
4
|
+
#
|
|
5
|
+
# - CROWDIN_PERSONAL_TOKEN: protected & masked. // API Token from crowdin
|
|
6
|
+
# - CROWDIN_PROJECT_ID: masked. // Project ID from crowdin
|
|
7
|
+
# - TRANSLATIONBOT_ID: masked. // Project Bot `mr-translation` user id (see in repo>members tab)
|
|
8
|
+
# - TRANSLATIONBOT_ACCESS_TOKEN: masked. // Project Token with name `mr-translations`
|
|
9
|
+
# - GEM_HOST_API_KEY: protected & masked. //
|
|
10
|
+
stages:
|
|
11
|
+
- lint
|
|
12
|
+
- test
|
|
13
|
+
- translate
|
|
14
|
+
- publish
|
|
15
|
+
variables:
|
|
16
|
+
POSTGRES_DB: decidim_test
|
|
17
|
+
POSTGRES_USER: decidim
|
|
18
|
+
POSTGRES_PASSWORD: "TEST-insecure_password"
|
|
19
|
+
|
|
20
|
+
services:
|
|
21
|
+
- postgres:17
|
|
22
|
+
- redis:latest
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.development_rules:
|
|
26
|
+
rules:
|
|
27
|
+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
28
|
+
when: never
|
|
29
|
+
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
30
|
+
when: always
|
|
31
|
+
- if: '$CI_COMMIT_TAG'
|
|
32
|
+
when: always
|
|
33
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
34
|
+
when: always
|
|
35
|
+
.publication_rules:
|
|
36
|
+
rules:
|
|
37
|
+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
38
|
+
when: never
|
|
39
|
+
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
40
|
+
when: always
|
|
41
|
+
- if: '$CI_COMMIT_TAG'
|
|
42
|
+
when: always
|
|
43
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
44
|
+
when: manual
|
|
45
|
+
##
|
|
46
|
+
# Lint ruby code
|
|
47
|
+
ruby::rubocop:
|
|
48
|
+
extends: .development_rules
|
|
49
|
+
image: ruby:3.2.2
|
|
50
|
+
stage: lint
|
|
51
|
+
script:
|
|
52
|
+
- bundle
|
|
53
|
+
- bundle exec rubocop
|
|
54
|
+
|
|
55
|
+
# ruby::erb:
|
|
56
|
+
# extends: .development_rules
|
|
57
|
+
# image: ruby:3.2.2
|
|
58
|
+
# stage: lint
|
|
59
|
+
# script:
|
|
60
|
+
# - bundle
|
|
61
|
+
# - bundle exec erblint --lint-all --enable-all-linters
|
|
62
|
+
|
|
63
|
+
##
|
|
64
|
+
# Lint crowdin.yml configuration file
|
|
65
|
+
# crowdin::lint:
|
|
66
|
+
# extends: .development_rules
|
|
67
|
+
# image: node:20
|
|
68
|
+
# stage: lint
|
|
69
|
+
# script:
|
|
70
|
+
# - npm install -g @crowdin/cli
|
|
71
|
+
# - crowdin status -T $CROWDIN_PERSONAL_TOKEN -i $CROWDIN_PROJECT_ID --no-progress
|
|
72
|
+
# allow_failure: true
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# Publish the gem un ruby gem.
|
|
76
|
+
ruby::rubygem:
|
|
77
|
+
image: ruby:3.2.2
|
|
78
|
+
stage: publish
|
|
79
|
+
script:
|
|
80
|
+
- echo "---" > .credentials
|
|
81
|
+
- |
|
|
82
|
+
echo ":ci_rubygems_api_key: $GEM_HOST_API_KEY" >> .credentials
|
|
83
|
+
- chmod 0600 .credentials
|
|
84
|
+
- gem build decidim*.gemspec
|
|
85
|
+
- gem push decidim*.gem -k ci_rubygems_api_key --config-file .credentials
|
|
86
|
+
only:
|
|
87
|
+
- tags
|
|
88
|
+
##
|
|
89
|
+
# Upload new translation keys to crowdin
|
|
90
|
+
# crowdin::upload:
|
|
91
|
+
# stage: translate
|
|
92
|
+
# image: node:18.20
|
|
93
|
+
# script:
|
|
94
|
+
# - npm install -g @crowdin/cli
|
|
95
|
+
# - crowdin upload -T $CROWDIN_PERSONAL_TOKEN -i $CROWDIN_PROJECT_ID --no-progress
|
|
96
|
+
# - crowdin status -T $CROWDIN_PERSONAL_TOKEN -i $CROWDIN_PROJECT_ID --no-progress
|
|
97
|
+
# when: manual
|
|
98
|
+
|
|
99
|
+
##
|
|
100
|
+
# Create a Merge request in the project with updated
|
|
101
|
+
# crowndin translations.
|
|
102
|
+
# crowdin::merge_request:
|
|
103
|
+
# stage: translate
|
|
104
|
+
# image: node:18.20
|
|
105
|
+
# rules:
|
|
106
|
+
# - if: '$CI_COMMIT_BRANCH == "main" && $GITLAB_USER_ID != $TRANSLATIONBOT_ID'
|
|
107
|
+
# when: always
|
|
108
|
+
# before_script:
|
|
109
|
+
# - apt-get update && apt-get install -y git
|
|
110
|
+
# script:
|
|
111
|
+
# - git config --global user.email "mr-translations"
|
|
112
|
+
# - git config --global user.name "$TRANSLATIONBOT_ID"
|
|
113
|
+
# - npm install -g @crowdin/cli
|
|
114
|
+
# - crowdin download -T $CROWDIN_PERSONAL_TOKEN -i $CROWDIN_PROJECT_ID --no-progress
|
|
115
|
+
# - crowdin status -T $CROWDIN_PERSONAL_TOKEN -i $CROWDIN_PROJECT_ID --no-progress
|
|
116
|
+
# - export BRANCH_NAME="i18n/$(date +%Y%m%d%H%M%S)"
|
|
117
|
+
# - export ORIGIN="crowndin_$(date +%Y%m%d%H%M%S)"
|
|
118
|
+
# - echo "add $ORIGIN=https://$TRANSLATIONBOT_ID:$TRANSLATIONBOT_ACCESS_TOKEN@git.octree.ch/$CI_PROJECT_PATH.git"
|
|
119
|
+
# - git remote add $ORIGIN https://$TRANSLATIONBOT_ID:$TRANSLATIONBOT_ACCESS_TOKEN@git.octree.ch/$CI_PROJECT_PATH.git
|
|
120
|
+
# - git checkout -b $BRANCH_NAME
|
|
121
|
+
# - git add config/locales
|
|
122
|
+
# - git commit -m "Crowdin Updates"
|
|
123
|
+
# - git push $ORIGIN HEAD:$BRANCH_NAME -o merge_request.create -o merge_request.target=main
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
# Execute rspec and expose a spec report
|
|
127
|
+
ruby::rspec:
|
|
128
|
+
image: ruby:3.2.2
|
|
129
|
+
stage: test
|
|
130
|
+
extends: .development_rules
|
|
131
|
+
artifacts:
|
|
132
|
+
reports:
|
|
133
|
+
coverage_report:
|
|
134
|
+
coverage_format: cobertura
|
|
135
|
+
path: coverage/coverage.xml
|
|
136
|
+
variables:
|
|
137
|
+
DATABASE_HOST: "postgres"
|
|
138
|
+
# trunk-ignore(gitleaks/generic-api-key)
|
|
139
|
+
DATABASE_PASSWORD: "TEST-insecure_password"
|
|
140
|
+
DATABASE_USERNAME: "decidim"
|
|
141
|
+
DISABLED_DOCKER_COMPOSE: "true"
|
|
142
|
+
NODE_MAJOR: 18
|
|
143
|
+
SIMPLECOV: 1
|
|
144
|
+
CI: 1
|
|
145
|
+
before_script:
|
|
146
|
+
- apt-get update -qq && apt-get install -y ca-certificates curl gnupg
|
|
147
|
+
- mkdir -p /etc/apt/keyrings
|
|
148
|
+
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
149
|
+
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
|
150
|
+
- apt-get update && apt-get install -y -qq nodejs
|
|
151
|
+
- npm install -g yarn --force
|
|
152
|
+
- gem install bundler
|
|
153
|
+
- bundle config set path 'vendor'
|
|
154
|
+
- RAILS_ENV=development bundle install -j $(nproc)
|
|
155
|
+
- bundle exec rake test_app
|
|
156
|
+
script:
|
|
157
|
+
- RAILS_ENV=test bundle exec rspec
|
data/.markdownlint.yaml
ADDED
data/.prettierrc
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Contributing to decidim-telemetry
|
|
2
|
+
|
|
3
|
+
Contributor documentation: [octree.ch/decidim-telemetry/contributing](https://octree.ch/decidim-telemetry/contributing).
|
|
4
|
+
|
|
5
|
+
## Quick links
|
|
6
|
+
|
|
7
|
+
- **Doc site (local):** `cd website && yarn && yarn start`
|
|
8
|
+
- **Doc site (build):** `cd website && yarn build`
|
|
9
|
+
- **Local CI (parity with GitLab):**
|
|
10
|
+
`docker compose -f docker-compose.ci.yml run --rm rspec bash -lc 'bin/ci-setup && bundle exec rubocop .'`
|
|
11
|
+
`docker compose -f docker-compose.ci.yml run --rm rspec`
|
|
12
|
+
- **Dev container check:** `./bin/check` — RuboCop, RSpec (inside `docker compose` service `telemetry`)
|
|
13
|
+
- **Local OTEL UI:** `docker compose up -d` → [http://localhost:8000](http://localhost:8000) (viewer) · Decidim on [http://localhost:3029](http://localhost:3029)
|
|
14
|
+
- **GitLab:** [issues](https://git.octree.ch/decidim/vocacity/decidim-modules/decidim-telemetry/-/issues) · [merge requests](https://git.octree.ch/decidim/vocacity/decidim-modules/decidim-telemetry/-/merge_requests)
|
|
15
|
+
- **Code of conduct:** [octree.ch/decidim-telemetry/code-of-conduct](https://octree.ch/decidim-telemetry/code-of-conduct)
|
|
16
|
+
|
|
17
|
+
## Platform administrators
|
|
18
|
+
|
|
19
|
+
Install guide: [octree.ch/decidim-telemetry/install](https://octree.ch/decidim-telemetry/install).
|
|
20
|
+
|
|
21
|
+
Host install summary: [README.md](README.md).
|
data/Gemfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
ruby RUBY_VERSION
|
|
6
|
+
|
|
7
|
+
# Inside the development app, the relative require has to be one level up, as
|
|
8
|
+
# the Gemfile is copied to the development_app folder (almost) as is.
|
|
9
|
+
base_path = ""
|
|
10
|
+
base_path = "../" if File.basename(__dir__) == "development_app"
|
|
11
|
+
require_relative "#{base_path}lib/decidim/telemetry/version"
|
|
12
|
+
|
|
13
|
+
DECIDIM_VERSION = Decidim::Telemetry::COMPAT_DECIDIM_VERSION
|
|
14
|
+
|
|
15
|
+
gem "bootsnap", "~> 1.4"
|
|
16
|
+
gem "decidim", DECIDIM_VERSION
|
|
17
|
+
gem "decidim-telemetry", path: "."
|
|
18
|
+
|
|
19
|
+
gem "puma", ">= 6.3.1"
|
|
20
|
+
|
|
21
|
+
gem "deface",
|
|
22
|
+
git: "https://github.com/froger/deface",
|
|
23
|
+
branch: "fix/js-overrides"
|
|
24
|
+
|
|
25
|
+
group :development, :test do
|
|
26
|
+
gem "byebug", "~> 11.0", platform: :mri
|
|
27
|
+
|
|
28
|
+
gem "decidim-dev", DECIDIM_VERSION
|
|
29
|
+
|
|
30
|
+
gem "brakeman", "~> 6.1"
|
|
31
|
+
gem "parallel_tests", "~> 4.2"
|
|
32
|
+
gem "rexml", "3.4.0"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
group :development do
|
|
36
|
+
gem "letter_opener_web", "~> 2.0"
|
|
37
|
+
gem "listen", "~> 3.1"
|
|
38
|
+
gem "web-console", "~> 4.2"
|
|
39
|
+
end
|