Commit 32e77114 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'ce-to-ee-2018-09-05' into 'master'

CE upstream - 2018-09-05 21:23 UTC

Closes #6136

See merge request gitlab-org/gitlab-ee!7259
parents 55fb1d13 ac5fdda4
---
title: Add route information to lograge structured logging for API logs
merge_request: 21487
author:
type: other
...@@ -7,7 +7,7 @@ projects. ...@@ -7,7 +7,7 @@ projects.
GitLab offers a [continuous integration][ci] service. If you GitLab offers a [continuous integration][ci] service. If you
[add a `.gitlab-ci.yml` file][yaml] to the root directory of your repository, [add a `.gitlab-ci.yml` file][yaml] to the root directory of your repository,
and configure your GitLab project to use a [Runner], then each commit or and configure your GitLab project to use a [Runner], then each commit or
push, triggers your CI [pipeline]. push triggers your CI [pipeline].
The `.gitlab-ci.yml` file tells the GitLab runner what to do. By default it runs The `.gitlab-ci.yml` file tells the GitLab runner what to do. By default it runs
a pipeline with three [stages]: `build`, `test`, and `deploy`. You don't need to a pipeline with three [stages]: `build`, `test`, and `deploy`. You don't need to
......
...@@ -133,6 +133,7 @@ Once your GitLab Chart is installed, configuration changes and chart updates ...@@ -133,6 +133,7 @@ Once your GitLab Chart is installed, configuration changes and chart updates
should be done using `helm upgrade`: should be done using `helm upgrade`:
```sh ```sh
helm repo update
helm upgrade --reuse-values gitlab gitlab/gitlab helm upgrade --reuse-values gitlab gitlab/gitlab
``` ```
......
...@@ -15,6 +15,7 @@ module API ...@@ -15,6 +15,7 @@ module API
include: [ include: [
GrapeLogging::Loggers::FilterParameters.new, GrapeLogging::Loggers::FilterParameters.new,
GrapeLogging::Loggers::ClientEnv.new, GrapeLogging::Loggers::ClientEnv.new,
Gitlab::GrapeLogging::Loggers::RouteLogger.new,
Gitlab::GrapeLogging::Loggers::UserLogger.new, Gitlab::GrapeLogging::Loggers::UserLogger.new,
Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new, Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new,
Gitlab::GrapeLogging::Loggers::PerfLogger.new Gitlab::GrapeLogging::Loggers::PerfLogger.new
......
# frozen_string_literal: true
# This grape_logging module (https://github.com/aserafin/grape_logging) makes it
# possible to log the details of the action
module Gitlab
module GrapeLogging
module Loggers
class RouteLogger < ::GrapeLogging::Loggers::Base
def parameters(request, _)
endpoint = request.env[Grape::Env::API_ENDPOINT]
route = endpoint&.route&.pattern&.origin
return {} unless route
{ route: route }
rescue
# endpoint.route calls env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info]
# but env[Grape::Env::GRAPE_ROUTING_ARGS] is nil in the case of a 405 response
# so we're rescuing exceptions and bailing out
{}
end
end
end
end
end
...@@ -83,7 +83,7 @@ module Gitlab ...@@ -83,7 +83,7 @@ module Gitlab
def open_file(params, key) def open_file(params, key)
allowed_paths = [ allowed_paths = [
FileUploader.root, ::FileUploader.root,
Gitlab.config.uploads.storage_path, Gitlab.config.uploads.storage_path,
File.join(Rails.root, 'public/uploads/tmp') File.join(Rails.root, 'public/uploads/tmp')
] ]
......
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