{"data":{"slug":"aavetis-azure-openai-logger","name":"azure-openai-logger","tagline":"Batteries included logging solution for Azure OpenAI instances.","github_url":"https://github.com/aavetis/azure-openai-logger","owner":"aavetis","repo":"azure-openai-logger","owner_avatar_url":"https://avatars.githubusercontent.com/u/3076502?v=4","primary_language":"Bicep","stars":73,"forks":6,"topics":[],"archived":false,"github_pushed_at":"2025-07-06T14:13:13+00:00","maintenance_label":"Dormant","url":"https://www.graphcanon.com/tools/aavetis-azure-openai-logger","markdown_url":"https://www.graphcanon.com/tools/aavetis-azure-openai-logger.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/aavetis-azure-openai-logger","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=aavetis-azure-openai-logger","description":"\"Batteries included\" logging solution for your Azure OpenAI instance.","homepage_url":null,"license":null,"open_issues":8,"watchers":2,"ai_summary":"This project offers an easy-to-deploy observability setup for Azure OpenAI services, including API Management and Application Insights integration for logs.","readme_excerpt":"# Observability for your Azure OpenAI instance\n\n## Overview and goals\n\n> **❗️ This project is in \"beta\"! Please re-review all deployment parameters, code, and queries before using in a production scenario.**\n\nThis project aims to create a simple and easy to deploy solution to add observability to your Azure OpenAI instance. The approach adds an API Management instance as a proxy for your existing Azure OpenAI service, and funnels logs / requests / responses to an Application Insights instance. Additionally, a prebuilt query is saved to a workbook for easy access to logs.\n\n- Keep all your OpenAI generations, metrics, and logs in your own Azure subscription.\n- Provision and configure all dependent services programmatically.\n- Queries, workbooks, and visualizations are available out of the box.\n- An overall \"batteries included\" type of experience.\n\n\n\n# Usage instructions\n\n- **Pre-requisite: You must have an Azure OpenAI service provisioned already.**\n- See the examples folder for quickstarts - [**OpenAI**](/examples/openai-example.py), [**Langchain**](/examples/langchain-example.py)\n- (Recommended) Create a new resource group to house these resources\n\n```bash\naz group create --name loggerTest --location eastus\n```\n\n- In the root of this repo, run the deployment script\n\n```bash\naz deployment group create --resource-group loggerTest \\\n--template-file ./main.bicep \\\n--parameters openAiEndpoint=\"https://your-instance-hostname.openai.azure.com\" \\\nopenAiApiKey=\"your-openai-api-key\"\n```\n\n- Navigate to the API Management instance deployed to your resource group.\n- Copy your new endpoint from APIM and Subscription Key, and replace it in your code. (You can find your Subscription key in Azure API Manager by clicking \"Subscriptions\", then on the elipsis dots (\"...\") to the right of OpenAI Subscription, and finally on \"Show/hide keys\")\n\n```javascript\n// example Javascript code to call your Azure OpenAI instance\nconst { Configuration } = require(\"openai\");\n\n// add your APIM Subscription Key\nconst apiKey = process.env.MY_APIM_API_KEY;\n\nconfig = new Configuration({\n  // replace endpoint with your new API Management instance endpoint\n  basePath: `https://${APIM_ENDPOINT}/openai/deployments/${OPENAI_DEPLOYMENT_NAME}`,\n\n  // be sure to add headers!\n  baseOptions: {\n    headers: { \"api-key\": apiKey },\n    params: { \"api-version\": \"2023-07-01-preview\" },\n  },\n});\n```\n\n## Advanced usage\n\nWith your OpenAI calls, you can provide any amount of custom headers to track usage. For example, tracking how many requests a user makes, or how many calls are on a certain plan, or from a region, or by application.\n\nProvide the `custom-headers` attribute as a string inside of the headers object:\n\n```javascript\n\nconfig = new Configuration({\n  basePath: `https://${APIM_ENDPOINT}/openai/deployments/${OPENAI_DEPLOYMENT_NAME}`,\n\n  baseOptions: {\n    headers: { \n      \"api-key\": apiKey,\n       \"custom-headers\": JSON.stringify({\n            user: \"a_unique_id\",\n            planId: \"your_plan_id\",\n            region: \"your_region\",\n            application: \"my-web-app\",\n            appVersion: \"1.0.0\"\n          }),\n    },\n    params: { \"api-version\": \"2023-07-01-preview\" },\n  },\n});\n```\n\nAs requests come in, the property dimension dropdown will be populated by the *attributes* of your custom headers. The values will aggregate the requests that came in with those values.\n\n\n\n## Debugging issues\n\n- Test your new endpoint by using the API Management tester (APIM -> APIs -> OpenAI Proxy API -> Test)\n  - For `deployment-id` use a model deployment name you have deployed in Azure Open AI (eg. \"gpt-35-turbo\")\n  - For `api-version` use the API version you are using (eg. \"2023-07-01-preview\")\n  - If you get a 404, it's likely because the original endpoint you provided was structured incorrectly. Go to Backends -> backend -> Properties - you should see your original endpoint + `/openai`\n\n## Architecture footprint\n\nThe main components of the architecture include:\n\n- API Management (Con","github_created_at":"2023-09-05T01:28:06+00:00","created_at":"2026-07-11T23:14:19.420339+00:00","updated_at":"2026-08-02T06:00:36.960405+00:00","categories":[{"slug":"evaluation-observability","name":"Evaluation & Observability","url":"https://www.graphcanon.com/categories/evaluation-observability","markdown_url":"https://www.graphcanon.com/categories/evaluation-observability.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/evaluation-observability"}],"tags":[{"slug":"api-management","name":"api management"},{"slug":"application-insights","name":"application insights"},{"slug":"azure","name":"azure"},{"slug":"logging","name":"logging"},{"slug":"observability","name":"observability"},{"slug":"openai","name":"openai"}],"trust":{"provenance":{"is_fork":false,"github_id":687254137,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-02T06:00:36.053Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":391,"last_release_at":"2023-10-02T15:40:15Z"},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T23:14:27.210Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-02T06:00:36.699Z"},"languages":{"value":["bicep"],"source":"github.language","observed_at":"2026-08-02T06:00:36.699Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["For users who require a streamlined deployment of observability tools on their Azure OpenAI setup.","If you need out-of-the-box query capabilities to monitor your OpenAI service within an Azure environment."],"when_not_to_use":["Avoid if manual control over the logging mechanisms and deployment processes is preferred.","Not suitable for environments that do not already have an Azure OpenAI instance set up or plans to use one."],"source":"enrich:decision_facts","observed_at":"2026-07-17T11:37:47.610Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"azure-openai-logger enables automated logging and metrics management for Azure OpenAI instances via Bicep scripts, incorporating API Management and Application Insights."}]}}