Commit f4798c64 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'dz-error-tracking-backend-models-2' into 'master'

Improve Error Tracking models

See merge request gitlab-org/gitlab!65753
parents 1d2c38db a92eb02c
# frozen_string_literal: true # frozen_string_literal: true
class ErrorTracking::ErrorEvent < ApplicationRecord class ErrorTracking::ErrorEvent < ApplicationRecord
belongs_to :error belongs_to :error, counter_cache: :events_count
validates :payload, json_schema: { filename: 'error_tracking_event_payload' } validates :payload, json_schema: { filename: 'error_tracking_event_payload' }
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
"description": "Error tracking event payload", "description": "Error tracking event payload",
"type": "object", "type": "object",
"required": [], "required": [],
"modules": {
"type": "object"
},
"properties": { "properties": {
"event_id": { "event_id": {
"type": "string" "type": "string"
...@@ -73,28 +76,7 @@ ...@@ -73,28 +76,7 @@
} }
}, },
"trace": { "trace": {
"type": "object", "type": "object"
"required": [],
"properties": {
"trace_id": {
"type": "string"
},
"span_id": {
"type": "string"
},
"parent_span_id": {
"type": "string"
},
"description": {
"type": "string"
},
"op": {
"type": "string"
},
"status": {
"type": "string"
}
}
} }
} }
}, },
...@@ -118,52 +100,13 @@ ...@@ -118,52 +100,13 @@
"type": "string" "type": "string"
}, },
"data": { "data": {
"type": "object", "type": "object"
"required": [],
"properties": {
"controller": {
"type": "string"
},
"action": {
"type": "string"
},
"params": {
"type": "object",
"required": [],
"properties": {
"controller": {
"type": "string"
},
"action": {
"type": "string"
}
}
},
"format": {
"type": "string"
},
"method": {
"type": "string"
},
"path": {
"type": "string"
},
"start_timestamp": {
"type": "number"
}
}
},
"level": {
"type": "string"
}, },
"message": { "message": {
"type": "string" "type": "string"
}, },
"timestamp": { "timestamp": {
"type": "number" "type": "number"
},
"type": {
"type": "string"
} }
} }
} }
...@@ -199,37 +142,7 @@ ...@@ -199,37 +142,7 @@
"type": "string" "type": "string"
}, },
"headers": { "headers": {
"type": "object", "type": "object"
"required": [],
"properties": {
"Host": {
"type": "string"
},
"User-Agent": {
"type": "string"
},
"Accept": {
"type": "string"
},
"Accept-Language": {
"type": "string"
},
"Accept-Encoding": {
"type": "string"
},
"Referer": {
"type": "string"
},
"Turbolinks-Referrer": {
"type": "string"
},
"Connection": {
"type": "string"
},
"X-Request-Id": {
"type": "string"
}
}
}, },
"env": { "env": {
"type": "object", "type": "object",
...@@ -290,25 +203,19 @@ ...@@ -290,25 +203,19 @@
"type": "number" "type": "number"
}, },
"in_app": { "in_app": {
"type": "string" "type": "boolean"
}, },
"filename": { "filename": {
"type": "string" "type": "string"
}, },
"pre_context": { "pre_context": {
"type": "array", "type": "array"
"items": {
"type": "string"
}
}, },
"context_line": { "context_line": {
"type": "string" "type": "string"
}, },
"post_context": { "post_context": {
"type": "array", "type": "array"
"items": {
"type": "string"
}
} }
} }
} }
......
# frozen_string_literal: true
class AddErrorTrackingCounterCache < ActiveRecord::Migration[6.1]
def up
add_column :error_tracking_errors, :events_count, :bigint, null: false, default: 0
end
def down
remove_column :error_tracking_errors, :events_count
end
end
ed0c0dc015e7c3457248303b8b478c8d259d6a800a2bfed8b05b1f976b6794a7
\ No newline at end of file
...@@ -12790,6 +12790,7 @@ CREATE TABLE error_tracking_errors ( ...@@ -12790,6 +12790,7 @@ CREATE TABLE error_tracking_errors (
platform text, platform text,
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL,
events_count bigint DEFAULT 0 NOT NULL,
CONSTRAINT check_18a758e537 CHECK ((char_length(name) <= 255)), CONSTRAINT check_18a758e537 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_b5cb4d3888 CHECK ((char_length(actor) <= 255)), CONSTRAINT check_b5cb4d3888 CHECK ((char_length(actor) <= 255)),
CONSTRAINT check_c739788b12 CHECK ((char_length(description) <= 1024)), CONSTRAINT check_c739788b12 CHECK ((char_length(description) <= 1024)),
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment