Skip to content

Commit

Permalink
update to include request origin in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremiahUy committed Jun 15, 2022
1 parent b7af899 commit f8737e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/routes/collect-auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const customHandler = function(request, reply, ingresses) {
const realApiKey = apiKeyMap.has(appContext)
? apiKeyMap.get(appContext)
: apiKeyMap.get('*');
const log = createRequestLog(realApiKey, events[0].event_type, events[0].device_id, request.headers['user-agent'], events[0].platform);
const log = createRequestLog(realApiKey, events[0].event_type, events[0].device_id, request.headers['user-agent'], request.headers['origin']);
const autoTrackKey = process.env.AUTO_TRACK_KEY || 'default';
if (apiKey !== autoTrackKey) {
collectCounter.labels('wrong_api_key', appName, teamName).inc();
Expand Down
2 changes: 1 addition & 1 deletion src/routes/collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const handler = function(request, reply) {
const apiKey = request.body.client;
const shortApiKey = request.body.client.substring(0, 6)
const errors = validateEvents(inputEvents);
const log = createRequestLog(apiKey,inputEvents[0].event_type,inputEvents[0].device_id,request.headers['user-agent'], inputEvents[0].platform)
const log = createRequestLog(apiKey,inputEvents[0].event_type,inputEvents[0].device_id,request.headers['user-agent'], request.headers['origin'])
if (errors.length > 0) {
collectCounter.labels('events_had_errors', shortApiKey).inc();
reply.code(400).send(errors);
Expand Down

0 comments on commit f8737e3

Please sign in to comment.