Error Tracking: Implement OpenAPI strategy for ErrorRepository
What does this MR do and why?
This MR implements the OpenAPI strategy for Category:Error Tracking which targets Golang OpenAPI (Opstrace).
TODOs in this MR
-
Add specs - see pipeline:skip-undercoverage -
Handle exceptions
Follow-ups in other MRs
- Use Reactive caching to fetch data in background
- Make host and port configurable via application settings !91148 (merged)
- Add shared secret and send this token in every request. See Error Tracking API: Determine authentication me... (gitlab-org/opstrace/opstrace#1749 - closed)
Resolves #361341 (closed).
Screenshots or screen recordings
Page | |
---|---|
List errors | |
Error details | |
Issue from error | |
Search term | |
Settings page |
How to set up and validate locally
You can use local and remote setup of the opstrace backend.
If you want to use the remote setup, you can skip steps 1. and 2. Don't forget steps 3. and 4.!
Please export ERROR_TRACKING_API_URL=https://staging.opstracegcp.com
and start your GDK.
If you want to use the local setup proceed with:
1. Setup Clickhouse
User/Pass is gitlab
cd /tmp
docker run -d -p 9000:9000 -p 8123:8123 --name clickhouse -e CLICKHOUSE_DB=error_tracking -e CLICKHOUSE_USER=gitlab -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=gitlab --ulimit nofile=262144:262144 --volume=`pwd`/clickhouse:/var/lib/clickhouse clickhouse/clickhouse-server:latest
cd ~/dev
git clone https://gitlab.com/ahegyi/error-tracking-data-generator.git
cd error-tracking-data-generator
ruby datagen.rb
cat schema.sql | docker exec -i clickhouse clickhouse-client --user gitlab --password gitlab -d error_tracking -mn
cat events.csv | docker exec -i clickhouse clickhouse-client --user gitlab --password gitlab -d error_tracking -q 'insert into error_tracking_error_events format CSV'
cat status.csv | docker exec -i clickhouse clickhouse-client --user gitlab --password gitlab -d error_tracking -q 'insert into error_tracking_error_status format CSV'
cat ignored.csv | docker exec -i clickhouse clickhouse-client --user gitlab --password gitlab -d error_tracking -q 'insert into error_tracking_ignored_errors format CSV'
2. Compile and Start Golang server
mkdir /tmp/code
cd code
git clone https://gitlab.com/gitlab-org/opstrace/opstrace.git
cd go
# See https://gitlab.com/gitlab-org/opstrace/opstrace/-/merge_requests/1629#note_990485195
git revert 798f3b581cc9580df814e02a91bf6bf469c03bf7
make errortracking-api
CLICKHOUSE_DSN=clickhouse://gitlab:gitlab@localhost:9000/error_tracking API_BASE_URL=http://localhost:8080 ./errortracking-api
time="2022-06-14T14:33:47+02:00" level=info msg="Serving error tracking at http://[::]:8080"
Confirm via curl -vv http://localhost:8080/errortracking/api/v1/projects/0/errors?status=resolved
.
feature flag
3. EnableIn Rails console do the following feature flags (see gitlab-org/opstrace/opstrace#1728 (closed)):
Feature.enable(:integrated_error_tracking)
Feature.enable(:use_click_house_database_for_error_tracking)
4. Test on GDK
- Go to http://localhost:3000/gitlab-org/gitlab-test/
project_id: 1
❗ - Configure "Integrated Error Tracking" via Settings > Monitor > Error Tracking > GitLab,
[x] Active
andSave changes
- View errors via Monitor > Error Tracking and choose Filter
Resolved
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.