[TOO-522] Supress chardet noizy versioning warning (#792)
Use this PR summary: --- ## [TOO-522] Suppress chardet warning and fix OpenTelemetry telemetry ### Summary Reduces noisy chardet/urllib3 warnings in telemetry and updates the OpenTelemetry logger API to match the current SDK. ### Changes **`libs/arcade-serve/arcade_serve/fastapi/telemetry.py`** - Add `warnings.filterwarnings` to ignore `RequestsDependencyWarning` when chardet≥6 is present (requests uses charset-normalizer regardless) - Replace `_logs.set_logger_provider` with `set_logger_provider` from `opentelemetry._logs` (API change in OpenTelemetry 1.15+) **`.ruff.toml`** - Add per-file ignore for E402 on `telemetry.py` because `warnings.filterwarnings` must run before the opentelemetry imports that pull in requests **`libs/arcade-serve/pyproject.toml`** - Bump version 3.2.1 → 3.2.2 --- Closes TOO-522 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: changes are limited to telemetry initialization (warning filtering and OpenTelemetry logger-provider wiring) plus a patch version bump, with minimal impact outside observability. > > **Overview** > Reduces telemetry startup noise by filtering `requests` `chardet`-related warnings before OpenTelemetry imports, and updates logging initialization to use `opentelemetry._logs.set_logger_provider` instead of the deprecated `_logs.set_logger_provider` call. > > Adds a targeted Ruff `E402` per-file ignore for `telemetry.py` to allow the early warning filter, and bumps `arcade-serve` version from `3.2.1` to `3.2.2`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5166c51be7cdfb05f86df18490a0c98b44f771c2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This commit is contained in:
parent
3ed66e663c
commit
bf6bfa83f1
3 changed files with 16 additions and 3 deletions
|
|
@ -62,6 +62,8 @@ ignore = [
|
|||
"**/tests/*" = ["S101"]
|
||||
"libs/**/*.py" = ["C901"]
|
||||
"libs/arcade-mcp-server/docs/**" = ["TRY400"]
|
||||
# E402: warnings.filterwarnings must run before opentelemetry imports (which pull in requests)
|
||||
"libs/arcade-serve/arcade_serve/fastapi/telemetry.py" = ["E402"]
|
||||
|
||||
[format]
|
||||
preview = true
|
||||
|
|
|
|||
|
|
@ -1,10 +1,21 @@
|
|||
import logging
|
||||
import os
|
||||
import urllib.parse
|
||||
import warnings
|
||||
from typing import Literal, Optional
|
||||
|
||||
# requests scans the environment for chardet at import time and emits a
|
||||
# RequestsDependencyWarning when chardet>=6 is present (e.g. pulled in by tox).
|
||||
# The warning is noise: requests uses charset-normalizer regardless of chardet.
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
message="urllib3.*chardet.*",
|
||||
module="requests",
|
||||
)
|
||||
|
||||
from fastapi import FastAPI
|
||||
from opentelemetry import _logs, trace
|
||||
from opentelemetry import trace
|
||||
from opentelemetry._logs import set_logger_provider
|
||||
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
|
||||
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
|
||||
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
||||
|
|
@ -102,7 +113,7 @@ class OTELHandler:
|
|||
otlp_log_exporter = OTLPLogExporter()
|
||||
|
||||
self._logger_provider = LoggerProvider(resource=self.resource)
|
||||
_logs.set_logger_provider(self._logger_provider)
|
||||
set_logger_provider(self._logger_provider)
|
||||
|
||||
# Create a batch span processor and add the exporter
|
||||
self._log_processor = BatchLogRecordProcessor(otlp_log_exporter)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "arcade-serve"
|
||||
version = "3.2.1"
|
||||
version = "3.2.2"
|
||||
description = "Arcade Serve - Serving infrastructure for Arcade tools and workers"
|
||||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue