403Webshell
Server IP : 198.54.126.161  /  Your IP : 216.73.217.148
Web Server : LiteSpeed
System : Linux premium12.web-hosting.com 4.18.0-553.94.1.lve.el8.x86_64 #1 SMP Thu Jan 22 12:37:22 UTC 2026 x86_64
User : amerfigf ( 898)
PHP Version : 8.2.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/hc_python/lib64/python3.12/site-packages/sentry_sdk/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/hc_python/lib64/python3.12/site-packages/sentry_sdk/metrics.py
import time
from typing import TYPE_CHECKING, Any, Optional

import sentry_sdk
from sentry_sdk.utils import format_attribute

if TYPE_CHECKING:
    from sentry_sdk._types import Attributes, Metric, MetricType


def _capture_metric(
    name: str,
    metric_type: "MetricType",
    value: float,
    unit: "Optional[str]" = None,
    attributes: "Optional[Attributes]" = None,
) -> None:
    attrs: "Attributes" = {}

    if attributes:
        for k, v in attributes.items():
            attrs[k] = format_attribute(v)

    metric: "Metric" = {
        "timestamp": time.time(),
        "trace_id": None,
        "span_id": None,
        "name": name,
        "type": metric_type,
        "value": float(value),
        "unit": unit,
        "attributes": attrs,
    }

    sentry_sdk.get_current_scope()._capture_metric(metric)


def count(
    name: str,
    value: float,
    unit: "Optional[str]" = None,
    attributes: "Optional[dict[str, Any]]" = None,
) -> None:
    _capture_metric(name, "counter", value, unit, attributes)


def gauge(
    name: str,
    value: float,
    unit: "Optional[str]" = None,
    attributes: "Optional[dict[str, Any]]" = None,
) -> None:
    _capture_metric(name, "gauge", value, unit, attributes)


def distribution(
    name: str,
    value: float,
    unit: "Optional[str]" = None,
    attributes: "Optional[dict[str, Any]]" = None,
) -> None:
    _capture_metric(name, "distribution", value, unit, attributes)

Youez - 2016 - github.com/yon3zu
LinuXploit