Skip to content

Commit 1589140

Browse files
committed
Fall back to anonymous uploader for coverage uploaded amplitude event
1 parent 1695b85 commit 1589140

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

upload/views/uploads.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from rest_framework.response import Response
1111
from rest_framework.views import APIView
1212
from shared.api_archive.archive import ArchiveService, MinioEndpoints
13-
from shared.events.amplitude import AmplitudeEventPublisher
13+
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
1414
from shared.metrics import inc_counter
1515
from shared.upload.utils import UploaderType, insert_coverage_measurement
1616

@@ -171,7 +171,9 @@ def send_analytics_data(
171171
AmplitudeEventPublisher().publish(
172172
"Upload Sent",
173173
{
174-
"user_ownerid": commit.author.ownerid,
174+
"user_ownerid": commit.author.ownerid
175+
if commit.author
176+
else UNKNOWN_USER_OWNERID,
175177
"ownerid": commit.repository.author.ownerid,
176178
"repoid": commit.repository.repoid,
177179
"commitid": commit.id, # Not commit.commitid, we do not want a commit SHA here.

0 commit comments

Comments
 (0)