Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Queue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
Queue
Merge requests
!183
Use Real IPs instead of Proxy IP for Sentry (
#250
)
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Closed
Use Real IPs instead of Proxy IP for Sentry (
#250
)
feature/sentry-use-real-ip
into
development
Overview
0
Commits
823
Pipelines
0
Changes
2
Closed
Use Real IPs instead of Proxy IP for Sentry (#250)
Sander van den Oever
requested to merge
feature/sentry-use-real-ip
into
development
Oct 8, 2019
Overview
0
Commits
823
Pipelines
0
Changes
2
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
2d6832f4
823 commits,
Oct 8, 2019
2 files
+
48
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
src/main/java/nl/tudelft/ewi/queue/factory/QueueSentryClientFactory.java
0 → 100644
+
46
−
0
View file @ 2d6832f4
Edit in single-file editor
Open in Web IDE
/*
* Queue - A Queueing system that can be used to handle labs in higher education Copyright (C) 2016-2019 Delft
* University of Technology
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with this program. If not,
* see <https://www.gnu.org/licenses/>.
*/
package
nl.tudelft.ewi.queue.factory
;
import
io.sentry.DefaultSentryClientFactory
;
import
io.sentry.SentryClient
;
import
io.sentry.dsn.Dsn
;
import
io.sentry.event.helper.ContextBuilderHelper
;
import
io.sentry.event.helper.ForwardedAddressResolver
;
import
io.sentry.event.helper.HttpEventBuilderHelper
;
public
class
QueueSentryClientFactory
extends
DefaultSentryClientFactory
{
/**
* Enable the ForwardedAddressResolver so we can see actual IPs in Sentry for TAM, which is hosted behind a proxy.
*
* See: https://docs.sentry.io/clients/java/config/#custom-functionality
*
* @param dsn URI can be found in Sentry settings (given appropriate access).
* @return a new Sentry Client.
*/
@Override
public
SentryClient
createSentryClient
(
final
Dsn
dsn
)
{
final
SentryClient
sentryClient
=
new
SentryClient
(
createConnection
(
dsn
),
getContextManager
(
dsn
));
// Create and use the ForwardedAddressResolver, which will use the
// X-FORWARDED-FOR header for the remote address if it exists.
final
ForwardedAddressResolver
addressResolver
=
new
ForwardedAddressResolver
();
sentryClient
.
addBuilderHelper
(
new
HttpEventBuilderHelper
(
addressResolver
));
sentryClient
.
addBuilderHelper
(
new
ContextBuilderHelper
(
sentryClient
));
return
configureSentryClient
(
sentryClient
,
dsn
);
}
}
Loading