Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e3577373
Commit
e3577373
authored
Feb 17, 2020
by
Adrien Kohlbecker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rescue elasticsearch server error in pod logs
parent
10b04c00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
+30
-0
changelogs/unreleased/ak-rescue-error.yml
changelogs/unreleased/ak-rescue-error.yml
+5
-0
ee/app/services/pod_logs/elasticsearch_service.rb
ee/app/services/pod_logs/elasticsearch_service.rb
+8
-0
ee/spec/services/pod_logs/elasticsearch_service_spec.rb
ee/spec/services/pod_logs/elasticsearch_service_spec.rb
+14
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
changelogs/unreleased/ak-rescue-error.yml
0 → 100644
View file @
e3577373
---
title
:
Rescue elasticsearch server error in pod logs
merge_request
:
25367
author
:
type
:
fixed
ee/app/services/pod_logs/elasticsearch_service.rb
View file @
e3577373
...
@@ -51,6 +51,14 @@ module PodLogs
...
@@ -51,6 +51,14 @@ module PodLogs
)
)
success
(
result
)
success
(
result
)
rescue
Elasticsearch
::
Transport
::
Transport
::
ServerError
=>
e
::
Gitlab
::
ErrorTracking
.
track_exception
(
e
)
error
(
_
(
'Elasticsearch returned status code: %{status_code}'
)
%
{
# ServerError is the parent class of exceptions named after HTTP status codes, eg: "Elasticsearch::Transport::Transport::Errors::NotFound"
# there is no method on the exception other than the class name to determine the type of error encountered.
status_code:
e
.
class
.
name
.
split
(
'::'
).
last
})
end
end
def
etag_path
def
etag_path
...
...
ee/spec/services/pod_logs/elasticsearch_service_spec.rb
View file @
e3577373
...
@@ -157,5 +157,19 @@ describe ::PodLogs::ElasticsearchService do
...
@@ -157,5 +157,19 @@ describe ::PodLogs::ElasticsearchService do
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
eq
(
'Unable to connect to Elasticsearch'
)
expect
(
result
[
:message
]).
to
eq
(
'Unable to connect to Elasticsearch'
)
end
end
it
'handles server errors from elasticsearch'
do
allow_any_instance_of
(
::
Clusters
::
Applications
::
ElasticStack
)
.
to
receive
(
:elasticsearch_client
)
.
and_return
(
Elasticsearch
::
Transport
::
Client
.
new
)
allow_any_instance_of
(
::
Gitlab
::
Elasticsearch
::
Logs
)
.
to
receive
(
:pod_logs
)
.
and_raise
(
Elasticsearch
::
Transport
::
Transport
::
Errors
::
ServiceUnavailable
.
new
)
result
=
subject
.
send
(
:pod_logs
,
result_arg
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
eq
(
'Elasticsearch returned status code: ServiceUnavailable'
)
end
end
end
end
end
locale/gitlab.pot
View file @
e3577373
...
@@ -7017,6 +7017,9 @@ msgstr ""
...
@@ -7017,6 +7017,9 @@ msgstr ""
msgid "Elasticsearch integration. Elasticsearch AWS IAM."
msgid "Elasticsearch integration. Elasticsearch AWS IAM."
msgstr ""
msgstr ""
msgid "Elasticsearch returned status code: %{status_code}"
msgstr ""
msgid "Elastic|None. Select namespaces to index."
msgid "Elastic|None. Select namespaces to index."
msgstr ""
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment