معرفی شرکت ها


fastapialchemycollector-1.0.1


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Metis log collector for FastAPI and SQLAlchemy
ویژگی مقدار
سیستم عامل -
نام فایل fastapialchemycollector-1.0.1
نام fastapialchemycollector
نسخه کتابخانه 1.0.1
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Metis dev
ایمیل نویسنده devops@metisdata.io
آدرس صفحه اصلی https://github.com/metis-data/metis-python-collectors
آدرس اینترنتی https://pypi.org/project/fastapialchemycollector/
مجوز -
# Metis FastAPI SQLAlchemy log collector ### About This library logs the HTTP requests created by FastAPI and SQLAlchemy with the SQL commands they generate. The library can also collect the execution plan for deeper analysis. The log records stored in a local file. Future versions will allow saving the log records directly to log collectors such as DataDog, Logz.io and Splunk. The log can be analyzed using our [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=Metis.dba-ai-vscode) ### Technical This library uses [OpenTelemetry](https://pypi.org/project/opentelemetry-sdk/) to instrument both FastAPI and SQLAlchemy. Tested on python 3.8.9, FastAPI 0.78.0, SQLAlchemy 1.4.33, PostgreSQL 12 or higher. ### Instrumentation Installation: ```bash pip install fastapialchemycollector ``` Instrumentation: * Configure the destination file name * Configure logging the execution plan By default the package only logs the SQL commands and the estimated execution plan (PlanCollectType.ESTIMATED). The library: 1. Logs the estimated execution plan by running the SQL command using ```sql EXPLAIN ( VERBOSE, COSTS, SUMMARY, FORMAT JSON) ``` 2. Runs the SQL command. Logging the estimated plan has an impact on performances but usually, in a dev environment who doesn't run a large number of SQL commands, the impact is very low, around 3%. Warning! Do NOT run the code in Production! An environment variable should prevent the package from collecting the estimated execution plan in Production. The library can be configured using PlanCollectType.NONE to log only the SQL Commands while the execution plans, estimated or actual, will be calculated later using our platform. * Using Metis platform with Apikey: ```python import os from sqlalchemy import create_engine from fastapi import FastAPI from fastapialchemycollector import setup, MetisInstrumentor, PlanCollectType # existing app initialization app = FastAPI() engine = create_engine(os.environ['DATABASE_URI']) # To start collecting the logs: instrumentation: MetisInstrumentor = setup('<SERVICE_NAME>', api_key='<API_KEY>', service_version='<SERVICE_VERSION>', plan_collection_option=PlanCollectType.ESTIMATED, #optional exporter_url="https://ingest.metisdata.io/") #optional instrumentation.instrument_app(app, engine) ``` * Using local file: ```python import os from sqlalchemy import create_engine from fastapi import FastAPI from fastapialchemycollector import setup, MetisInstrumentor, PlanCollectType # existing app initialization app = FastAPI() engine = create_engine(os.environ['DATABASE_URI']) # By default, the package logs the SQL commands and their execution plan. # It can also be configured manually to collect only the SQL commands using PlanCollectType.NONE. # We recommend collecting the estimated plan too. optional_plan_collect_type = PlanCollectType.ESTIMATED # To start collecting the logs: instrumentation: MetisInstrumentor = setup('<SERVICE_NAME>', api_key='<API_KEY>', service_version='<SERVICE_VERSION>' #optional ) instrumentation.instrument_app(app, engine) ``` ### Set up your own tags: You can assign metadata to your resources in the form of tags. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources. You can create tags to categorize resources by purpose, owner, environment, or other criteria. #### Define tags using environment variables: METIS_TAG_<TAG_NAME>="<VALUE>" ```bash export METIS_TAG_ENV=staging export METIS_TAG_PR=$(git log -1 --format="%H") ``` #### Define tag using code: Initialized setup with additional param called `resource_tags` ```python from fastapialchemycollector import setup, MetisInstrumentor instrumentation: MetisInstrumentor = setup('<SERVICE_NAME>', api_key="<API_KEY>" ..., resource_tags={"pr": "staging"}) ```


زبان مورد نیاز

مقدار نام
>=3.6.* Python


نحوه نصب


نصب پکیج whl fastapialchemycollector-1.0.1:

    pip install fastapialchemycollector-1.0.1.whl


نصب پکیج tar.gz fastapialchemycollector-1.0.1:

    pip install fastapialchemycollector-1.0.1.tar.gz