[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-pl-monitorowanie-wydajnosci-proxy-opoznienie-wskaznik-sukcesu-i-alerty":3},{"success":4,"payload":5,"related":78,"errors":149},true,{"id":6,"slug":7,"title":8,"excerpt":9,"body_html":10,"meta_title":11,"meta_description":12,"canonical_url":13,"canonical_override":14,"og_title":8,"og_description":12,"og_image_url":15,"faq_json":16,"key_takeaways":32,"allow_index":37,"noindex_google_only":37,"allow_follow":4,"published_at":38,"updated_at":39,"content_updated_at":40,"featured_image_url":41,"featured_image_alt":14,"card_image_url":42,"reading_time_minutes":43,"author":44,"categories":48,"tags":55,"alternates":64,"locale_paths":76,"views":77},41,"monitorowanie-wydajnosci-proxy-opoznienie-wskaznik-sukcesu-i-alerty","Monitorowanie wydajności proxy: opóźnienie, wskaźnik sukcesu i alerty","Dowiedz się, jak przyrządzić, monitorować i ostrzegać o wydajności proxy - percentyle opóźniania śledzenia, wskaźniki sukcesu, wzory błędów i przepustowość. Przykłady kodu w Pythonie, Node.js i Go.","\u003Ch2>Dlaczego monitoruj wydajność proxy\u003C\u002Fh2>\u003Cp>Infrastruktura Proxy zawodzi po cichu. Twój drapacz może działać godzinami z 40% powodzeniem, zanim ktoś zauważy. Czas reakcji się pogarsza, zwiększa się liczba bloków i pogarsza jakość danych - wszystko to nie powoduje oczywistych błędów. Monitoring zamienia te niewidoczne problemy w alarmy dające się zaskarżyć.\u003C\u002Fp>\u003Cp>Ten przewodnik pokazuje, jak przystosować swoje żądania proxy, zbierać znaczące wskaźniki, budować deski rozdzielcze i ustawić ostrzeganie, że połowów degradacji zanim wpłynie na gazociąg danych. Wszystkie przykłady \u003Ca href=\"\u002Fpl\u002Fblog\u002Fnajlepsze-wyniki-dla-scraping-web-w-2026-kompletne-porownanie\">ProxyHat 's residential proxy\u003C\u002Fa> i są gotowe do produkcji.\u003C\u002Fp>\u003Cblockquote>Jeśli nie mierzysz swojej wydajności proxy, zgadujesz. Zgadywanie na skalę kosztuje pieniądze i produkuje niewiarygodne dane.\u003C\u002Fblockquote>\u003Ch2>Key Metrics to Track\u003C\u002Fh2>\u003Ctable>\n\u003Ccaption>Key Metrics to Track\u003C\u002Fcaption>\u003Cthead>\u003Ctr>\u003Cth>Metric\u003C\u002Fth>\u003Cth>Co ci mówi?\u003C\u002Fth>\u003Cth>Próg ostrzegania\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Wskaźnik sukcesu\u003C\u002Ftd>\u003Ctd>Procent wniosków zwracających status 2xx\u003C\u002Ftd>\u003Ctd>Poniżej 90%\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Opóźnienie odpowiedzi (p50 \u002F p95 \u002F p99)\u003C\u002Ftd>\u003Ctd>Jak szybko proxied żądania ukończone\u003C\u002Ftd>\u003Ctd>p95 powyżej 10 s\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Wskaźnik błędu według typu\u003C\u002Ftd>\u003Ctd>Które błędy dominują (timeout, 403, 429, connection)\u003C\u002Ftd>\u003Ctd>Każdy typ powyżej 15%\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Wnioski na sekundę\u003C\u002Ftd>\u003Ctd>Through of your scrating pipes\u003C\u002Ftd>\u003Ctd>Poniżej przewidywanej wartości wyjściowej\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Zastosowanie szerokości pasma\u003C\u002Ftd>\u003Ctd>Dane przekazywane za pośrednictwem pośrednika\u003C\u002Ftd>\u003Ctd>Limit planu zbliżania się\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Stopa bloku według docelowej\u003C\u002Ftd>\u003Ctd>Które cele blokują cię najbardziej\u003C\u002Ftd>\u003Ctd>Powyżej 20% dla każdego celu\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Stopa zwrotu\u003C\u002Ftd>\u003Ctd>Ile żądań potrzebuje powtórzeń\u003C\u002Ftd>\u003Ctd>Ponad 30%\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Efektywność ponownego wykorzystania sesji\u003C\u002Ftd>\u003Ctd>Jak długo lepkie sesje przetrwać\u003C\u002Ftd>\u003Ctd>Poniżej 5 wniosków średnio\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch2>Python: Instrumented Proxy Client\u003C\u002Fh2>\u003Cp>Klient zawija każdą prośbę w czas, śledzenie stanu i ustrukturyzowane logowanie.\u003C\u002Fp>\u003Cpre>\u003Ccode>import time\nimport uuid\nimport logging\nimport statistics\nfrom dataclasses import dataclass, field\nfrom collections import defaultdict\nfrom typing import Optional\nimport requests\nlogger = logging.getLogger(\"proxy_monitor\")\n@dataclass\nclass ProxyMetrics:\n    \"\"\"Collects and aggregates proxy performance metrics.\"\"\"\n    total_requests: int = 0\n    successful: int = 0\n    failed: int = 0\n    retries: int = 0\n    latencies: list = field(default_factory=list)\n    status_codes: dict = field(default_factory=lambda: defaultdict(int))\n    errors_by_type: dict = field(default_factory=lambda: defaultdict(int))\n    bytes_transferred: int = 0\n    requests_by_target: dict = field(default_factory=lambda: defaultdict(lambda: {\"success\": 0, \"failed\": 0}))\n    @property\n    def success_rate(self) -> float:\n        return (self.successful \u002F self.total_requests * 100) if self.total_requests > 0 else 0.0\n    @property\n    def p50_latency(self) -> float:\n        return statistics.median(self.latencies) if self.latencies else 0.0\n    @property\n    def p95_latency(self) -> float:\n        if not self.latencies:\n            return 0.0\n        sorted_lat = sorted(self.latencies)\n        idx = int(len(sorted_lat) * 0.95)\n        return sorted_lat[min(idx, len(sorted_lat) - 1)]\n    @property\n    def p99_latency(self) -> float:\n        if not self.latencies:\n            return 0.0\n        sorted_lat = sorted(self.latencies)\n        idx = int(len(sorted_lat) * 0.99)\n        return sorted_lat[min(idx, len(sorted_lat) - 1)]\n    def summary(self) -> dict:\n        return {\n            \"total_requests\": self.total_requests,\n            \"success_rate\": f\"{self.success_rate:.1f}%\",\n            \"p50_latency\": f\"{self.p50_latency:.3f}s\",\n            \"p95_latency\": f\"{self.p95_latency:.3f}s\",\n            \"p99_latency\": f\"{self.p99_latency:.3f}s\",\n            \"retries\": self.retries,\n            \"bytes_transferred\": self.bytes_transferred,\n            \"top_errors\": dict(sorted(\n                self.errors_by_type.items(),\n                key=lambda x: x[1], reverse=True\n            )[:5]),\n            \"status_distribution\": dict(self.status_codes),\n        }\nclass MonitoredProxyClient:\n    \"\"\"HTTP client with built-in proxy monitoring.\"\"\"\n    def __init__(self, max_retries: int = 3):\n        self.metrics = ProxyMetrics()\n        self.max_retries = max_retries\n        self._alert_callbacks = []\n    def on_alert(self, callback):\n        \"\"\"Register a callback for metric alerts.\"\"\"\n        self._alert_callbacks.append(callback)\n    def _check_alerts(self):\n        if self.metrics.total_requests \u003C 10:\n            return\n        alerts = []\n        if self.metrics.success_rate \u003C 90:\n            alerts.append(f\"Low success rate: {self.metrics.success_rate:.1f}%\")\n        if self.metrics.p95_latency > 10:\n            alerts.append(f\"High p95 latency: {self.metrics.p95_latency:.1f}s\")\n        if self.metrics.retries \u002F max(self.metrics.total_requests, 1) > 0.3:\n            alerts.append(f\"High retry rate: {self.metrics.retries}\u002F{self.metrics.total_requests}\")\n        for alert in alerts:\n            logger.warning(f\"ALERT: {alert}\")\n            for cb in self._alert_callbacks:\n                cb(alert)\n    def fetch(self, url: str, country: Optional[str] = None) -> Optional[requests.Response]:\n        from urllib.parse import urlparse\n        target_domain = urlparse(url).netloc\n        for attempt in range(self.max_retries + 1):\n            session_id = uuid.uuid4().hex[:8]\n            username = f\"USERNAME-sid-{session_id}\"\n            if country:\n                username += f\"-country-{country}\"\n            proxy = f\"http:\u002F\u002F{username}:PASSWORD@gate.proxyhat.com:8080\"\n            self.metrics.total_requests += 1\n            if attempt > 0:\n                self.metrics.retries += 1\n            start = time.time()\n            try:\n                response = requests.get(\n                    url,\n                    proxies={\"http\": proxy, \"https\": proxy},\n                    timeout=30,\n                )\n                latency = time.time() - start\n                self.metrics.latencies.append(latency)\n                self.metrics.status_codes[response.status_code] += 1\n                if response.status_code >= 400:\n                    self.metrics.errors_by_type[f\"HTTP_{response.status_code}\"] += 1\n                    self.metrics.requests_by_target[target_domain][\"failed\"] += 1\n                    if response.status_code in (403, 429, 503) and attempt \u003C self.max_retries:\n                        time.sleep(2 ** attempt)\n                        continue\n                    self.metrics.failed += 1\n                else:\n                    self.metrics.successful += 1\n                    self.metrics.bytes_transferred += len(response.content)\n                    self.metrics.requests_by_target[target_domain][\"success\"] += 1\n                self._check_alerts()\n                return response\n            except requests.exceptions.Timeout:\n                self.metrics.errors_by_type[\"timeout\"] += 1\n                self.metrics.latencies.append(time.time() - start)\n                self.metrics.requests_by_target[target_domain][\"failed\"] += 1\n            except requests.exceptions.ConnectionError:\n                self.metrics.errors_by_type[\"connection_error\"] += 1\n                self.metrics.latencies.append(time.time() - start)\n                self.metrics.requests_by_target[target_domain][\"failed\"] += 1\n            except Exception as e:\n                self.metrics.errors_by_type[type(e).__name__] += 1\n                self.metrics.latencies.append(time.time() - start)\n            if attempt \u003C self.max_retries:\n                time.sleep(2 ** attempt)\n        self.metrics.failed += 1\n        self._check_alerts()\n        return None\n# Usage\nclient = MonitoredProxyClient(max_retries=3)\nclient.on_alert(lambda msg: print(f\"[ALERT] {msg}\"))\nurls = [f\"https:\u002F\u002Fexample.com\u002Fproduct\u002F{i}\" for i in range(100)]\nfor url in urls:\n    response = client.fetch(url)\nprint(client.metrics.summary())\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Node.js: Zinstrumentowany klient proxy\u003C\u002Fh2>\u003Cpre>\u003Ccode>const crypto = require('crypto');\nconst { HttpsProxyAgent } = require('https-proxy-agent');\nconst { EventEmitter } = require('events');\nclass ProxyMetrics {\n  constructor() {\n    this.totalRequests = 0;\n    this.successful = 0;\n    this.failed = 0;\n    this.retries = 0;\n    this.latencies = [];\n    this.statusCodes = {};\n    this.errorsByType = {};\n    this.bytesTransferred = 0;\n    this.requestsByTarget = {};\n  }\n  get successRate() {\n    return this.totalRequests > 0\n      ? ((this.successful \u002F this.totalRequests) * 100).toFixed(1)\n      : '0.0';\n  }\n  percentile(p) {\n    if (this.latencies.length === 0) return 0;\n    const sorted = [...this.latencies].sort((a, b) => a - b);\n    const idx = Math.min(\n      Math.floor(sorted.length * (p \u002F 100)),\n      sorted.length - 1\n    );\n    return sorted[idx];\n  }\n  summary() {\n    return {\n      totalRequests: this.totalRequests,\n      successRate: `${this.successRate}%`,\n      p50Latency: `${this.percentile(50).toFixed(3)}s`,\n      p95Latency: `${this.percentile(95).toFixed(3)}s`,\n      p99Latency: `${this.percentile(99).toFixed(3)}s`,\n      retries: this.retries,\n      bytesTransferred: this.bytesTransferred,\n      statusDistribution: { ...this.statusCodes },\n      topErrors: Object.entries(this.errorsByType)\n        .sort(([, a], [, b]) => b - a)\n        .slice(0, 5)\n        .reduce((obj, [k, v]) => ({ ...obj, [k]: v }), {}),\n    };\n  }\n}\nclass MonitoredProxyClient extends EventEmitter {\n  constructor({ maxRetries = 3 } = {}) {\n    super();\n    this.metrics = new ProxyMetrics();\n    this.maxRetries = maxRetries;\n  }\n  _checkAlerts() {\n    if (this.metrics.totalRequests \u003C 10) return;\n    if (parseFloat(this.metrics.successRate) \u003C 90) {\n      this.emit('alert', `Low success rate: ${this.metrics.successRate}%`);\n    }\n    if (this.metrics.percentile(95) > 10) {\n      this.emit('alert', `High p95 latency: ${this.metrics.percentile(95).toFixed(1)}s`);\n    }\n  }\n  async fetch(url, { country } = {}) {\n    const targetDomain = new URL(url).hostname;\n    for (let attempt = 0; attempt \u003C= this.maxRetries; attempt++) {\n      const sessionId = crypto.randomBytes(4).toString('hex');\n      let username = `USERNAME-sid-${sessionId}`;\n      if (country) username += `-country-${country}`;\n      const agent = new HttpsProxyAgent(\n        `http:\u002F\u002F${username}:PASSWORD@gate.proxyhat.com:8080`\n      );\n      this.metrics.totalRequests++;\n      if (attempt > 0) this.metrics.retries++;\n      const startTime = Date.now();\n      try {\n        const response = await fetch(url, {\n          agent,\n          signal: AbortSignal.timeout(30000),\n        });\n        const latency = (Date.now() - startTime) \u002F 1000;\n        this.metrics.latencies.push(latency);\n        this.metrics.statusCodes[response.status] =\n          (this.metrics.statusCodes[response.status] || 0) + 1;\n        if (response.status >= 400) {\n          this.metrics.errorsByType[`HTTP_${response.status}`] =\n            (this.metrics.errorsByType[`HTTP_${response.status}`] || 0) + 1;\n          if ([403, 429, 503].includes(response.status) && attempt \u003C this.maxRetries) {\n            await new Promise(r => setTimeout(r, 1000 * Math.pow(2, attempt)));\n            continue;\n          }\n          this.metrics.failed++;\n        } else {\n          this.metrics.successful++;\n          const body = await response.text();\n          this.metrics.bytesTransferred += body.length;\n        }\n        this._checkAlerts();\n        return response;\n      } catch (err) {\n        const latency = (Date.now() - startTime) \u002F 1000;\n        this.metrics.latencies.push(latency);\n        this.metrics.errorsByType[err.name] =\n          (this.metrics.errorsByType[err.name] || 0) + 1;\n        if (attempt \u003C this.maxRetries) {\n          await new Promise(r => setTimeout(r, 1000 * Math.pow(2, attempt)));\n          continue;\n        }\n        this.metrics.failed++;\n      }\n    }\n    this._checkAlerts();\n    return null;\n  }\n}\n\u002F\u002F Usage\nconst client = new MonitoredProxyClient({ maxRetries: 3 });\nclient.on('alert', msg => console.warn(`[ALERT] ${msg}`));\nconst urls = Array.from({ length: 100 }, (_, i) =>\n  `https:\u002F\u002Fexample.com\u002Fproduct\u002F${i + 1}`\n);\nfor (const url of urls) {\n  await client.fetch(url);\n}\nconsole.log(client.metrics.summary());\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Idź: Instrumentowany Klient Proxy\u003C\u002Fh2>\u003Cpre>\u003Ccode>package main\nimport (\n\t\"crypto\u002Frand\"\n\t\"encoding\u002Fhex\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"net\u002Fhttp\"\n\t\"net\u002Furl\"\n\t\"sort\"\n\t\"sync\"\n\t\"time\"\n)\ntype Metrics struct {\n\tmu             sync.Mutex\n\tTotalRequests  int\n\tSuccessful     int\n\tFailed         int\n\tRetries        int\n\tLatencies      []float64\n\tStatusCodes    map[int]int\n\tErrorsByType   map[string]int\n\tBytesTransferred int64\n}\nfunc NewMetrics() *Metrics {\n\treturn &Metrics{\n\t\tStatusCodes:  make(map[int]int),\n\t\tErrorsByType: make(map[string]int),\n\t}\n}\nfunc (m *Metrics) RecordSuccess(latency float64, status int, bytes int) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tm.TotalRequests++\n\tm.Successful++\n\tm.Latencies = append(m.Latencies, latency)\n\tm.StatusCodes[status]++\n\tm.BytesTransferred += int64(bytes)\n}\nfunc (m *Metrics) RecordFailure(latency float64, errType string) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tm.TotalRequests++\n\tm.Failed++\n\tm.Latencies = append(m.Latencies, latency)\n\tm.ErrorsByType[errType]++\n}\nfunc (m *Metrics) Percentile(p float64) float64 {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif len(m.Latencies) == 0 {\n\t\treturn 0\n\t}\n\tsorted := make([]float64, len(m.Latencies))\n\tcopy(sorted, m.Latencies)\n\tsort.Float64s(sorted)\n\tidx := int(math.Min(float64(len(sorted)-1), float64(len(sorted))*p\u002F100))\n\treturn sorted[idx]\n}\nfunc (m *Metrics) SuccessRate() float64 {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif m.TotalRequests == 0 {\n\t\treturn 0\n\t}\n\treturn float64(m.Successful) \u002F float64(m.TotalRequests) * 100\n}\nfunc (m *Metrics) Summary() string {\n\treturn fmt.Sprintf(\n\t\t\"Requests: %d | Success: %.1f%% | p50: %.3fs | p95: %.3fs | p99: %.3fs | Retries: %d\",\n\t\tm.TotalRequests, m.SuccessRate(),\n\t\tm.Percentile(50), m.Percentile(95), m.Percentile(99),\n\t\tm.Retries,\n\t)\n}\ntype MonitoredClient struct {\n\tmetrics    *Metrics\n\tmaxRetries int\n}\nfunc NewMonitoredClient(maxRetries int) *MonitoredClient {\n\treturn &MonitoredClient{\n\t\tmetrics:    NewMetrics(),\n\t\tmaxRetries: maxRetries,\n\t}\n}\nfunc (c *MonitoredClient) Fetch(target string) (*http.Response, error) {\n\tfor attempt := 0; attempt \u003C= c.maxRetries; attempt++ {\n\t\tb := make([]byte, 4)\n\t\trand.Read(b)\n\t\tsessionID := hex.EncodeToString(b)\n\t\tproxyStr := fmt.Sprintf(\n\t\t\t\"http:\u002F\u002FUSERNAME-sid-%s:PASSWORD@gate.proxyhat.com:8080\",\n\t\t\tsessionID,\n\t\t)\n\t\tproxyURL, _ := url.Parse(proxyStr)\n\t\tclient := &http.Client{\n\t\t\tTransport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},\n\t\t\tTimeout:   30 * time.Second,\n\t\t}\n\t\tif attempt > 0 {\n\t\t\tc.metrics.mu.Lock()\n\t\t\tc.metrics.Retries++\n\t\t\tc.metrics.mu.Unlock()\n\t\t}\n\t\tstart := time.Now()\n\t\tresp, err := client.Get(target)\n\t\tlatency := time.Since(start).Seconds()\n\t\tif err != nil {\n\t\t\tc.metrics.RecordFailure(latency, \"connection_error\")\n\t\t\tif attempt \u003C c.maxRetries {\n\t\t\t\ttime.Sleep(time.Duration(math.Pow(2, float64(attempt))) * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tbody, _ := io.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tif resp.StatusCode >= 400 {\n\t\t\tc.metrics.RecordFailure(latency, fmt.Sprintf(\"HTTP_%d\", resp.StatusCode))\n\t\t\tif attempt \u003C c.maxRetries {\n\t\t\t\ttime.Sleep(time.Duration(math.Pow(2, float64(attempt))) * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tc.metrics.RecordSuccess(latency, resp.StatusCode, len(body))\n\t\t}\n\t\treturn resp, nil\n\t}\n\treturn nil, fmt.Errorf(\"all retries exhausted for %s\", target)\n}\nfunc main() {\n\tclient := NewMonitoredClient(3)\n\tfor i := 0; i \u003C 50; i++ {\n\t\turl := fmt.Sprintf(\"https:\u002F\u002Fexample.com\u002Fproduct\u002F%d\", i+1)\n\t\tclient.Fetch(url)\n\t}\n\tfmt.Println(client.metrics.Summary())\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Strukturyzowane logowanie dla zamówień proxy\u003C\u002Fh2>\u003Cp>Zorganizowane dzienniki JSONułatwiają agregację i analizę wydajności proxy w rozproszonych scrappers.\u003C\u002Fp>\u003Cpre>\u003Ccode>import json\nimport logging\nimport time\nimport uuid\nimport requests\nclass JSONProxyLogger:\n    \"\"\"Logs every proxy request as structured JSON.\"\"\"\n    def __init__(self, log_file: str = \"proxy_requests.jsonl\"):\n        self.logger = logging.getLogger(\"proxy_json\")\n        handler = logging.FileHandler(log_file)\n        handler.setFormatter(logging.Formatter(\"%(message)s\"))\n        self.logger.addHandler(handler)\n        self.logger.setLevel(logging.INFO)\n    def log_request(self, entry: dict):\n        self.logger.info(json.dumps(entry))\n    def fetch(self, url: str, country: str = None) -> requests.Response:\n        session_id = uuid.uuid4().hex[:8]\n        username = f\"USERNAME-sid-{session_id}\"\n        if country:\n            username += f\"-country-{country}\"\n        proxy = f\"http:\u002F\u002F{username}:PASSWORD@gate.proxyhat.com:8080\"\n        start = time.time()\n        try:\n            response = requests.get(\n                url,\n                proxies={\"http\": proxy, \"https\": proxy},\n                timeout=30,\n            )\n            latency = time.time() - start\n            self.log_request({\n                \"timestamp\": time.strftime(\"%Y-%m-%dT%H:%M:%SZ\", time.gmtime()),\n                \"url\": url,\n                \"status\": response.status_code,\n                \"latency_ms\": round(latency * 1000),\n                \"bytes\": len(response.content),\n                \"session_id\": session_id,\n                \"country\": country,\n                \"success\": response.status_code \u003C 400,\n            })\n            return response\n        except Exception as e:\n            latency = time.time() - start\n            self.log_request({\n                \"timestamp\": time.strftime(\"%Y-%m-%dT%H:%M:%SZ\", time.gmtime()),\n                \"url\": url,\n                \"error\": str(e),\n                \"error_type\": type(e).__name__,\n                \"latency_ms\": round(latency * 1000),\n                \"session_id\": session_id,\n                \"country\": country,\n                \"success\": False,\n            })\n            raise\n# Usage — logs produce JSONL like:\n# {\"timestamp\":\"2026-02-26T10:30:00Z\",\"url\":\"https:\u002F\u002F...\",\"status\":200,\"latency_ms\":1234,...}\nproxy_logger = JSONProxyLogger(\"proxy_requests.jsonl\")\nresponse = proxy_logger.fetch(\"https:\u002F\u002Fexample.com\u002Fdata\", country=\"us\")\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Okresowe sprawozdania zdrowotne\u003C\u002Fh2>\u003Cp>W przypadku długotrwających skrobarek generować okresowe raporty zdrowotne, które podsumowują wydajność nad stałymi oknami.\u003C\u002Fp>\u003Cpre>\u003Ccode>import time\nimport threading\nfrom datetime import datetime\nclass PeriodicReporter:\n    \"\"\"Generates periodic performance reports from proxy metrics.\"\"\"\n    def __init__(self, metrics: ProxyMetrics, interval_seconds: int = 60):\n        self.metrics = metrics\n        self.interval = interval_seconds\n        self._running = False\n        self._thread = None\n        self._last_snapshot = None\n    def start(self):\n        self._running = True\n        self._last_snapshot = self._snapshot()\n        self._thread = threading.Thread(target=self._report_loop, daemon=True)\n        self._thread.start()\n    def stop(self):\n        self._running = False\n    def _snapshot(self) -> dict:\n        return {\n            \"total\": self.metrics.total_requests,\n            \"success\": self.metrics.successful,\n            \"failed\": self.metrics.failed,\n            \"retries\": self.metrics.retries,\n            \"time\": time.time(),\n        }\n    def _report_loop(self):\n        while self._running:\n            time.sleep(self.interval)\n            current = self._snapshot()\n            prev = self._last_snapshot\n            elapsed = current[\"time\"] - prev[\"time\"]\n            requests_delta = current[\"total\"] - prev[\"total\"]\n            success_delta = current[\"success\"] - prev[\"success\"]\n            failed_delta = current[\"failed\"] - prev[\"failed\"]\n            rps = requests_delta \u002F elapsed if elapsed > 0 else 0\n            window_success_rate = (\n                (success_delta \u002F requests_delta * 100)\n                if requests_delta > 0 else 0\n            )\n            report = {\n                \"window\": f\"{self.interval}s\",\n                \"timestamp\": datetime.utcnow().isoformat(),\n                \"requests\": requests_delta,\n                \"rps\": round(rps, 1),\n                \"success_rate\": f\"{window_success_rate:.1f}%\",\n                \"failed\": failed_delta,\n                \"cumulative_success_rate\": f\"{self.metrics.success_rate:.1f}%\",\n                \"p95_latency\": f\"{self.metrics.p95_latency:.3f}s\",\n            }\n            print(f\"[REPORT] {report}\")\n            self._last_snapshot = current\n# Usage with MonitoredProxyClient\nclient = MonitoredProxyClient(max_retries=3)\nreporter = PeriodicReporter(client.metrics, interval_seconds=30)\nreporter.start()\n# Scrape away — reports print every 30 seconds\nfor url in urls:\n    client.fetch(url)\nreporter.stop()\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Zasady i progi ostrzegania\u003C\u002Fh2>\u003Cp>Ustawcie inteligentny system ostrzegania, który zapobiega fałszywym pozytywnym skutkom w okresach rozgrzewania i przemijających zamianach.\u003C\u002Fp>\u003Ctable>\n\u003Ccaption>Zasady i progi ostrzegania\u003C\u002Fcaption>\u003Cthead>\u003Ctr>\u003Cth>Alarm\u003C\u002Fth>\u003Cth>Stan\u003C\u002Fth>\u003Cth>Schładzanie\u003C\u002Fth>\u003Cth>Działanie\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Niski wskaźnik sukcesu\u003C\u002Ftd>\u003Ctd>Poniżej 90% przez 5 minut\u003C\u002Ftd>\u003Ctd>10 min\u003C\u002Ftd>\u003Ctd>Zbadaj bloki docelowe, sprawdź pulę proxy\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Wysoka trwałość\u003C\u002Ftd>\u003Ctd>p95 powyżej 10 s nad oknem 2-minutowym\u003C\u002Ftd>\u003Ctd>5 min\u003C\u002Ftd>\u003Ctd>Ogranicz współzależność, sprawdź docelowy poziom zdrowia\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Błąd Spike\u003C\u002Ftd>\u003Ctd>Pojedynczy typ błędu przekracza 20% wniosków\u003C\u002Ftd>\u003Ctd>5 min\u003C\u002Ftd>\u003Ctd>Sprawdź, czy cel się zmienił, obróć położenie geo\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Szerokość pasma Spike\u003C\u002Ftd>\u003Ctd>Szybkość transferu w stosunku do wartości wyjściowej\u003C\u002Ftd>\u003Ctd>15 min\u003C\u002Ftd>\u003Ctd>Sprawdź spodziewane zachowanie, sprawdź czy nie ma pętli przekierowania\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Zero progów\u003C\u002Ftd>\u003Ctd>Brak udanych wniosków w ciągu 2 minut\u003C\u002Ftd>\u003Ctd>2 min\u003C\u002Ftd>\u003Ctd>Sprawdź łączność proxy, weryfikuj referencje\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cblockquote>Dobrym monitoringiem jest różnica między rurociągiem do rozdrabniania, który działa niezawodnie przez miesiące, a rurociągiem, który po cichu produkuje dane o odpadach. Zainwestuj w oprzyrządowanie z góry - to samo płaci się za pierwszy incydent produkcji można złapać wcześniej.\u003C\u002Fblockquote>\u003Cp>Aby zbudować zastawy, które zasilają te mierniki, zobacz \u003Ca href=\"\u002Fpl\u002Fblog\u002Fbudowa-warstwa-proxy-middleware-do-skracania\">Building a Proxy Middleware Layer\u003C\u002Fa>Do optymalizacji przepustowości wraz z monitorowaniem, czytaj \u003Ca href=\"\u002Fpl\u002Fblog\u002Fskalowanie-zadan-proxy-za-pomoca-kontroli-konkursowej\">Skalowanie żądań proxy za pomocą kontroli konkursowej\u003C\u002Fa>. Pełny projekt systemu, zobacz \u003Ca href=\"\u002Fpl\u002Fblog\u002Fprojektowanie-niezawodnej-architektury-skraplania\">Projektowanie niezawodnej architektury skraplania\u003C\u002Fa>.\u003C\u002Fp>\u003Cp>Zbadaj \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\">Python SDK\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fnode-sdk\">Węzeł SDK\u003C\u002Fa>oraz \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fgo-sdk\">Go SDK\u003C\u002Fa> dla integracji proxy, lub sprawdzić \u003Ca href=\"\u002Fpl\u002Fpricing\">Ceny proksyHat\u003C\u002Fa> oraz \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\">dokumentacja\u003C\u002Fa> Na początek.\u003C\u002Fp>","Monitorowanie wydajności proxy","Monitoruj wydajność proxy z śledzenia opóźnienia, wskaźniki skuteczności, ustrukturyzowane logowanie i inteligentne ostrzeganie. Kod produkcji w Pythonie, Node.js i Go.","\u002Fpl\u002Fblog\u002Fmonitorowanie-wydajnosci-proxy-opoznienie-wskaznik-sukcesu-i-alerty",null,"https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fmonitoring-proxy-performance-og.webp",[17,20,23,26,29],{"question":18,"answer":19},"What is the most important proxy metric to track?","Success rate is the single most important metric. It directly measures whether your proxy infrastructure is delivering usable data. A drop in success rate is the earliest indicator of blocks, proxy pool exhaustion, or target site changes.",{"question":21,"answer":22},"How often should I check proxy performance metrics?","For active scraping jobs, generate reports every 30-60 seconds. For ongoing monitoring, aggregate metrics in 5-minute windows. Alert on sustained degradation (multiple consecutive windows below threshold) rather than transient spikes.",{"question":24,"answer":25},"What p95 latency should I expect with residential proxies?","With ProxyHat residential proxies, typical p95 latency is 2-5 seconds depending on the target site and geographic distance. Values above 10 seconds consistently indicate network issues, overloaded targets, or insufficient concurrency limits.",{"question":27,"answer":28},"Should I track metrics per target domain?","Yes. Different targets have different block rates and response patterns. Per-domain metrics help you identify which targets need special handling — lower concurrency, different rotation strategies, or geo-targeted proxies from specific regions.",{"question":30,"answer":31},"How do I integrate proxy metrics with existing monitoring tools?","Export metrics in Prometheus format for Grafana dashboards, send structured JSON logs to Elasticsearch\u002FKibana, or use StatsD\u002FDataDog for real-time aggregation. The instrumented clients in this guide produce metrics compatible with any of these approaches.",[33,34,35,36],"Infrastruktura proxy zawodzi po cichu, dlatego monitorowanie kluczowych wskaźników zapobiega stratom i niewiarygodnym danym.","Najważniejsze metryki to wskaźnik sukcesu, opóźnienia (p50\u002Fp95\u002Fp99), rodzaje błędów oraz wskaźnik blokad dla poszczególnych celów.","Artykuł zawiera gotowe do produkcji przykłady kodu w Python, Node.js i Go do instrumentacji klienta proxy i zbierania danych.","Ustawienie alertów, np. dla wskaźnika sukcesu poniżej 90% lub wysokiego opóźnienia, pozwala szybko reagować na degradację.",false,"2026-02-15T00:39:23+00:00","2026-07-19T03:13:07+00:00","2026-10-03T08:21:37+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fmonitoring-proxy-performance-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fmonitoring-proxy-performance-card.webp",11,{"name":45,"slug":46,"bio":47,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[49],{"id":50,"slug":51,"name":52,"description":14,"meta_title":53,"meta_description":54,"parent_id":14},4,"developer-guides","Przewodniki dla programistów","Przewodniki dla programistów 124; ProxyHat Blog","Poradniki kodowe i przewodniki SDK do integracji proxy z aplikacjami.",[56,60],{"id":57,"slug":58,"name":59},1,"web-scraping","Web Scraping",{"id":61,"slug":62,"name":63},12,"sdk","SDK",{"it":65,"pt":66,"tr":67,"es":68,"pl":13,"de":69,"ru":70,"en":71,"fr":72,"zh":73,"ja":74,"ko":75,"x-default":71},"\u002Fit\u002Fblog\u002Fmonitoraggio-delle-prestazioni-del-proxy-latenza-il-tasso-di-successo-e-gli-avvisi","\u002Fpt\u002Fblog\u002Fmonitorando-desempenho-de-proxy","\u002Ftr\u002Fblog\u002Fproxy-performansini-izleme","\u002Fes\u002Fblog\u002Fmonitoreo-rendimiento-proxy","\u002Fde\u002Fblog\u002Fproxy-performance-ueberwachen","\u002Fru\u002Fblog\u002Fmonitoring-proizvoditelnosti-proksi","\u002Fblog\u002Fmonitoring-proxy-performance","\u002Ffr\u002Fblog\u002Fsurveiller-la-performance-des-proxies","\u002Fcn\u002Fblog\u002Fjiankong-daili-xingneng","\u002Fja\u002Fblog\u002Fprokishi-pafoomansu-no-kanshi","\u002Fko\u002Fblog\u002Fproxy-seongneung-monitoring",{"it":65,"pt":66,"tr":67,"es":68,"pl":13,"de":69,"ru":70,"en":71,"fr":72,"zh":73,"ja":74,"ko":75},77,[79,96,115,132],{"id":80,"slug":81,"title":82,"excerpt":83,"featured_image_url":84,"featured_image_alt":14,"card_image_url":85,"og_image_url":86,"published_at":87,"updated_at":39,"content_updated_at":88,"reading_time_minutes":61,"is_featured":37,"indexable":37,"views":89,"author":90,"categories":91,"tags":93},50,"projektowanie-niezawodnej-architektury-skraplania","Projektowanie niezawodnej architektury skraplania","Zaprojektuj system scrating end-to@-@ end: terminarz, kolejka URL, pula pełzaczy, warstwa proxy, parser, przechowywanie i monitorowanie. Production- ready Python kod z diagramami architektury.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Freliable-scraping-architecture-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Freliable-scraping-architecture-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Freliable-scraping-architecture-og.webp","2026-02-24T06:55:16+00:00","2026-10-03T08:21:23+00:00",73,{"name":45,"slug":46,"bio":47,"avatar_url":14,"website_url":14,"social_links":14},[92],{"id":50,"slug":51,"name":52,"description":14,"meta_title":53,"meta_description":54,"parent_id":14},[94,95],{"id":61,"slug":62,"name":63},{"id":57,"slug":58,"name":59},{"id":97,"slug":98,"title":99,"excerpt":100,"featured_image_url":101,"featured_image_alt":14,"card_image_url":102,"og_image_url":103,"published_at":104,"updated_at":39,"content_updated_at":105,"reading_time_minutes":106,"is_featured":37,"indexable":37,"views":80,"author":107,"categories":108,"tags":112},36,"jak-rozdrabniac-infrastrukture","Jak rozdrabniać infrastrukturę","Wzory architektoniczne do skalowania skanowania stron internetowych: systemy oparte na kolejkach, projektowanie rurociągów, skalowanie poziome kontenerów oraz zarządzanie proxy w skali. Kod w Pythonie, Node.js i Go.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscale-scraping-infrastructure-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscale-scraping-infrastructure-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscale-scraping-infrastructure-og.webp","2026-02-09T14:42:34+00:00","2026-02-27T09:20:59+00:00",10,{"name":45,"slug":46,"bio":47,"avatar_url":14,"website_url":14,"social_links":14},[109],{"id":57,"slug":58,"name":59,"description":14,"meta_title":110,"meta_description":111,"parent_id":14},"Web Scraping Guides & Porady 124; ProxyHat Blog","Naucz się technik skanowania stron internetowych, strategii proxy i najlepszych praktyk ekstrakcji danych.",[113,114],{"id":57,"slug":58,"name":59},{"id":61,"slug":62,"name":63},{"id":116,"slug":117,"title":118,"excerpt":119,"featured_image_url":120,"featured_image_alt":14,"card_image_url":121,"og_image_url":122,"published_at":123,"updated_at":39,"content_updated_at":124,"reading_time_minutes":61,"is_featured":37,"indexable":37,"views":125,"author":126,"categories":127,"tags":129},35,"skalowanie-zadan-proxy-za-pomoca-kontroli-konkursowej","Skalowanie żądań proxy za pomocą kontroli konkursowej","Master wzorce konkursowe do skrobania na bazie proksydowej: asyncio semafora, baseny obietnic, baseny robotnicze Go, ograniczniki stóp i ciśnienie wsteczne. Kod produkcji w Pythonie, Node.js i Go.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscaling-proxy-requests-concurrency-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscaling-proxy-requests-concurrency-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fscaling-proxy-requests-concurrency-og.webp","2026-02-08T11:16:13+00:00","2026-10-03T08:21:27+00:00",362,{"name":45,"slug":46,"bio":47,"avatar_url":14,"website_url":14,"social_links":14},[128],{"id":50,"slug":51,"name":52,"description":14,"meta_title":53,"meta_description":54,"parent_id":14},[130,131],{"id":61,"slug":62,"name":63},{"id":57,"slug":58,"name":59},{"id":133,"slug":134,"title":135,"excerpt":136,"featured_image_url":137,"featured_image_alt":14,"card_image_url":138,"og_image_url":139,"published_at":140,"updated_at":39,"content_updated_at":141,"reading_time_minutes":61,"is_featured":37,"indexable":37,"views":142,"author":143,"categories":144,"tags":146},29,"budowa-warstwa-proxy-middleware-do-skracania","Budowa warstwa Proxy Middleware do skracania","Projektowanie i budowa warstwy pośredniczącej proxy production- grade z retry logiki, awarii i metryki. Kompletne implementacje w Pythonie i Node.js przy użyciu ProxyHat.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-middleware-layer-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-middleware-layer-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-middleware-layer-og.webp","2026-02-02T07:15:32+00:00","2026-10-03T08:21:34+00:00",45,{"name":45,"slug":46,"bio":47,"avatar_url":14,"website_url":14,"social_links":14},[145],{"id":50,"slug":51,"name":52,"description":14,"meta_title":53,"meta_description":54,"parent_id":14},[147,148],{"id":61,"slug":62,"name":63},{"id":57,"slug":58,"name":59},[]]