add datadog proxy
This commit is contained in:
parent
a56ff25105
commit
468b439dd4
@ -13,7 +13,6 @@ import requests
|
|||||||
from discord_webhook import DiscordWebhook
|
from discord_webhook import DiscordWebhook
|
||||||
from metrics import Metrics
|
from metrics import Metrics
|
||||||
|
|
||||||
|
|
||||||
Metrics.init()
|
Metrics.init()
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -612,6 +611,24 @@ def pool_metrics():
|
|||||||
Metrics.send_metric('online_players', points=[online_players])
|
Metrics.send_metric('online_players', points=[online_players])
|
||||||
pool_metrics()
|
pool_metrics()
|
||||||
|
|
||||||
|
import urllib.parse
|
||||||
|
class CustomProxyFix(object):
|
||||||
|
def __init__(self, app):
|
||||||
|
self.app = app
|
||||||
|
print('init')
|
||||||
|
|
||||||
|
def __call__(self, environ, start_response):
|
||||||
|
path = environ.get('PATH_INFO', '')
|
||||||
|
if 'ddproxy' in path:
|
||||||
|
newurl = urllib.parse.unquote(environ['QUERY_STRING'].replace('ddforward=', ''))
|
||||||
|
heads = {'X-Forwarded-For': environ['REMOTE_ADDR']}
|
||||||
|
for h in environ['headers_raw']:
|
||||||
|
heads[h[0]] = h[1]
|
||||||
|
r = requests.post(newurl, data=environ['wsgi.input'].read(), headers=heads)
|
||||||
|
start_response('200 OK', [])
|
||||||
|
return ['']
|
||||||
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sio.start_background_task(pool_metrics)
|
sio.start_background_task(pool_metrics)
|
||||||
eventlet.wsgi.server(eventlet.listen(('', 5001)), app)
|
eventlet.wsgi.server(eventlet.listen(('', 5001)), CustomProxyFix(app))
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import FullScreenInput from './components/FullScreenInput.vue'
|
import FullScreenInput from './components/FullScreenInput.vue'
|
||||||
import Help from './components/Help.vue';
|
import Help from './components/Help.vue';
|
||||||
// import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { datadogRum } from '@datadog/browser-rum';
|
import { datadogRum } from '@datadog/browser-rum';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -142,7 +142,8 @@ export default {
|
|||||||
service:'bang-frontend',
|
service:'bang-frontend',
|
||||||
sampleRate: 100,
|
sampleRate: 100,
|
||||||
trackInteractions: true,
|
trackInteractions: true,
|
||||||
defaultPrivacyLevel: 'mask-user-input'
|
defaultPrivacyLevel: 'allow',
|
||||||
|
proxyUrl: (Vue.config.devtools ? `http://${window.location.hostname}:5001` : window.location.origin) + '/ddproxy',
|
||||||
});
|
});
|
||||||
|
|
||||||
datadogRum.startSessionReplayRecording();
|
datadogRum.startSessionReplayRecording();
|
||||||
|
Loading…
Reference in New Issue
Block a user