def METHOD_NAME(
    request: Request, response: Response | None, access_log_metadata: _AccessLogMetaData
) -> None:
    """
    Create a log entry to be used for api metrics gathering
    """
    try:
        try:
            view = request.resolver_match._func_path
        except AttributeError:
            view = "Unknown"
        request_user = getattr(request, "user", None)
        user_id = getattr(request_user, "id", None)
        is_app = getattr(request_user, "is_sentry_app", None)
        org_id = getattr(getattr(request, "organization", None), "id", None)
        request_auth = _get_request_auth(request)
        auth_id = getattr(request_auth, "id", None)
        status_code = getattr(response, "status_code", 500)
        log_metrics = dict(
            method=str(request.method),
            view=view,
            response=status_code,
            user_id=str(user_id),
            is_app=str(is_app),
            token_type=str(_get_token_name(request_auth)),
            is_frontend_request=str(is_frontend_request(request)),
            organization_id=str(org_id),
            auth_id=str(auth_id),
            path=str(request.path),
            caller_ip=str(request.META.get("REMOTE_ADDR")),
            user_agent=str(request.META.get("HTTP_USER_AGENT")),
            rate_limited=str(getattr(request, "will_be_rate_limited", False)),
            rate_limit_category=str(getattr(request, "rate_limit_category", None)),
            request_duration_seconds=access_log_metadata.get_request_duration(),
            **_get_rate_limit_stats_dict(request),
        )
        api_access_logger.info("api.access", extra=log_metrics)
        metrics.incr("middleware.access_log.created")
    except Exception:
        api_access_logger.exception("api.access: Error capturing API access logs")