semvec/pypi-packages huggingface dataset:
MT-PY-PerformanceLogging-Version1 0.0.1
A Mouritech package
Requires Python: >=3.7

# This is Moruitech_LoggingPerformance Package

# Project Title

Creating custom package for Logging Performance in python.
This is the project ,Whenever you need to check the performance of the code like time taken by the code to perform some task . 





## Technologie 
Python



## Installation

Install my-project with Python
INstall Mouritech__LoggingPerformance

```bash
  pip install  Mouritech_LoggingPerformance
  cd  Mouritech_LoggingPerformance
```



## Steps 
pip install Mouritech_LoggingPerformance


from Mouritech_LoggingPerformance.Performance import PerformanceLogger
from LogPerformance import PerformanceLogger

PerformanceLogger(

)




## Authors

- [@Sirisha](https://www.github.com/octokatherine)


## License

[MIT](https://choosealicense.com/licenses/mit/)

[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/)
[![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)



## Used By

This project is used by the following Cases:

- Projects :-Logging Performance for checking the Time duration taken by the code to  Excute Task/program .
- 




pip install Mouritech_LoggingPerformance





from Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger
from LogPerformance import PerformanceLogger

PerformanceLogger(

   

)
request-time-tracker 0.0.21a4
Requests time tracker from being captured by proxy (e.g. nginx) till being executed by wsgi handler
Requires Python: >=3.6

# Queue time tracker
Reads time when request was processed by nginx & send time spent in queue before it was handled by wsgi.  
Designed mostly for autoscaling. Instance cpu is not trustworthy enough, sometimes there can be external bottlenecks, 
so even if instance cpu is fine, application can hang in queue between nginx(for example) and gunicorn or another wsgi processor.  

## Configuration
1. Add header with request timestamp.

   nginx:
    ```
   proxy_set_header X-RequestTime $msec;
   ```

2. Read header value & send metric value

### Django application
1. Configure django settings:

aws:
   - QUEUE_TIME_TRACKER_NOTIFY_EVERY_SECONDS = 10
   - QUEUE_TIME_TRACKER_HEADER = 'HTTP_X_REQUESTTIME'
   - QUEUE_TIME_TRACKER_CACHE_NAME = 'default'
   - QUEUE_TIME_TRACKER_CACHE_KEY_PREFIX = 'foobar'
   - QUEUE_TIME_TRACKER_CLOUDWATCH_NAMESPACE = 'FooBar Web'
   - QUEUE_TIME_TRACKER_CLOUDWATCH_ACCESS_KEY = 'AK****A'
   - QUEUE_TIME_TRACKER_CLOUDWATCH_SECRET_KEY = 'so******BS'
   - QUEUE_TIME_TRACKER_CLOUDWATCH_REGION = 'us-west-1'

azure:
   - QUEUE_TIME_TRACKER_AZURE_REGION = 'eastus' 
   - QUEUE_TIME_TRACKER_AZURE_SUBSCRIPTION_ID = '*****'  
   - QUEUE_TIME_TRACKER_AZURE_RESOURCE_GROUP_NAME = 'example_group' 
   - QUEUE_TIME_TRACKER_AZURE_PROVIDER_NAME = 'Microsoft.ContainerService' 
   - QUEUE_TIME_TRACKER_AZURE_RESOURCE_TYPE = 'managedClusters' 
   - QUEUE_TIME_TRACKER_AZURE_RESOURCE_ID = 'example-k8s-cluster'

2. Wrap wsgi application with time tracker:
aws:
```python

from request_time_tracker.wsgi_django.cloudwatch import CloudWatchQueueTimeTracker

application = get_wsgi_application()

application = CloudWatchQueueTimeTracker(application)
```

azure:
```python

from request_time_tracker.wsgi_django.azure import AzureMonitoringQueueTimeTracker

application = get_wsgi_application()

application = AzureMonitoringQueueTimeTracker(application)
```

### Non-django application
1. Wrap wsgi application with time tracker. Example:
```python
from functools import partial
from request_time_tracker.trackers.cache.redis import RedisCacheQueueTimeTracker
from request_time_tracker.notifiers.cloudwatch import CloudWatchNotifier

tracker = partial(
    RedisCacheQueueTimeTracker, 
    queue_time_header_name='HTTP_X_REQUESTTIME',
    redis_url='redis://localhost:6379/0',
    notifier=CloudWatchNotifier(
        namespace='FooBar Web',
        aws_access_key='AK****A',
        aws_secret_key='so******BS',
        aws_region='us-west-1',
    ),
)

wsgi_application = tracker(wsgi_application)
```


## Cloudwatch role policy:
```
{
    “Version”: “2012-10-17",
    “Statement”: [
        {
            “Sid”: “VisualEditor0”,
            “Effect”: “Allow”,
            “Action”: [“cloudwatch:PutMetricData”],
            “Resource”: “*”
        }
    ]
}
```

## Azure
role definition: Monitoring Metrics Publisher
https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#monitoring-metrics-publisher