Skip to content

Error Tracking: Implement OpenAPI strategy for ErrorRepository

Peter Leitzen requested to merge pl-error-tracking-openapi into master

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

Follow-ups in other MRs

Resolves #361341 (closed).

Screenshots or screen recordings

List errors Screenshot_from_2022-06-14_14-22-54
Error details Screenshot_from_2022-06-14_17-56-34
Issue from error Screenshot_from_2022-06-14_17-57-28
Search term Screenshot_from_2022-06-23_13-38-00
Settings page Screenshot_from_2022-06-22_18-00-53

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= 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
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
cd go

# See
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.

3. Enable feature flag

In Rails console do the following feature flags (see gitlab-org/opstrace/opstrace#1728 (closed)):


4. Test on GDK

  1. Go to http://localhost:3000/gitlab-org/gitlab-test/ project_id: 1
  2. Configure "Integrated Error Tracking" via Settings > Monitor > Error Tracking > GitLab, [x] Active and Save changes
  3. 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.

Edited by Lucas Charles

Merge request reports