Skip to content

Instantly share code, notes, and snippets.

from typing import List, Optional
import requests
def explode_and_filter_by_threshold(value: str, threshold: int) -> List[int]:
"""
Params:
- value : a string of numbers separated by comma
- threshold : numerical threshold
import os
from datadog_api_client import Configuration, ApiClient
from datadog_api_client.exceptions import ApiAttributeError
from datadog_api_client.exceptions import ApiTypeError, ApiValueError
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.api.monitors_api import MonitorsApi
from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource
from datadog_api_client.v2.api.metrics_api import MetricsApi
sum(rate(http_requests_total(service="my-service" response_code=~"[45].."))) by (service) > 10
sum(rate(http_requests_total(namesapce="my-namespace", service="my-service" response_code=~"[45].."))) by (namespace, service) > 10
sum(rate(istio_requests_total{destination_service_name="$destination_service", reporter="source"}[2m])) by (source_workload_namespace, source_app)