Thin client for Azure Monitor DataCollector API.
Project description
A thin client to send log data to Azure Monitor by using the HTTP Data Collector API.
Installation
$ pip install datacollector-api-client
Usage
from datacollector_api_client.client import DataCollectorWrapper wrapper = DataCollectorWrapper(LOGANALYTICS_WORKSPACE_ID, LOGANALYTICS_WORKSPACE_KEY) data = [{ "application": "my_app", "message": "my log message" }] response = wrapper.log_info(structured_log_message=data) print(response)
Enriching structured logging with Databricks information
Pass your dbutils instance from your Databricks session to the library
wrapper = DataCollectorWrapper(LOGANALYTICS_WORKSPACE_ID, LOGANALYTICS_WORKSPACE_KEY, dbutils) data = [{ "application": "Notebook", "message": f'Number of rows in dataframe: {df.count()}' }] response = wrapper.log_info(structured_log_message=data) print(response)
- The following data is also collected and appended to your log:
dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘clusterId’)
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘sessionId’)
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘user’)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datacollector-api-client-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0cb0f105e1fb3b59b4304e2b3af8e6ef10e83de99a195fc19e106ddba049985 |
|
MD5 | 205eda27a4e95cbaad556b09c21ec45c |
|
BLAKE2b-256 | 08240a43f0e99244e7af5cb65c7b43bdce0928bd668a68800b9608aa944ee06d |
Close
Hashes for datacollector_api_client-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa1d490874c1e9585bc710ef6149cf3b00e977b6118a07def8b4c1909f5eeb0d |
|
MD5 | 72645892f3ac6af061d99bd4d964de21 |
|
BLAKE2b-256 | 835bde41441f7f74b4729b63bd348038370bbe568829b6e684bc3f5008f63b18 |