Repository: plotly/dash
File: dash/dash.py (Python)

Code before:
            _hash = _reload.hash
            _reload.hard = False
            _reload.changed_assets = []

        return flask.jsonify(
            {
                "reloadHash": _hash,
                "hard": hard,
                "packages": list(self.registered_paths.keys()),
                "files": list(changed),
            }
        )

    def serve_health(self):
        """
        Health check endpoint for monitoring Dash server status.
        
        Returns a JSON response indicating the server is running and healthy.
        This endpoint can be used by load balancers, monitoring systems, 
        and other platforms to check if the Dash server is operational.
        
        :return: JSON response with status information
        """
        import datetime
        import platform
        import psutil
        import sys
        
        # Basic health information
        health_data = {
            "status": "healthy",
            "timestamp": datetime.datetime.utcnow().isoformat() + "Z",
            "dash_version": __version__,
            "python_version": sys.version,
            "platform": platform.platform(),
        }
        
        # Add server information if available
        try:
            health_data.update({
                "server_name": self.server.name,
                "debug_mode": self.server.debug,
                "host": getattr(self.server, 'host', 'unknown'),
                "port": getattr(self.server, 'port', 'unknown'),
            })
        except Exception:
            pass
        
        # Add system resource information if psutil is available
        try:
            health_data.update({

Review comment (suggestion):
Add this to the `try` block below to avoid an import error. Our default install doesn't support this package.

Code after:
                if callable(props):
                    props = props()
                custom_dev_tools.append({**hook_dev_tools, "props": props})
            config["dev_tools"] = custom_dev_tools

        return config

    def serve_reload_hash(self):
        _reload = self._hot_reload
        with _reload.lock:
            hard = _reload.hard
            changed = _reload.changed_assets
            _hash = _reload.hash
            _reload.hard = False
            _reload.changed_assets = []

        return flask.jsonify(
            {
                "reloadHash": _hash,
                "hard": hard,
                "packages": list(self.registered_paths.keys()),
                "files": list(changed),
            }
        )

    def serve_health(self):
        """
        Health check endpoint for monitoring Dash server status.
        Returns a simple "OK" response with HTTP 200 status.
        """
        return flask.Response("OK", status=200, mimetype="text/plain")

    def get_dist(self, libraries: Sequence[str]) -> list:
        dists = []
        for dist_type in ("_js_dist", "_css_dist"):
            resources = ComponentRegistry.get_resources(dist_type, libraries)
            srcs = self._collect_and_register_resources(resources, False)
            for src in srcs:
                dists.append(dict(type=dist_type, url=src))
        return dists

    def _collect_and_register_resources(self, resources, include_async=True):
        # now needs the app context.
        # template in the necessary component suite JS bundles
        # add the version number of the package as a query parameter
        # for cache busting
        def _relative_url_path(relative_package_path="", namespace=""):
            if any(
                relative_package_path.startswith(x + "/")
                for x in ["dcc", "html", "dash_table"]
            ):