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
46c7fa2a
Commit
46c7fa2a
authored
Feb 18, 2020
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ak/drop-etag' into 'master'
Drop etag cache on logs API See merge request gitlab-org/gitlab!24864
parents
2378b312
7f2957c6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
5 additions
and
95 deletions
+5
-95
changelogs/unreleased/ak-drop-etag.yml
changelogs/unreleased/ak-drop-etag.yml
+5
-0
ee/app/services/pod_logs/base_service.rb
ee/app/services/pod_logs/base_service.rb
+0
-13
ee/app/services/pod_logs/elasticsearch_service.rb
ee/app/services/pod_logs/elasticsearch_service.rb
+0
-10
ee/app/services/pod_logs/kubernetes_service.rb
ee/app/services/pod_logs/kubernetes_service.rb
+0
-10
ee/lib/ee/gitlab/etag_caching/router.rb
ee/lib/ee/gitlab/etag_caching/router.rb
+0
-8
ee/spec/lib/ee/gitlab/etag_caching/router_spec.rb
ee/spec/lib/ee/gitlab/etag_caching/router_spec.rb
+0
-37
ee/spec/services/pod_logs/base_service_spec.rb
ee/spec/services/pod_logs/base_service_spec.rb
+0
-17
No files found.
changelogs/unreleased/ak-drop-etag.yml
0 → 100644
View file @
46c7fa2a
---
title
:
Drop etag cache on logs API
merge_request
:
24864
author
:
type
:
fixed
ee/app/services/pod_logs/base_service.rb
View file @
46c7fa2a
...
...
@@ -41,15 +41,6 @@ module PodLogs
end
end
def
reactive_cache_updated
(
request
,
_opts
)
case
request
when
CACHE_KEY_GET_POD_LOG
::
Gitlab
::
EtagCaching
::
Store
.
new
.
tap
do
|
store
|
store
.
touch
(
etag_path
)
end
end
end
private
def
valid_params
...
...
@@ -130,10 +121,6 @@ module PodLogs
raise
NotImplementedError
end
def
etag_path
raise
NotImplementedError
end
def
filter_return_keys
(
result
)
result
.
slice
(
*
SUCCESS_RETURN_KEYS
)
end
...
...
ee/app/services/pod_logs/elasticsearch_service.rb
View file @
46c7fa2a
...
...
@@ -52,15 +52,5 @@ module PodLogs
success
(
result
)
end
def
etag_path
::
Gitlab
::
Routing
.
url_helpers
.
elasticsearch_project_logs_path
(
environment
.
project
,
params
.
merge
({
environment_name:
environment
.
name
,
format: :json
})
)
end
end
end
ee/app/services/pod_logs/kubernetes_service.rb
View file @
46c7fa2a
...
...
@@ -46,15 +46,5 @@ module PodLogs
error_code:
e
.
error_code
})
end
def
etag_path
::
Gitlab
::
Routing
.
url_helpers
.
k8s_project_logs_path
(
environment
.
project
,
params
.
merge
({
environment_name:
environment
.
name
,
format: :json
})
)
end
end
end
ee/lib/ee/gitlab/etag_caching/router.rb
View file @
46c7fa2a
...
...
@@ -8,14 +8,6 @@ module EE
::
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(^/groups/
#{
::
Gitlab
::
PathRegex
.
full_namespace_route_regex
}
/-/epics/
\d
+/notes
\z
)
,
'epic_notes'
),
::
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
#{
::
Gitlab
::
EtagCaching
::
Router
::
RESERVED_WORDS_PREFIX
}
/logs/k8s
\.
json(
\?
.*)?
\z
)
,
'k8s_pod_logs'
),
::
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
#{
::
Gitlab
::
EtagCaching
::
Router
::
RESERVED_WORDS_PREFIX
}
/logs/elasticsearch
\.
json(
\?
.*)?
\z
)
,
'elasticsearch_pod_logs'
)
].
freeze
...
...
ee/spec/lib/ee/gitlab/etag_caching/router_spec.rb
View file @
46c7fa2a
...
...
@@ -19,41 +19,4 @@ describe Gitlab::EtagCaching::Router do
expect
(
result
).
to
be_blank
end
context
'k8s pod logs'
do
it
'matches with pod_name and container_name'
do
result
=
described_class
.
match
(
'/environments/7/pods/pod_name/containers/container_name/logs/k8s.json'
)
expect
(
result
).
to
be_present
expect
(
result
.
name
).
to
eq
'k8s_pod_logs'
end
it
'matches with pod_name'
do
result
=
described_class
.
match
(
'/environments/7/pods/pod_name/containers/logs/k8s.json'
)
expect
(
result
).
to
be_present
expect
(
result
.
name
).
to
eq
'k8s_pod_logs'
end
it
'matches without pod_name and container_name'
do
result
=
described_class
.
match
(
'/environments/7/pods/containers/logs/k8s.json'
)
expect
(
result
).
to
be_present
expect
(
result
.
name
).
to
eq
'k8s_pod_logs'
end
it
'does not match non json format'
do
result
=
described_class
.
match
(
'/environments/7/logs'
)
expect
(
result
).
not_to
be_present
end
end
end
ee/spec/services/pod_logs/base_service_spec.rb
View file @
46c7fa2a
...
...
@@ -201,21 +201,4 @@ describe ::PodLogs::BaseService do
expect
(
result
[
:message
]).
to
eq
(
'Container does not exist'
)
end
end
describe
'#reactive_cache_updated'
do
context
'get_pod_log'
do
let
(
:cache_key
)
{
'get_pod_log'
}
it
'expires k8s_pod_logs etag cache'
do
expected_path
=
"/root/autodevops-deploy/-/logs/k8s.json"
allow
(
subject
).
to
receive
(
:etag_path
).
and_return
(
expected_path
)
allow_next_instance_of
(
Gitlab
::
EtagCaching
::
Store
)
do
|
store
|
allow
(
store
).
to
receive
(
:touch
).
with
(
expected_path
).
and_call_original
end
subject
.
reactive_cache_updated
(
cache_key
,
{})
end
end
end
end
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