code: def test_fastapi_detected(manage_ray_with_telemetry):
      """
      Check that FastAPI is detected by telemetry.
      """
  
      subprocess.check_output(["ray", "start", "--head"])
      wait_for_condition(check_ray_started, timeout=5)
  
      storage_handle = start_telemetry_app()
  
      wait_for_condition(
          lambda: ray.get(storage_handle.get_reports_received.remote())
          > 0,
          timeout=5,
      )
  
      # Check that telemetry related to FastAPI app is not set
      def check_report_before_fastapi():
          report = ray.get(storage_handle.get_report.remote())
          assert (
              ServeUsageTag.FASTAPI_USED.get_value_from_report(report)
              is None
          )
          assert (
              ServeUsageTag.API_VERSION.get_value_from_report(report)
              == "v2"
          )
          assert (
              int(ServeUsageTag.NUM_APPS.get_value_from_report(report))
              == 1
          )
          assert (
              int(
                  ServeUsageTag.NUM_DEPLOYMENTS.get_value_from_report(
                      report
                  )
              )
              == 1
          )
          assert (
              int(
                  ServeUsageTag.NUM_GPU_DEPLOYMENTS.get_value_from_report(
                      report
                  )
              )
              == 0
          )
          return True
  
      wait_for_condition(check_report_before_fastapi)
  
      app = FastAPI()
  
      @serve.deployment
      @serve.ingress(app)
      class FastAPIDeployment:
          @app.get("/route1")
          async def route1(self):
              return "Welcome to route 1!"
  
          @app.get("/route2")
          async def app2(self):
              return "Welcome to route 2!"
  
      fastapi_app = FastAPIDeployment.bind()
      serve.run(
          fastapi_app, name="fastapi_app", route_prefix="/fastapi"
      )
  
      wait_for_condition(
          lambda: serve.status().applications["fastapi_app"].status
          == ApplicationStatus.RUNNING,
          timeout=15,
      )
  
      current_num_reports = ray.get(
          storage_handle.get_reports_received.remote()
      )
  
      wait_for_condition(
          lambda: ray.get(storage_handle.get_reports_received.remote())
          > current_num_reports,
          timeout=5,
      )
      report = ray.get(storage_handle.get_report.remote())
  
      # Check all telemetry relevant to the Serve apps on this cluster.
      assert (
          int(ServeUsageTag.FASTAPI_USED.get_value_from_report(report))
          == 1
      )
      assert (
          ServeUsageTag.API_VERSION.get_value_from_report(report)
          == "v2"
      )
      assert (
          int(ServeUsageTag.NUM_APPS.get_value_from_report(report)) == 2
      )
      assert (
          int(
              ServeUsageTag.NUM_DEPLOYMENTS.get_value_from_report(
                  report
              )
          )
          == 2
      )
      assert (
          int(
              ServeUsageTag.NUM_GPU_DEPLOYMENTS.get_value_from_report(
                  report
              )
          )
          == 0
      )
  
      # Check that Serve telemetry not relevant to the running apps is omitted.
      assert (
          ServeUsageTag.DAG_DRIVER_USED.get_value_from_report(report)
          is None
      )
      assert (
          ServeUsageTag.HTTP_ADAPTER_USED.get_value_from_report(report)
          is None
      )
      assert (
          ServeUsageTag.GRPC_INGRESS_USED.get_value_from_report(report)
          is None
      )
      assert (
          ServeUsageTag.REST_API_VERSION.get_value_from_report(report)
          is None
      )
  
imports: import subprocess
  import sys
  import time
  import pytest
  import requests
  import yaml
  from fastapi import FastAPI
  import ray
  from ray import serve
  from ray._private.test_utils import wait_for_condition
  from ray._private.usage.usage_lib import get_extra_usage_tags_to_report
  from ray.serve._private.common import ApplicationStatus
  from ray.serve._private.constants import SERVE_MULTIPLEXED_MODEL_ID
  from ray.serve._private.test_utils import TELEMETRY_ROUTE_PREFIX, TelemetryStorage, check_ray_started, receiver_app, start_telemetry_app
  from ray.serve._private.usage import ServeUsageTag
  from ray.serve.context import _get_global_client
  from ray.serve.schema import ServeDeploySchema
label_desc: Use image node_id 1 for calling a global function with example usage: test_fastapi_detected(manage_ray_with_telemetry) and returns: True, str, str