feat(devops): During feature flag Checkin derive the version from the last field of the user-agent

ref: #678 #676
This commit is contained in:
2025-03-15 04:10:40 +09:30
parent 5f62828f28
commit b4d41970aa
3 changed files with 17 additions and 2 deletions

View File

@ -149,10 +149,19 @@ class ViewSet(PublicReadOnlyViewSet):
or response.status_code == 304
): # Only save check-in if no other error occured.
user_agent = request.headers.get('user-agent', None)
if user_agent is not None:
user_agent = str(user_agent).split(' ')
user_agent = user_agent[( len(user_agent) -1 )]
CheckIn.objects.create(
organization_id = self.kwargs['organization_id'],
software_id = self.kwargs['software_id'],
deployment_id = request.headers.get('client-id', 'not-provided'),
version = user_agent,
feature = 'feature_flag',
)