Skip to content

Instantly share code, notes, and snippets.

View slavpetroff's full-sized avatar
💭
Python

Stanislav Petrov slavpetroff

💭
Python
View GitHub Profile
@slavpetroff
slavpetroff / api.py
Created November 13, 2024 17:13 — forked from draincoder/api.py
FastAPI + FastStream tracing
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from faststream.redis import RedisMessage
from faststream.redis.fastapi import RedisRouter
from faststream.redis.opentelemetry import RedisTelemetryMiddleware
router = RedisRouter()
SELECT "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_child"."user_ptr_id", "api_child"."setup_completed", "api_child"."currency_id", "api_child"."assignment_approved_counter", "api_child"."assignment_auto_approve_enabled", "api_currency"."id", "api_currency"."iso_4217_name", "api_currency"."name", "payments_trustlyaccount"."user_id", "payments_trustlyaccount"."account_id", "payments_trustlyaccount"."descriptor", "payments_trustlyaccount"."clearing_house", "payments_trus
First run:
SELECT
count(*) as counter, view_name, response_data, response_code, http_method
FROM tracking_request
GROUP BY view_name, response_data, response_code, http_method
ORDER BY view_name
LIMIT {limit_count};