зеркало из https://github.com/mozilla/normandy.git
Remove navigator.oscpu logging
This commit is contained in:
Родитель
2e42380e94
Коммит
3cf74bcf77
|
@ -94,7 +94,6 @@ export function classifyClient() {
|
|||
const headers = { Accept: 'application/json' };
|
||||
|
||||
classifyUrl = new URL(classifyUrl, window.location.href);
|
||||
classifyUrl.searchParams.set('oscpu', classifyClient.getOscpu() || 'unknown');
|
||||
|
||||
return fetch(classifyUrl.href, { headers })
|
||||
.then(response => response.json())
|
||||
|
@ -104,7 +103,6 @@ export function classifyClient() {
|
|||
return classification;
|
||||
});
|
||||
}
|
||||
classifyClient.getOscpu = () => navigator.oscpu;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,23 +38,6 @@ describe('Self-Repair Runner', () => {
|
|||
}));
|
||||
expect(new URL(fetchMock.lastUrl()).pathname).toEqual(url);
|
||||
});
|
||||
|
||||
it('should include navigator.oscpu in the query arguments', async () => {
|
||||
const oscpu = 'fake oscpu';
|
||||
spyOn(classifyClient, 'getOscpu').and.returnValue(oscpu);
|
||||
|
||||
await classifyClient();
|
||||
const fetchUrl = new URL(fetchMock.lastUrl());
|
||||
expect(fetchUrl.searchParams.get('oscpu')).toEqual(oscpu);
|
||||
});
|
||||
|
||||
it('should indicate when it could not find navigator.oscpu', async () => {
|
||||
spyOn(classifyClient, 'getOscpu').and.returnValue(undefined);
|
||||
|
||||
await classifyClient();
|
||||
const fetchUrl = new URL(fetchMock.lastUrl());
|
||||
expect(fetchUrl.searchParams.get('oscpu')).toEqual('unknown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('filterContext', () => {
|
||||
|
|
|
@ -179,12 +179,6 @@ in other Django projects.
|
|||
|
||||
.. _mozlog: https://github.com/mozilla-services/Dockerflow/blob/master/docs/mozlog.md
|
||||
|
||||
.. envvar:: DJANGO_LOG_OSCPU_RATE
|
||||
|
||||
:default: ``0.001``
|
||||
|
||||
Rate to log ``navigator.oscpu`` values sent by clients.
|
||||
|
||||
Gunicorn settings
|
||||
-----------------
|
||||
These settings control how Gunicorn starts, when the default command of the
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import logging
|
||||
import random
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.views.decorators.cache import cache_control
|
||||
|
@ -30,9 +27,6 @@ from normandy.recipes.api.serializers import (
|
|||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ActionViewSet(CachingViewsetMixin, viewsets.ReadOnlyModelViewSet):
|
||||
"""Viewset for viewing recipe actions."""
|
||||
queryset = Action.objects.all()
|
||||
|
@ -220,13 +214,6 @@ class ClassifyClient(views.APIView):
|
|||
serializer_class = ClientSerializer
|
||||
|
||||
def get(self, request, format=None):
|
||||
# Temporary: Log navigator.oscpu as sent by users.
|
||||
if 'oscpu' in request.GET and random.random() <= settings.LOG_OSCPU_RATE:
|
||||
oscpu = request.GET['oscpu']
|
||||
logger.debug('navigator.oscpu={}'.format(oscpu), extra={
|
||||
'navigator.oscpu': oscpu
|
||||
})
|
||||
|
||||
client = Client(request)
|
||||
serializer = self.serializer_class(client, context={'request': request})
|
||||
return Response(serializer.data)
|
||||
|
|
|
@ -599,19 +599,3 @@ class TestClassifyClient(object):
|
|||
res = api_client.get('/api/v1/classify_client/')
|
||||
assert res.status_code == 200
|
||||
assert res.client.cookies == {}
|
||||
|
||||
def test_it_logs_oscpu(self, api_client, settings, mocker):
|
||||
settings.LOG_OSCPU_RATE = 1
|
||||
logger = mocker.patch('normandy.recipes.api.views.logger')
|
||||
|
||||
api_client.get('/api/v1/classify_client/', {'oscpu': 'test_oscpu'})
|
||||
logger.debug.assert_called_with('navigator.oscpu=test_oscpu', extra={
|
||||
'navigator.oscpu': 'test_oscpu'
|
||||
})
|
||||
|
||||
def test_it_doesnt_log_missing_oscpu(self, api_client, settings, mocker):
|
||||
settings.LOG_OSCPU_RATE = 1
|
||||
logger = mocker.patch('normandy.recipes.api.views.logger')
|
||||
|
||||
api_client.get('/api/v1/classify_client/')
|
||||
assert not logger.debug.called
|
||||
|
|
|
@ -255,7 +255,6 @@ class Base(Core):
|
|||
ACTION_IMPLEMENTATION_CACHE_TIME = values.IntegerValue(60 * 60 * 24 * 365)
|
||||
NUM_PROXIES = values.IntegerValue(0)
|
||||
API_CACHE_TIME = values.IntegerValue(30)
|
||||
LOG_OSCPU_RATE = values.FloatValue(0.001)
|
||||
# Autograph settings
|
||||
AUTOGRAPH_URL = values.Value()
|
||||
AUTOGRAPH_HAWK_ID = values.Value()
|
||||
|
@ -278,7 +277,6 @@ class Development(Base):
|
|||
|
||||
CAN_EDIT_ACTIONS_IN_USE = values.BooleanValue(True)
|
||||
API_CACHE_TIME = values.IntegerValue(0)
|
||||
LOG_OSCPU_RATE = values.FloatValue(1)
|
||||
|
||||
|
||||
class Production(Base):
|
||||
|
|
Загрузка…
Ссылка в новой задаче