Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
add meta image (#189)
patcher9e3a6d2c121b9
diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.mdindex 08546663..912899d1 100644--- a/.github/ISSUE_TEMPLATE/bug.md+++ b/.github/ISSUE_TEMPLATE/bug.md@@ -24,10 +24,9 @@ Describe what you thought would happen.Pictures can say a thousand words and can be super helpful!### π» Your Setup-- Doku Version: [e.g., 0.0.1]-- DokuMetry SDK: [Python or NodeJS]-- DokuMetry SDK Version: [e.g., 0.0.3]-- Deployment Method: [Helm, Linux, Windows, Docker]+- OpenLIT Version: [e.g., 0.0.1]+- OpenLIT SDK Version: [e.g., 0.0.3]+- Deployment Method: [Helm, Docker]### π Additional NotesGot more to say? Tell us here.diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdindex 47f89476..1e58426b 100644--- a/.github/PULL_REQUEST_TEMPLATE.md+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -16,5 +16,5 @@ Attach screenshots/screen recordings here to show the changes.#### Checklist:- [ ] PR name follows conventional commits format: `[Feat]: ...` or `[Fix]: ....`-- [ ] Added visuals for changes (Needed if you made changes to Doku Client or Connections in Doku Ingester)-- [ ] Checked Doku [contribution guidelines](https://github.com/dokulabs/doku/blob/main/CONTRIBUTING.md)+- [ ] Added visuals for changes+- [ ] Checked OpenLIT [contribution guidelines](https://github.com/openlit/openlit/blob/main/CONTRIBUTING.md)diff --git a/.github/workflows/doku-release.yml b/.github/workflows/openlit-release.ymlsimilarity index 85%rename from .github/workflows/doku-release.ymlrename to .github/workflows/openlit-release.ymlindex a0eadc8a..298dd0b0 100644--- a/.github/workflows/doku-release.yml+++ b/.github/workflows/openlit-release.yml@@ -1,4 +1,4 @@-name: Release Doku+name: Release OpenLITon:push:@@ -12,7 +12,7 @@ permissions:jobs:release:- name: Client Docker Image+ name: OpenLIT Imageruns-on: ubuntu-latestoutputs:version: ${{ steps.set-version-output.outputs.version }}@@ -75,12 +75,12 @@ jobs:platforms: linux/amd64,linux/arm64/v8annotations: |${{ steps.meta.outputs.annotations }},- io.artifacthub.package.logo-url=https://github.com/dokulabs/.github/blob/main/profile/assets/logo-orange-bg.jpg?raw=true,- io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dokulabs/doku/main/README.md,+ io.artifacthub.package.logo-url=https://github.com/openlit/.github/blob/main/profile/assets/logo-orange-bg.jpg?raw=true,+ io.artifacthub.package.readme-url=https://raw.githubusercontent.com/openlit/openlit/main/README.md,io.artifacthub.package.license=Apache-2.0,- org.opencontainers.image.vendor=Doku Labs,- io.artifacthub.package.maintainers=[{'name':'Doku Labs','email':'[email protected]'}],- io.artifacthub.package.keywords='Monitoring, Observability, LLMs, OpenAI'+ org.opencontainers.image.vendor=OpenLIT,+ io.artifacthub.package.maintainers=[{'name':'OpenLIT','email':'[email protected]'}],+ io.artifacthub.package.keywords='Monitoring, Observability, LLMs, OpenAI, OpenTelemetry, Tracing'- name: Sign the published Docker imageenv:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymldeleted file mode 100644index 3e0c15b3..00000000--- a/.github/workflows/release.yml+++ /dev/null@@ -1,206 +0,0 @@-name: Release--on:- push:- tags: [ '*.*.*' ]--env:- REGISTRY: ghcr.io--permissions:- contents: write--jobs:- client-docker:- name: Client Docker Image- runs-on: ubuntu-latest- outputs:- version: ${{ steps.set-version-output.outputs.version }}- permissions:- contents: write- packages: write- id-token: write- env:- IMAGE_NAME: ${{ github.repository }}-client-- steps:- - name: Get current date and time- id: datetime- run: echo "::set-output name=datetime::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"-- - name: Checkout repository- uses: actions/checkout@v4-- - name: Install cosign- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0- with:- cosign-release: 'v2.2.2'-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0-- - name: Code Format Check (gofmt)- run: |- if [ -n "$(gofmt -l .)" ]; then- echo "Go code is not formatted:"- gofmt -d .- exit 1- fi-- - name: Log into registry ${{ env.REGISTRY }}- uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0- with:- registry: ${{ env.REGISTRY }}- username: ${{ github.actor }}- password: ${{ secrets.GITHUB_TOKEN }}-- - name: Extract Docker metadata- id: meta- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1- with:- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}- env:- DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index-- - name: Build and push Docker image- id: build-and-push- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0- with:- context: ./src/client/- provenance: false- file: ./src/client/Dockerfile- push: ${{ github.event_name != 'pull_request' }}- tags: ${{ steps.meta.outputs.tags }}- labels: ${{ steps.meta.outputs.labels }}- platforms: linux/amd64,linux/arm64/v8- annotations: |- ${{ steps.meta.outputs.annotations }},- io.artifacthub.package.logo-url=https://github.com/dokulabs/.github/blob/main/profile/assets/logo-orange-bg.jpg?raw=true,- io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dokulabs/doku/main/README.md,- io.artifacthub.package.license=Apache-2.0,- org.opencontainers.image.vendor=Doku Labs,- io.artifacthub.package.maintainers=[{'name':'Doku Labs','email':'[email protected]'}],- io.artifacthub.package.keywords='Monitoring, Observability, LLMs, OpenAI'-- - name: Sign the published Docker image- env:- TAGS: ${{ steps.meta.outputs.tags }}- DIGEST: ${{ steps.build-and-push.outputs.digest }}- run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}-- ingester-docker:- name: Ingester Docker Image- runs-on: ubuntu-latest- outputs:- version: ${{ steps.set-version-output.outputs.version }}- permissions:- contents: write- packages: write- id-token: write- env:- IMAGE_NAME: ${{ github.repository }}-ingester-- steps:- - name: Get current date and time- id: datetime- run: echo "::set-output name=datetime::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"-- - name: Checkout repository- uses: actions/checkout@v4-- - name: Install cosign- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0- with:- cosign-release: 'v2.2.2'-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0-- - name: Code Format Check (gofmt)- run: |- if [ -n "$(gofmt -l .)" ]; then- echo "Go code is not formatted:"- gofmt -d .- exit 1- fi-- - name: Log into registry ${{ env.REGISTRY }}- uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0- with:- registry: ${{ env.REGISTRY }}- username: ${{ github.actor }}- password: ${{ secrets.GITHUB_TOKEN }}-- - name: Extract Docker metadata- id: meta- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1- with:- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}- env:- DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index-- - name: Build and push Docker image- id: build-and-push- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0- with:- context: ./src/ingester/- provenance: false- file: ./src/ingester/Dockerfile- push: ${{ github.event_name != 'pull_request' }}- tags: ${{ steps.meta.outputs.tags }}- labels: ${{ steps.meta.outputs.labels }}- platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le- annotations: |- ${{ steps.meta.outputs.annotations }},- io.artifacthub.package.logo-url=https://github.com/dokulabs/.github/blob/main/profile/assets/logo-orange-bg.jpg?raw=true,- io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dokulabs/doku/main/README.md,- io.artifacthub.package.license=Apache-2.0,- org.opencontainers.image.vendor=Doku Labs,- io.artifacthub.package.maintainers=[{'name':'Doku Labs','email':'[email protected]'}],- io.artifacthub.package.keywords='Monitoring, Observability, LLMs, OpenAI'-- - name: Sign the published Docker image- env:- TAGS: ${{ steps.meta.outputs.tags }}- DIGEST: ${{ steps.build-and-push.outputs.digest }}- run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}-- - name: Set version output- id: set-version-output- run: echo "::set-output name=version::${{ env.DOCKER_METADATA_OUTPUT_VERSION }}"-- ingester-binaries:- name: Ingester Binaries- needs: ingester-docker- runs-on: ubuntu-latest- strategy:- matrix:- platform:- - {os: "linux", arch: "amd64"}- - {os: "linux", arch: "arm64"}- - {os: "linux", arch: "arm"}- - {os: "linux", arch: "ppc64le"}- - {os: "windows", arch: "amd64"}- - {os: "windows", arch: "386"}- - {os: "darwin", arch: "amd64"}- - {os: "darwin", arch: "arm64"}-- steps:- - uses: actions/checkout@v4-- - uses: actions/setup-go@v5- with:- go-version: '1.21.5'-- - name: Build package for ${{ matrix.platform.os }}-${{ matrix.platform.arch }}- working-directory: ./src/ingester- run: env GOOS=${{ matrix.platform.os }} GOARCH=${{ matrix.platform.arch }} go build -o ingester-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-- - name: Upload binaries to release- uses: svenstaro/upload-release-action@v2- with:- repo_token: ${{ secrets.GITHUB_TOKEN }}- file: src/ingester/ingester-${{ matrix.platform.os }}-${{ matrix.platform.arch }}- asset_name: ingester-${{ matrix.platform.os }}-${{ matrix.platform.arch }}- tag: ${{ needs.ingester-docker.outputs.version }}- overwrite: true\ No newline at end of filediff --git a/.github/workflows/test-pypi-release.yml b/.github/workflows/test-pypi-release.ymlindex 78c79253..56fea222 100644--- a/.github/workflows/test-pypi-release.yml+++ b/.github/workflows/test-pypi-release.yml@@ -37,9 +37,9 @@ jobs:version = "0.0.${{ github.run_number }}"description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects"authors = ["OpenLIT"]- repository = "https://github.com/open-lit/openlit/tree/main/openlit/python"+ repository = "https://github.com/openlit/openlit/tree/main/openlit/python"readme = "README.md"- homepage = "https://github.com/open-lit/openlit/tree/main/openlit/python"+ homepage = "https://github.com/openlit/openlit/tree/main/openlit/python"keywords = ["OpenTelemetry", "otel", "otlp","llm", "tracing", "openai", "anthropic", "claude", "cohere", "llm monitoring", "observability", "monitoring", "gpt", "Generative AI", "chatGPT"][tool.poetry.dependencies]diff --git a/.gitignore b/.gitignoreindex 8ebdfd23..6597ade3 100644--- a/.gitignore+++ b/.gitignore@@ -1,6 +1,5 @@node_modulestest.py-test.go.DS_Storeyala.pyyala.ymldiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 85021a2b..097dc1d3 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,6 +1,6 @@-# Contributing to Doku+# Contributing to OpenLIT-We welcome contributions to the Doku project and are grateful for every contribution from bug reports to new features. If you are looking to contribute to the codebase, improve documentation, report issues, or suggest new features, this document is a set of guidelines to help you get started.+We welcome contributions to the OpenLIT project and are grateful for every contribution from bug reports to new features. If you are looking to contribute to the codebase, improve documentation, report issues, or suggest new features, this document is a set of guidelines to help you get started.## Getting Started@@ -11,16 +11,16 @@ Before you begin:## Contributing Workflow-Here's how you can contribute to Doku:+Here's how you can contribute to OpenLIT:1. **Fork the Repository**- - Click the "Fork" button at the top right corner of the [Doku repository](https://github.com/dokulabs/doku).+ - Click the "Fork" button at the top right corner of the [OpenLIT repository](https://github.com/openlit/openlit).2. **Clone the Forked Repository**- Clone your fork to your local machine:```- git clone https://github.com/YOUR_USERNAME/doku.git+ git clone https://github.com/YOUR_USERNAME/openlit.git```3. **Create Your Feature Branch**@@ -74,4 +74,4 @@ We are committed to fostering an open and welcoming environment. By participatinIf you have any questions or need further clarification about contributing, feel free to open an issue for discussion or ask for help on a specific topic.-Thank you for your interest in contributing to Doku!+Thank you for your interest in contributing to OpenLIT!diff --git a/README.md b/README.mdindex 84bec503..5e31291d 100644--- a/README.md+++ b/README.md@@ -1,20 +1,22 @@<div align="center">-<img src="https://github.com/dokulabs/.github/blob/main/profile/assets/wide-logo-no-bg.png?raw=true" alt="Doku Logo" width="30%"><h1>+<img src="https://github.com/openlit/.github/blob/main/profile/assets/wide-logo-no-bg.png?raw=true" alt="OpenLIT Logo" width="30%"><h1>OpenTelemetry-native LLM Application Observability</h1>-**[Documentation](https://docs.dokulabs.com/) | [Quickstart](#-getting-started-with-doku) | [Python SDK](https://github.com/dokulabs/doku/tree/main/sdk/python)**+**[Documentation](https://docs.openlit.io/) | [Quickstart](#-getting-started) | [Python SDK](https://github.com/openlit/openlit/tree/main/sdk/python)**-[](https://github.com/open-lit/openlit)-[](https://github.com/open-lit/openlit/blob/main/LICENSE)+[](https://github.com/openlit/openlit)+[](https://github.com/openlit/openlit/blob/main/LICENSE)[](https://pepy.tech/project/dokumetry)-[](https://github.com/open-lit/openlit/pulse)-[](https://github.com/open-lit/openlit/graphs/contributors)+[](https://github.com/openlit/openlit/pulse)+[](https://github.com/openlit/openlit/graphs/contributors)-[](https://join.slack.com/t/dokulabs/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)-[](https://twitter.com/doku_labs)+[](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)+[](https://twitter.com/openlit_io)</div>++OpenLIT is an **OpenTelemetry-native** GenAI and LLM Application Observability tool. It's designed to make the integration process of observability into GenAI projects as easy as pie β literally, with just **a single line of code**. Whether you're working with popular LLM Libraries such as OpenAI and HuggingFace or leveraging vector databases like ChromaDB, OpenLIT ensures your applications are monitored seamlessly, providing critical insights to improve performance and reliability.This project proudly follows the [Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/gen-ai) of the OpenTelemetry community, consistently updating to align with the latest standards in observability.@@ -22,7 +24,7 @@ This project proudly follows the [Semantic Conventions](https://github.com/open-## What is LIT?LIT stands for Learning Interpretability Tool. It refers to a visual, interactive model-understanding and data visualization tool ad a term introduced by [Google](https://developers.google.com/machine-learning/glossary#learning-interpretability-tool-lit).-## Features+## β‘ Features- **OpenTelemetry-native**: Native support ensures that integrating OpenLIT into your projects feels more like a natural extension rather than an additional layer of complexity.- **Granular Usage Insights of your LLM Applications**: Assess your LLM's performance and costs with fine-grained control, breaking down metrics by environment (such as staging or production) or application, to optimize for efficiency and scalability.- **Vendor-Neutral SDKs**: In the spirit of OpenTelemetry, OpenLIT's SDKs are agnostic of the backend vendors. This means you can confidently use OpenLIT with various telemetry backends, like Grafana Tempo, without worrying about compatibility issues.@@ -44,24 +46,46 @@ import openlitopenlit.init()```-This will Auto instrument you code for collecting LLM Observability data.--### Step 2: Send Telemetry to OTLP Backend-By default, OpenLIT directs traces and metrics straight to your console. To forward telemetry data to an HTTP OTLP endpoint, such as the OpenTelemetry Collector, set the `otlp_endpoint` parameter with the desired endpoint. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable as recommended in the OpenTelemetry documentation.To send telemetry to OpenTelemetry backends requiring authentication, set the `otlp_headers` parameter with its desired value. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_HEADERS` environment variable as recommended in the OpenTelemetry documentation.+#### Example+Here is how you can send telemetry from OpenLIT to Grafana Cloud-```+```pythonopenlit.init(otlp_endpoint="https://otlp-gateway-prod-us-east-0.grafana.net/otlp",otlp_headers="Authorization=Basic%20<base64 encoded Instance ID and API Token>")```-You can also choose to set these values using `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables+Alternatively, You can also choose to set these values using `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables++```python+openlit.init()+```++```env+export OTEL_EXPORTER_OTLP_ENDPOINT = "https://otlp-gateway-prod-us-east-0.grafana.net/otlp"+export OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Basic%20<base64 encoded Instance ID and API Token>"+```++### Step 3: Visualize and Optimize!+With the LLM Observability data now being collected and sent to your chosen OpenTelemetry backend, the next step is to visualize and analyze this data to glean insights into your application's performance, behavior, and identify areas of improvement. Here is how you would use the data in Grafana, follow these detailed instructions to explore your LLM application's Telemetry data.++ - Select the **Explore** option from Grafana's sidebar.+ - At the top, ensure the correct Tempo data source is selected from the dropdown menu.+ - Use the **Query** field to specify any particular traces you are interested in, or leave it empty to browse through all the available traces.+ - You can adjust the time range to focus on specific periods of interest.+ - Hit **Run Query** to fetch your trace data. You'll see a visual representation of your traces along with detailed information on particular spans when clicked.++#### Next Steps++- **Create Dashboards:** Beyond just exploring traces, consider creating dashboards in Grafana to monitor key performance indicators (KPIs) and metrics over time. Dashboards can be customized with various panels to display graphs, logs, and single stats that are most relevant to your application's performance and usage patterns.+- **Set Alerts:** Grafana also allows you to set up alerts based on specific thresholds. This feature can be invaluable in proactively managing your application's health by notifying you of potential issues before they impact users.+- **Iterate and Optimize:** Use the insights gained from your observability data to make informed decisions on optimizing your LLM application. This might involve refining model parameters, adjusting scaling strategies, or identifying and resolving bottlenecks.## π± Contributing@@ -77,9 +101,9 @@ Your input helps us grow and improve, and we're here to support you every step oConnect with the OpenLIT community and maintainers for support, discussions, and updates:-- π If you like it, Leave a star on our [GitHub](https://github.com/open-lit/openlit/)+- π If you like it, Leave a star on our [GitHub](https://github.com/openlit/openlit/)- π Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) Community for live interactions and questions.-- π Report bugs on our [GitHub Issues](https://github.com/open-lit/openlit/issues) to help us improve OpenLIT.+- π Report bugs on our [GitHub Issues](https://github.com/openlit/openlit/issues) to help us improve OpenLIT.- π Follow us on [X](https://twitter.com/openlit) for the latest updates and news.## License@@ -88,4 +112,4 @@ OpenLIT is available under the [Apache-2.0 license](LICENSE).## Visualize! Analyze! Optimize!-Join us on this voyage to reshape the future of AI Observability. Share your thoughts, suggest features, and explore contributions. Engage with us on [GitHub](https://github.com/open-lit/openlit) and be part of OpenLIT's community-led innovation.+Join us on this voyage to reshape the future of AI Observability. Share your thoughts, suggest features, and explore contributions. Engage with us on [GitHub](https://github.com/openlit/openlit) and be part of OpenLIT's community-led innovation.diff --git a/SECURITY.md b/SECURITY.mdindex 52192299..b9e2e901 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -2,7 +2,7 @@## Supported Versions-We are committed to maintaining the security of Doku and provide updates to address vulnerabilities. The following table shows which versions of our software currently receive security updates:+We are committed to maintaining the security of OpenLIT and provide updates to address vulnerabilities. The following table shows which versions of our software currently receive security updates:| Version | Supported | Notes ||---------|--------------------|-------------------------------------------------------------|@@ -12,16 +12,16 @@ We encourage all users to run the latest version for the best security and stabi## Reporting a Vulnerability-If you believe you have found a security vulnerability in Doku or any of its SDKs or components, we encourage you to report it to us through our GitHub repository. Follow these steps to submit a report:+If you believe you have found a security vulnerability in OpenLIT or any of its SDKs or components, we encourage you to report it to us through our GitHub repository. Follow these steps to submit a report:-1. **Open an Issue**: Navigate to the [Issues tab](https://github.com/dokulabs/doku/issues) in our GitHub repository and click on "New Issue".+1. **Open an Issue**: Navigate to the [Issues tab](https://github.com/openlit/openlit/issues) in our GitHub repository and click on "New Issue".2. **Describe in Detail**: Provide a thorough description of the vulnerability. This description should include steps to reproduce the issue and any potential impact.3. **Label the Issue**: Attach the "Security Vulnerability" label to your issue. This helps us quickly identify and prioritize security-related concerns.-4. **Await Our Response**: The Doku maintainers will review your report and respond as quickly as possible. We ask that you keep any communications regarding the potential vulnerability confidential until we've been able to investigate and address the issue.+4. **Await Our Response**: The OpenLIT maintainers will review your report and respond as quickly as possible. We ask that you keep any communications regarding the potential vulnerability confidential until we've been able to investigate and address the issue.5. **Updates**: We will provide status updates on the issue thread. Once resolved, we will acknowledge the contribution in the issue and any applicable release notes.-We appreciate your help in keeping Doku secure. With your support and responsible disclosure, we can work together to create a safer software ecosystem for everyone.+We appreciate your help in keeping OpenLIT secure. With your support and responsible disclosure, we can work together to create a safer software ecosystem for everyone.diff --git a/assets/.ingester.env.example b/assets/.ingester.env.exampledeleted file mode 100644index 21ac1aa7..00000000--- a/assets/.ingester.env.example+++ /dev/null@@ -1,5 +0,0 @@-export DOKU_DB_HOST="127.0.0.1"-export DOKU_DB_PORT="9000"-export DOKU_DB_NAME="<DB_NAME>"-export DOKU_DB_USER="<DB_USER>"-export DOKU_DB_PASSWORD="<DB_PASSWORD>"diff --git a/assets/.client.env.example b/assets/.openlit.env.examplesimilarity index 88%rename from assets/.client.env.examplerename to assets/.openlit.env.exampleindex 4ab7bc9c..4ac48988 100644--- a/assets/.client.env.example+++ b/assets/.openlit.env.example@@ -1,5 +1,5 @@export INIT_DB_HOST="127.0.0.1"-export INIT_DB_PORT="8123"+export INIT_DB_PORT="9000"export INIT_DB_DATABASE="<DB_NAME>"export INIT_DB_USERNAME="<DB_USER>"export INIT_DB_PASSWORD="<DB_PASSWORD>"diff --git a/assets/otel-collector-config.yaml b/assets/otel-collector-config.yamlindex ed967881..281f858f 100644--- a/assets/otel-collector-config.yaml+++ b/assets/otel-collector-config.yaml@@ -5,6 +5,7 @@ receivers:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318+processors:batch:memory_limiter:@@ -13,15 +14,17 @@ processors:# 25% of limit up to 2Gspike_limit_mib: 512check_interval: 5s+extensions:zpages: {}+exporters:clickhouse:- endpoint: tcp://146.190.11.107:9000?dial_timeout=10s- database: openlit- username: default- password: DOKU- ttl: 72h+ endpoint: tcp://${env:INIT_DB_HOST}:${env:INIT_DB_PORT}?dial_timeout=10s+ database: ${env:INIT_DB_DATABASE}+ username: ${env:INIT_DB_USERNAME}+ password: ${env:INIT_DB_PASSWORD}+ ttl: 730hlogs_table_name: otel_logstraces_table_name: otel_tracesmetrics_table_name: otel_metrics@@ -31,6 +34,7 @@ exporters:initial_interval: 5smax_interval: 30smax_elapsed_time: 300s+service:pipelines:logs:diff --git a/ch.py b/ch.pydeleted file mode 100644index c55c89b1..00000000--- a/ch.py+++ /dev/null@@ -1,28 +0,0 @@-# Display Tables in Clickhouse-from clickhouse_driver import Client--# Connect to Clickhouse-client = Client(host='146.190.11.107', user='default', password='DOKU', database='openlmt')--# Getting the list of existing tables-tables = client.execute('SHOW TABLES')--# Print the existing tables in the database-print("Existing tables in the database:")-for table in tables:- print(table[0])---# # Display data from table in Clickhouse-# from clickhouse_driver import Client--# client = Client(host='146.190.11.107, user='default', password='DOKU', database='openlmt')--# # Replace your_table_name with the name of your table-# query = "SELECT * FROM DOKU_APIKEYS"--# result = client.execute(query)--# # Print each row-# for row in result:-# print(row)\ No newline at end of filediff --git a/docker-compose.yml b/docker-compose.ymlindex 17ba550b..71851ac3 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -1,62 +1,57 @@version: '3.8'services:- # clickhouse:- # image: clickhouse/clickhouse-server:24.2.2- # container_name: clickhouse- # environment:- # CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- # CLICKHOUSE_USER: ${DOKU_DB_USER:-default}- # volumes:- # - clickhouse-data:/var/lib/clickhouse- # ports:- # - "9000:9000"- # - "8123:8123"- # restart: always-- # doku-ingester:- # image: ghcr.io/dokulabs/doku-ingester:latest- # container_name: doku-ingester- # environment:- # DOKU_DB_HOST: clickhouse- # DOKU_DB_PORT: 9000- # DOKU_DB_NAME: ${DOKU_DB_NAME:-default}- # DOKU_DB_USER: ${DOKU_DB_USER:-default}- # DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- # ports:- # - "9044:9044"- # depends_on:- # - clickhouse- # restart: always-- # doku-client:- # image: ghcr.io/dokulabs/doku-client:latest- # container_name: doku-client- # environment:- # INIT_DB_HOST: clickhouse- # INIT_DB_PORT: 8123- # INIT_DB_DATABASE: ${DOKU_DB_NAME:-default}- # INIT_DB_USERNAME: ${DOKU_DB_USER:-default}- # INIT_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- # SQLITE_DATABASE_URL: file:/app/client/data/data.db- # ports:- # - "3000:3000"- # depends_on:- # - clickhouse- # volumes:- # - doku-client-data:/app/client/data- # restart: always+ clickhouse:+ image: clickhouse/clickhouse-server:24.2.2+ container_name: clickhouse+ environment:+ CLICKHOUSE_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}+ CLICKHOUSE_USER: ${OPENLIT_DB_USER:-default}+ volumes:+ - clickhouse-data:/var/lib/clickhouse+ ports:+ - "9000:9000"+ - "8123:8123"+ restart: always+ openlit:+ image: ghcr.io/openlit/openlit-client:latest+ container_name: openlit+ environment:+ INIT_DB_HOST: clickhouse+ INIT_DB_PORT: 8123+ INIT_DB_DATABASE: ${OPENLIT_DB_NAME:-openlit}+ INIT_DB_USERNAME: ${OPENLIT_DB_USER:-default}+ INIT_DB_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}+ SQLITE_DATABASE_URL: file:/app/client/data/data.db+ ports:+ - "3000:3000"+ depends_on:+ - clickhouse+ volumes:+ - openlit-data:/app/client/data+ restart: always+otel-collector:image: otel/opentelemetry-collector-contrib:0.94.0+ container_name: otel-collector+ environment:+ INIT_DB_HOST: clickhouse+ INIT_DB_PORT: 8123+ INIT_DB_DATABASE: ${OPENLIT_DB_NAME:-openlit}+ INIT_DB_USERNAME: ${OPENLIT_DB_USER:-default}+ INIT_DB_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}ports:- "4317:4317"- "4318:4318"- "8888:8888"- "55679:55679"+ depends_on:+ - clickhousevolumes:- ./assets/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml+ restart: alwaysvolumes:clickhouse-data:- doku-client-data:\ No newline at end of file+ openlit-data:\ No newline at end of filediff --git a/docs/0.1/api-reference/endpoint/api-keys/create.mdx b/docs/0.1/api-reference/endpoint/api-keys/create.mdxdeleted file mode 100644index cce6cecf..00000000--- a/docs/0.1/api-reference/endpoint/api-keys/create.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: 'Create API Key'-openapi: 'POST /api/keys'----\ No newline at end of filediff --git a/docs/0.1/api-reference/endpoint/api-keys/delete.mdx b/docs/0.1/api-reference/endpoint/api-keys/delete.mdxdeleted file mode 100644index fbb9e963..00000000--- a/docs/0.1/api-reference/endpoint/api-keys/delete.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: 'Delete API Key'-openapi: 'DELETE /api/keys'----\ No newline at end of filediff --git a/docs/0.1/api-reference/endpoint/api-keys/get.mdx b/docs/0.1/api-reference/endpoint/api-keys/get.mdxdeleted file mode 100644index 0652d29d..00000000--- a/docs/0.1/api-reference/endpoint/api-keys/get.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: 'Get API Key'-openapi: 'GET /api/keys'----diff --git a/docs/0.1/api-reference/endpoint/connections/create.mdx b/docs/0.1/api-reference/endpoint/connections/create.mdxdeleted file mode 100644index bf65b9de..00000000--- a/docs/0.1/api-reference/endpoint/connections/create.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: 'Create Connection'-openapi: 'POST /api/connections'----\ No newline at end of filediff --git a/docs/0.1/api-reference/endpoint/connections/delete.mdx b/docs/0.1/api-reference/endpoint/connections/delete.mdxdeleted file mode 100644index db7b942d..00000000--- a/docs/0.1/api-reference/endpoint/connections/delete.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: 'Delete Connection'-openapi: 'DELETE /api/connections'----\ No newline at end of filediff --git a/docs/0.1/api-reference/endpoint/connections/get.mdx b/docs/0.1/api-reference/endpoint/connections/get.mdxdeleted file mode 100644index f3490035..00000000--- a/docs/0.1/api-reference/endpoint/connections/get.mdx+++ /dev/null@@ -1,6 +0,0 @@-----title: 'Get Connections'-openapi: 'GET /api/connections'------This functionality was introduced to the Doku Ingester in version `0.1.2`\ No newline at end of filediff --git a/docs/0.1/api-reference/introduction.mdx b/docs/0.1/api-reference/introduction.mdxdeleted file mode 100644index 2c6992e0..00000000--- a/docs/0.1/api-reference/introduction.mdx+++ /dev/null@@ -1,32 +0,0 @@-----title: 'Introduction'-description: 'OpenAPI specification for API Endpoints in Doku'-----<CardGroup cols={2}>- <Card- title="API Keys"- icon="key"- href="/0.1/api-reference/endpoint/api-keys/create"- >- </Card>- <Card- title="Connections API"- icon="link"- href="/0.1/api-reference/endpoint/connections/create"- >- </Card>-</CardGroup>--## Authentication--All API endpoints are authenticated using Authetication Header.--```json-Authorization: <api-key>-```--<Info>-For your initial API call to `/api/keys` endpoint, Authorization header can be set to "".--Store the provided API key securely; it will be required to pass the generated and a valid API Key in Authorization header for subsequent API calls.-</Info>\ No newline at end of filediff --git a/docs/0.1/api-reference/openiapi.yml b/docs/0.1/api-reference/openiapi.ymldeleted file mode 100644index 8771c604..00000000--- a/docs/0.1/api-reference/openiapi.yml+++ /dev/null@@ -1,216 +0,0 @@-openapi: 3.0.0-info:- title: API Keys Service- description: This service manages API keys through GET, POST, and DELETE operations.- version: "0.0.2"--servers:- - url: https://127.0.0.1:9044/--paths:- /api/connections:- post:- summary: Create a new connection- operationId: createConnection- tags:- - Connection- security:- - ApiKeyAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/ConnectionRequest'- responses:- '201':- description: Connection created- content:- application/json:- schema:- $ref: '#/components/schemas/json201Response'- delete:- summary: Delete a connection- operationId: deleteConnection- tags:- - Connection- security:- - ApiKeyAuth: []- responses:- '200':- description: Connection deleted- content:- application/json:- schema:- $ref: '#/components/schemas/json201Response'- get:- summary: Get Connections details- operationId: getConnection- tags:- - Connection- security:- - ApiKeyAuth: []- responses:- '200':- description: Connection details retrieved successfully- content:- application/json:- schema:- $ref: '#/components/schemas/ConnectionDetailsResponse'- '404':- description: Unauthorized request- content:- application/json:- schema:- $ref: '#/components/schemas/json401Response'- /api/keys:- get:- summary: Get a list of API keys- operationId: getApiKeys- tags:- - API Key- security:- - ApiKeyAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/APIKeyRequest'- responses:- '200':- description: A list of API keys- content:- application/json:- schema:- $ref: '#/components/schemas/json201Response'- post:- summary: Create a new API key- operationId: createApiKey- tags:- - API Key- security:- - ApiKeyAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/APIKeyRequest'- responses:- '201':- description: API key created- content:- application/json:- schema:- $ref: '#/components/schemas/json201Response'- delete:- summary: Delete an API key- operationId: deleteApiKey- tags:- - API Key- security:- - ApiKeyAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/APIKeyRequest'- responses:- '200':- description: API key deleted- content:- application/json:- schema:- $ref: '#/components/schemas/json201Response'--components:- schemas:- APIKeyRequest:- type: object- required:- - name- properties:- name:- type: string- description: Name of the API key to be created or deleted. Example - `BIGDADDY`- ConnectionRequest:- type: object- required:- - Platform- - MetricsUrl- - LogsUrl- - MetricsUsername- - LogsUsername- - ApiKey- properties:- Platform:- type: string- description: Name of the Observability Platform. Can be one of the following - `grafana`, `newrelic`, `datadog`, `dynatrace` and `signoz`- MetricsUrl:- type: string- description: URL of the metrics endpoint of the Observability Platform. Example - `https://api.datadoghq.com/api/v1/query`- LogsUrl:- type: string- description: URL of the logs endpoint of the Observability Platform. Example - `https://api.datadoghq.com/api/v1/query`- MetricsUsername:- type: string- description: Username for the metrics endpoint of the Observability Platform. Only required when Platform is passed as `grafana`.- LogsUsername:- type: string- description: Username for the logs endpoint of the Observability Platform. Only required when Platform is passed as `grafana`.- ApiKey:- type: string- description: API Key for the Observability Platform. Example - `glc*******`- ConnectionDetailsResponse:- type: object- properties:- connections:- type: object- properties:- apiKey:- type: string- created_at:- type: string- format: date-time- logsUrl:- type: string- logsUsername:- type: string- metricsUrl:- type: string- metricsUsername:- type: string- platform:- type: string- status:- type: integer- example: 200- json201Response:- type: object- required:- - status- - message- properties:- status:- type: integer- message:- type: string-- json401Response:- type: object- required:- - status- - message- properties:- status:- type: integer- message:- type: string-- securitySchemes:- ApiKeyAuth:- type: apiKey- in: header- name: Authorization\ No newline at end of filediff --git a/docs/0.1/configuration.mdx b/docs/0.1/configuration.mdxdeleted file mode 100644index 429aaf3a..00000000--- a/docs/0.1/configuration.mdx+++ /dev/null@@ -1,203 +0,0 @@-----title: 'Configuration'-description: 'Configuring Options for Doku'-icon: 'sliders'------This guide covers all the available environment variables to fine-tune Doku according to your needs.--## Doku Client--### Environment Varibales--<ResponseField name="INIT_DB_HOST" required>- Sets the host address of the ClickHouse server for Doku Client to connect-- **Example**:- ```yaml- export INIT_DB_HOST=127.0.0.1- ```-</ResponseField>--<ResponseField name="INIT_DB_PORT" required>- Sets the port on which ClickHouse listens-- **Example**:- ```yaml- export INIT_DB_PORT=8123- ```-</ResponseField>--<ResponseField name="INIT_DB_DATABASE" required>- Sets the name of the database in Clickhouse to be used by Doku-- **Example**:- ```yaml- export INIT_DB_DATABASE=default- ```-</ResponseField>--<ResponseField name="INIT_DB_USERNAME" required>- Sets the username for authenticating with ClickHouse-- **Example**:- ```yaml- export INIT_DB_USERNAME=default- ```-</ResponseField>--<ResponseField name="INIT_DB_PASSWORD" required>- Sets the password for authenticating with ClickHouse-- **Example**:- ```yaml- export INIT_DB_PASSWORD=default- ```-</ResponseField>--<ResponseField name="SQLITE_DATABASE_URL" required>- Sets the location where SQLITE data is stored.-- **Example**:- ```yaml- export SQLITE_DATABASE_URL=file:/app/client/data/data.db- ```-</ResponseField>--### Sample Environment File (.env)--```.env.example .env-INIT_DB_HOST="127.0.0.1"-INIT_DB_PORT="8123"-INIT_DB_DATABASE="default"-INIT_DB_USERNAME="default"-INIT_DB_PASSWORD="DOKU"-SQLITE_DATABASE_URL="file:/app/client/data/data.db"-```--## Doku Ingester--### Environment Varibales--<ResponseField name="DOKU_DB_HOST" required>- Sets the host address of the ClickHouse server for Doku Ingester to connect-- **Example**:- ```yaml- export DOKU_DB_HOST=127.0.0.1- ```-</ResponseField>--<ResponseField name="DOKU_DB_PORT" required>- Sets the port on which ClickHouse listens-- **Example**:- ```yaml- export DOKU_DB_PORT=9000- ```-</ResponseField>--<ResponseField name="DOKU_DB_NAME" required>- Sets the name of the database in Clickhouse to be used by Doku-- **Example**:- ```yaml- export DOKU_DB_NAME=default- ```-</ResponseField>--<ResponseField name="DOKU_DB_USER" required>- Sets the username for authenticating with ClickHouse-- **Example**:- ```yaml- export DOKU_DB_USER=default- ```-</ResponseField>--<ResponseField name="DOKU_DB_PASSWORD" required>- Sets the password for authenticating with ClickHouse-- **Example**:- ```yaml- export DOKU_DB_PASSWORD=DOKU- ```-</ResponseField>--<ResponseField name="DOKU_PRICING_JSON_URL">- Sets the URL of the json file containing the LLM Pricing data--**Default Value**:-```shell-https://raw.githubusercontent.com/dokulabs/ingester/main/assets/pricing.json-```--**Example**:-```yaml-export DOKU_PRICING_JSON_URL=https://raw.githubusercontent.com/dokulabs/ingester/main/assets/pricing.json- ```-</ResponseField>--<ResponseField name="DOKU_DB_MAX_IDLE_CONNS">- Sets the maximum number of concurrent idle database connections.--**Default Value**:-```shell-10-```--**Example**:-```shell-export DOKU_DB_MAX_IDLE_CONNS=10-```-</ResponseField>--<ResponseField name="DOKU_DB_MAX_OPEN_CONNS">- Sets the maximum number of concurrent open database connections.--**Default Value**:-```shell-20-```--**Example**:-```shell-export DOKU_DB_MAX_OPEN_CONNS=20-```-</ResponseField>--<ResponseField name="DOKU_DB_RETENTION_PERIOD">- Sets the TTL for data in Clickhouse.--**Default Value**:-```shell-6 MONTH-```--**Example**:-```shell-export DOKU_DB_RETENTION_PERIOD="6 MONTH"-```-</ResponseField>---### Sample Environment File (.env)--```.env.example .env-DOKU_DB_HOST="127.0.0.1"-DOKU_DB_PORT="9000"-DOKU_DB_NAME="default"-DOKU_DB_USER="default"-DOKU_DB_PASSWORD="DOKU"-```-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/datadog.mdx b/docs/0.1/connections/datadog.mdxdeleted file mode 100644index c5a44ba0..00000000--- a/docs/0.1/connections/datadog.mdx+++ /dev/null@@ -1,877 +0,0 @@-----title: 'DataDog'-description: 'LLM Observability with DataDog and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/datadog-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/datadog-dashboard-2.jpg?raw=true" />-</Frame>--Doku can automatically send LLM usage data from Doku to DataDog using the [Submit Metrics API](https://docs.datadoghq.com/api/latest/metrics/#submit-metrics) and [Send Logs API](https://docs.datadoghq.com/api/latest/logs/#send-logs)--Make the following curl request to Doku to add a connection for DataDog. See more on the [Connections API](/0.1/api-reference/endpoint/connections/create)--```shell-curl --request POST \- --url https://<YOUR_DOKU_INGESTER_URL>/api/connections \- --header 'Authorization: <DOKU_API_KEY>' \- --header 'Content-Type: application/json' \- --data '{- "Platform": "datadog",- "MetricsUrl": "<YOUR_DD_METRICS_URL>",- "LogsUrl": "<YOUR_DD_LOGS_URL>",- "ApiKey": "<YOUR_DD_API_KEY>"-}'-```--## DataDog Resources--<Accordion title="Dashboard">- ```json- {- "title": "Doku - LLM Monitoring",- "description": "Dashboard to monitor LLM Applications using Doku",- "widgets": [- {- "id": 2592087041529600,- "definition": {- "type": "image",- "url": "https://github.com/dokulabs/.github/blob/main/profile/assets/favicon.png?raw=true",- "sizing": "contain",- "has_background": false,- "has_border": false,- "vertical_align": "center",- "horizontal_align": "center"- },- "layout": {- "x": 0,- "y": 0,- "width": 12,- "height": 1- }- },- {- "id": 1254363734970878,- "definition": {- "title": "Avg Request Duration",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "response_format": "scalar",- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.request.duration{host:doku,$applicationname,$environment}",- "aggregator": "avg"- }- ],- "conditional_formats": [- {- "comparator": "<=",- "value": 10,- "palette": "white_on_green"- },- {- "comparator": ">",- "value": 10,- "palette": "white_on_red"- }- ],- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "second"- }- },- "formula": "query1"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "yaxis": {- "include_zero": false- },- "type": "area"- }- },- "layout": {- "x": 0,- "y": 1,- "width": 3,- "height": 2- }- },- {- "id": 5019934425891746,- "definition": {- "title": "Avg Total Tokens",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "response_format": "scalar",- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.total.tokens{host:doku,$applicationname,$environment}",- "aggregator": "avg"- }- ],- "conditional_formats": [- {- "comparator": "<=",- "value": 1000,- "palette": "white_on_green"- },- {- "comparator": ">",- "value": 1000,- "palette": "white_on_red"- }- ],- "formulas": [- {- "formula": "query1"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "type": "area"- }- },- "layout": {- "x": 3,- "y": 1,- "width": 3,- "height": 2- }- },- {- "id": 1292553433133982,- "definition": {- "title": "Avg Cost / Request",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "formulas": [- {- "formula": "query1",- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- }- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.usage.cost{host:doku,$applicationname,$environment}",- "aggregator": "max"- }- ],- "response_format": "scalar",- "conditional_formats": [- {- "comparator": ">",- "value": 0,- "palette": "custom_bg",- "custom_bg_color": "#5c7cff"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "yaxis": {- "include_zero": true- },- "type": "area"- }- },- "layout": {- "x": 6,- "y": 1,- "width": 3,- "height": 2- }- },- {- "id": 5207596770618026,- "definition": {- "title": "Total Cost",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "response_format": "scalar",- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment}",- "aggregator": "avg"- }- ],- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "type": "bars"- }- },- "layout": {- "x": 9,- "y": 1,- "width": 3,- "height": 2- }- },- {- "id": 7163232112237060,- "definition": {- "title": "Requests",- "title_size": "16",- "title_align": "left",- "show_legend": false,- "legend_layout": "auto",- "legend_columns": [- "avg",- "min",- "max",- "value",- "sum"- ],- "type": "timeseries",- "requests": [- {- "formulas": [- {- "formula": "query1"- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "count:doku.llm.request.duration{host:doku,$applicationname,$environment}"- }- ],- "response_format": "timeseries",- "style": {- "palette": "blue",- "line_type": "solid",- "line_width": "normal"- },- "display_type": "line"- }- ]- },- "layout": {- "x": 0,- "y": 3,- "width": 12,- "height": 3- }- },- {- "id": 6530509092714956,- "definition": {- "title": "Usage cost by Category",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "scalar",- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1",- "limit": {- "count": 500,- "order": "desc"- }- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {generation}",- "aggregator": "avg"- }- ],- "style": {- "palette": "datadog16"- }- }- ],- "type": "sunburst",- "hide_total": true,- "legend": {- "type": "inline"- }- },- "layout": {- "x": 0,- "y": 6,- "width": 3,- "height": 3- }- },- {- "id": 8042116329904768,- "definition": {- "title": "Usage cost by Platform",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "scalar",- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1",- "limit": {- "count": 500,- "order": "desc"- }- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {platform}",- "aggregator": "avg"- }- ],- "style": {- "palette": "datadog16"- }- }- ],- "type": "sunburst",- "hide_total": true,- "legend": {- "type": "inline"- }- },- "layout": {- "x": 3,- "y": 6,- "width": 3,- "height": 3- }- },- {- "id": 6701701162130436,- "definition": {- "title": "Usage cost by Application",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "scalar",- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1",- "limit": {- "count": 500,- "order": "desc"- }- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {applicationname}",- "aggregator": "sum"- }- ],- "style": {- "palette": "datadog16"- }- }- ],- "type": "sunburst",- "hide_total": true,- "legend": {- "type": "inline"- }- },- "layout": {- "x": 6,- "y": 6,- "width": 3,- "height": 3- }- },- {- "id": 1437027828906050,- "definition": {- "title": "Usage cost by Environment",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "scalar",- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1",- "limit": {- "count": 500,- "order": "desc"- }- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {environment}",- "aggregator": "avg"- }- ],- "style": {- "palette": "datadog16"- }- }- ],- "type": "sunburst",- "hide_total": true,- "legend": {- "type": "inline"- }- },- "layout": {- "x": 9,- "y": 6,- "width": 3,- "height": 3- }- },- {- "id": 2402383159288882,- "definition": {- "title": "Avg Prompt Tokens",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "response_format": "scalar",- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.prompt.tokens{host:doku,$applicationname,$environment}",- "aggregator": "avg"- }- ],- "conditional_formats": [- {- "comparator": "<=",- "value": 1000,- "palette": "white_on_green"- },- {- "comparator": ">",- "value": 1000,- "palette": "white_on_red"- }- ],- "formulas": [- {- "formula": "query1"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "type": "area"- }- },- "layout": {- "x": 0,- "y": 9,- "width": 4,- "height": 1- }- },- {- "id": 1887750495626080,- "definition": {- "title": "Avg Token Usage",- "title_size": "16",- "title_align": "left",- "show_legend": true,- "legend_layout": "auto",- "legend_columns": [- "avg",- "min",- "max",- "value",- "sum"- ],- "type": "timeseries",- "requests": [- {- "formulas": [- {- "formula": "query1"- },- {- "formula": "query2"- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.prompt.tokens{host:doku,$applicationname,$environment}"- },- {- "data_source": "metrics",- "name": "query2",- "query": "avg:doku.llm.completion.tokens{host:doku,$applicationname,$environment}"- }- ],- "response_format": "timeseries",- "style": {- "palette": "dog_classic",- "line_type": "solid",- "line_width": "normal"- },- "display_type": "line"- }- ]- },- "layout": {- "x": 4,- "y": 9,- "width": 8,- "height": 2- }- },- {- "id": 8227251321537566,- "definition": {- "title": "Avg Completion Tokens",- "title_size": "16",- "title_align": "left",- "type": "query_value",- "requests": [- {- "response_format": "scalar",- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.completion.tokens{host:doku,$applicationname,$environment}",- "aggregator": "avg"- }- ],- "conditional_formats": [- {- "comparator": "<=",- "value": 1000,- "palette": "white_on_green"- },- {- "comparator": ">",- "value": 1000,- "palette": "white_on_red"- }- ],- "formulas": [- {- "formula": "query1"- }- ]- }- ],- "autoscale": true,- "precision": 2,- "timeseries_background": {- "type": "area"- }- },- "layout": {- "x": 0,- "y": 10,- "width": 4,- "height": 1- }- },- {- "id": 3302397057575330,- "definition": {- "title": "Top Models by Usage",- "title_size": "16",- "title_align": "left",- "type": "toplist",- "requests": [- {- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "sum:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {model}",- "aggregator": "avg"- }- ],- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1",- "limit": {- "count": 5,- "order": "desc"- }- }- ],- "response_format": "scalar"- }- ],- "style": {- "display": {- "type": "stacked",- "legend": "automatic"- }- }- },- "layout": {- "x": 0,- "y": 11,- "width": 4,- "height": 3- }- },- {- "id": 2328926103668336,- "definition": {- "title": "Avg Cost by Models",- "title_size": "16",- "title_align": "left",- "show_legend": true,- "legend_layout": "horizontal",- "legend_columns": [- "avg",- "min",- "max",- "value",- "sum"- ],- "type": "timeseries",- "requests": [- {- "formulas": [- {- "number_format": {- "unit": {- "type": "canonical_unit",- "unit_name": "dollar"- }- },- "formula": "query1"- }- ],- "queries": [- {- "data_source": "metrics",- "name": "query1",- "query": "avg:doku.llm.usage.cost{host:doku,$applicationname,$environment} by {model}"- }- ],- "response_format": "timeseries",- "style": {- "palette": "dog_classic",- "line_type": "solid",- "line_width": "normal"- },- "display_type": "line"- }- ]- },- "layout": {- "x": 4,- "y": 11,- "width": 8,- "height": 3- }- },- {- "id": 6390170780704056,- "definition": {- "title": "Prompt",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "event_list",- "query": {- "data_source": "logs_stream",- "query_string": "host:doku type:prompt $applicationname $environment",- "indexes": [],- "storage": "hot"- },- "columns": [- {- "field": "status_line",- "width": "auto"- },- {- "field": "timestamp",- "width": "auto"- },- {- "field": "content",- "width": "compact"- }- ]- }- ],- "type": "list_stream"- },- "layout": {- "x": 0,- "y": 14,- "width": 6,- "height": 5- }- },- {- "id": 8605893614511422,- "definition": {- "title": "Response",- "title_size": "16",- "title_align": "left",- "requests": [- {- "response_format": "event_list",- "query": {- "data_source": "logs_stream",- "query_string": "host:doku $applicationname type:(response OR image) $environment",- "indexes": [],- "storage": "hot"- },- "columns": [- {- "field": "status_line",- "width": "auto"- },- {- "field": "timestamp",- "width": "auto"- },- {- "field": "content",- "width": "compact"- }- ]- }- ],- "type": "list_stream"- },- "layout": {- "x": 6,- "y": 14,- "width": 6,- "height": 5- }- }- ],- "template_variables": [- {- "name": "applicationname",- "prefix": "applicationname",- "available_values": [],- "default": "*"- },- {- "name": "environment",- "prefix": "environment",- "available_values": [],- "default": "*"- }- ],- "layout_type": "ordered",- "notify_list": [],- "reflow_type": "fixed"- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/dynatrace.mdx b/docs/0.1/connections/dynatrace.mdxdeleted file mode 100644index 0f74a591..00000000--- a/docs/0.1/connections/dynatrace.mdx+++ /dev/null@@ -1,1773 +0,0 @@-----title: 'Dynatrace'-description: 'LLM Observability with Dynatrace and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/dynatrace-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/dynatrace-dashboard-2.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/dynatrace-dsahboard-3.jpg?raw=true" />-</Frame>--Doku can automatically send LLM usage data from Doku to Dynatrace using the [Ingest Metrics API](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/post-ingest-metrics) and [Ingest Logs API](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/log-monitoring-v2/post-ingest-logs)--Make the following curl request to Doku to add a connection for Dynatrace. See more on the [Connections API](/0.1/api-reference/endpoint/connections/create)--```shell-curl --request POST \- --url https://<YOUR_DOKU_INGESTER_URL>/api/connections \- --header 'Authorization: <DOKU_API_KEY>' \- --header 'Content-Type: application/json' \- --data '{- "Platform": "dynatrace",- "MetricsUrl": "<YOUR_DYNATRACE_METRICS_URL>",- "LogsUrl": "<YOUR_DYNATRACE_LOGS_URL>",- "ApiKey": "<YOUR_DYNATRACE_API_KEY>"-}'-```--## Dynatrace Resources--<Accordion title="Dashboard">- ```json- {- "version": 13,- "variables": [],- "tiles": {- "1": {- "type": "data",- "title": "",- "query": "fetch logs\n| filter type == \"prompt\"\n| limit 20",- "queryConfig": {- "limit": 20,- "additionalFilters": {- "type": [- {- "criteria": "equals",- "expression": "prompt"- }- ]- },- "version": "4.0.1",- "datatype": "logs",- "log.source": [- {- "criteria": "contains",- "expression": ""- }- ],- "content": [- {- "criteria": "contains",- "expression": ""- }- ]- },- "subType": "dql-builder-logs",- "visualization": "table",- "visualizationSettings": {- "thresholds": [],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "timestamp",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "default",- "enableSparklines": false,- "hiddenColumns": [- [- "event.type"- ],- [- "loglevel"- ],- [- "status"- ],- [- "dt.auth.origin"- ],- [- "custom.attribute"- ],- [- "type"- ],- [- "endpoint"- ],- [- "environment"- ],- [- "generation"- ],- [- "job"- ],- [- "platform"- ],- [- "source"- ],- [- "cost"- ],- [- "application"- ]- ],- "lineWrapIds": [- [- "timestamp"- ],- [- "content"- ],- [- "event.type"- ],- [- "loglevel"- ],- [- "status"- ],- [- "application"- ],- [- "cost"- ],- [- "dt.auth.origin"- ],- [- "endpoint"- ],- [- "environment"- ],- [- "generation"- ],- [- "job"- ],- [- "model"- ],- [- "platform"- ],- [- "source"- ],- [- "type"- ]- ],- "columnWidths": {- "[\"timestamp\"]": 105,- "[\"application\"]": 113,- "[\"cost\"]": 75,- "[\"content\"]": 383- },- "colorThresholdTarget": "background",- "sortBy": {- "columnId": "[\"timestamp\"]",- "direction": "descending"- }- }- }- },- "2": {- "type": "data",- "title": "",- "query": "fetch logs\n| filter type != \"prompt\"\n| limit 20",- "queryConfig": {- "limit": 20,- "additionalFilters": {- "type": [- {- "criteria": "not-equals",- "expression": "prompt"- }- ]- },- "version": "4.0.1",- "datatype": "logs",- "log.source": [- {- "criteria": "contains",- "expression": ""- }- ],- "content": [- {- "criteria": "contains",- "expression": ""- }- ]- },- "subType": "dql-builder-logs",- "visualization": "table",- "visualizationSettings": {- "thresholds": [],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "timestamp",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "default",- "enableSparklines": false,- "hiddenColumns": [- [- "event.type"- ],- [- "loglevel"- ],- [- "status"- ],- [- "dt.auth.origin"- ],- [- "custom.attribute"- ],- [- "type"- ],- [- "endpoint"- ],- [- "environment"- ],- [- "generation"- ],- [- "job"- ],- [- "platform"- ],- [- "source"- ],- [- "cost"- ],- [- "application"- ]- ],- "lineWrapIds": [- [- "timestamp"- ],- [- "content"- ],- [- "event.type"- ],- [- "loglevel"- ],- [- "status"- ],- [- "application"- ],- [- "cost"- ],- [- "dt.auth.origin"- ],- [- "endpoint"- ],- [- "environment"- ],- [- "generation"- ],- [- "job"- ],- [- "model"- ],- [- "platform"- ],- [- "source"- ],- [- "type"- ]- ],- "columnWidths": {- "[\"timestamp\"]": 104,- "[\"application\"]": 113,- "[\"cost\"]": 75,- "[\"content\"]": 413- },- "colorThresholdTarget": "background",- "sortBy": {- "columnId": "[\"timestamp\"]",- "direction": "descending"- }- }- }- },- "7": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.request.duration, rollup: count)\n| sort arrayAvg(duration) desc\n| limit 20\n| fieldsAdd duration.single_value=arraySum(duration)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540"- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f"- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a"- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [- "duration.single_value"- ],- "fields": [],- "values": []- }- },- "singleValue": {- "showLabel": true,- "recordField": "duration.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": true,- "variant": "area",- "record": "duration",- "visible": true,- "isVisible": true,- "color": {- "Default": "var(--dt-colors-charts-categorical-color-01-default, #134fc9)"- }- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false- },- "label": "Total Requests",- "colorThresholdTarget": "value",- "alignment": "center"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- }- }- },- "14": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.request.duration)\n| fieldsAdd duration.single_value=arrayAvg(duration)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540"- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f"- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a"- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [- "duration.single_value"- ],- "fields": [],- "values": []- },- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "recordField": "duration.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": false,- "variant": "area",- "record": "duration",- "visible": true- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false- },- "label": "Avg Request Duration"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "duration.single_value",- "unitCategory": "time",- "baseUnit": "second",- "displayUnit": null,- "decimals": 3,- "suffix": "",- "delimiter": false,- "added": 1707910354866- }- ]- }- },- "15": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.total.tokens)\n| fieldsAdd duration.single_value=arrayAvg(duration)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540"- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f"- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a"- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [- "duration.single_value"- ],- "fields": [],- "values": []- },- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "recordField": "duration.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": false,- "variant": "area",- "record": "duration",- "visible": true- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false- },- "label": "Avg Tokens / Request"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- }- }- },- "17": {- "type": "data",- "title": "",- "query": "timeseries cost=sum(doku.llm.usage.cost)\n| sort arraySum(cost) desc\n| limit 20\n| fieldsAdd cost.single_value=arraySum(cost)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "cost"- ],- "leftAxisDimensions": [- "cost.single_value"- ],- "fields": [],- "values": []- }- },- "singleValue": {- "showLabel": true,- "recordField": "cost.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": false,- "variant": "area",- "record": "cost",- "visible": true,- "isVisible": true- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false,- "isRelative": true,- "isInverseTrend": false- },- "colorThresholdTarget": "value",- "alignment": "center",- "label": "Total Cost"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost.single_value",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": "usd",- "decimals": 3,- "suffix": "",- "delimiter": true,- "added": 1707910304797- }- ]- }- },- "19": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.request.duration, rollup: count)\n| sort arrayAvg(duration) desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "areaChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "legend": {- "hidden": true- },- "leftYAxisSettings": {- "min": "auto",- "max": "data-max",- "label": "Requests"- },- "categoricalBarChartSettings": {- "layout": "horizontal"- },- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [],- "fields": [],- "values": []- },- "seriesOverrides": []- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": []- }- },- "21": {- "type": "data",- "title": "Usage Cost by Category",- "query": "timeseries cost=avg(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { generation, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "pieChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "absolute",- "hideLabels": true,- "groupingName": null- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "generation",- "categoryAxisLabel": "generation",- "valueAxis": "cost",- "valueAxisLabel": "cost"- },- "legend": {- "position": "bottom",- "hidden": false- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": "usd",- "decimals": 4,- "suffix": "",- "delimiter": true,- "added": 1707908592897- }- ]- }- },- "22": {- "type": "data",- "title": "Usage Cost by Platform",- "query": "timeseries cost=avg(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { platform, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "pieChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "relative",- "hideLabels": false- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "platform",- "categoryAxisLabel": "platform",- "valueAxis": "cost",- "valueAxisLabel": "cost"- },- "legend": {- "position": "bottom",- "hidden": false- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "interval",- "unitCategory": "time",- "baseUnit": "nanosecond",- "displayUnit": "usd",- "decimals": 4,- "suffix": "",- "delimiter": true,- "added": 1707908592897- }- ]- }- },- "23": {- "type": "data",- "title": "Usage Cost by Application",- "query": "timeseries cost=avg(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { application, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "pieChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "relative",- "hideLabels": false- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "application",- "categoryAxisLabel": "application",- "valueAxis": "cost",- "valueAxisLabel": "cost"- },- "legend": {- "position": "bottom",- "hidden": false- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": "usd",- "decimals": 4,- "suffix": "",- "delimiter": true,- "added": 1707908592897- }- ]- }- },- "24": {- "type": "data",- "title": "Usage Cost by Environment",- "query": "timeseries cost=avg(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { environment, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "pieChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "relative",- "hideLabels": false- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "environment",- "categoryAxisLabel": "environment",- "valueAxis": "cost",- "valueAxisLabel": "cost"- },- "legend": {- "position": "bottom",- "hidden": false- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": "usd",- "decimals": 4,- "suffix": "",- "delimiter": true,- "added": 1707908592897- }- ]- }- },- "25": {- "type": "data",- "title": "",- "query": "timeseries completionTokens=avg(doku.llm.completion.tokens)\n| sort arrayAvg(completionTokens)\n| append [timeseries promptTokens=avg(doku.llm.prompt.tokens)\n | sort arrayAvg(promptTokens)]",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "areaChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "legend": {- "hidden": false,- "position": "bottom"- },- "leftYAxisSettings": {- "label": ""- },- "categoricalBarChartSettings": {- "layout": "horizontal"- },- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "completionTokens",- "promptTokens"- ],- "leftAxisDimensions": [],- "fields": [],- "values": []- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "error",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- }- }- },- "26": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.prompt.tokens)\n| fieldsAdd duration.single_value=arrayAvg(duration)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540"- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f"- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a"- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [- "duration.single_value"- ],- "fields": [],- "values": []- },- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "recordField": "duration.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": false,- "variant": "area",- "record": "duration",- "visible": true- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false- },- "label": "Avg Prompt Tokens / Request"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- }- }- },- "27": {- "type": "data",- "title": "",- "query": "timeseries duration=avg(doku.llm.completion.tokens)\n| fieldsAdd duration.single_value=arrayAvg(duration)",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "singleValue",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540"- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f"- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a"- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "relative",- "groupingThresholdValue": 0,- "valueType": "relative"- },- "categoryOverrides": {},- "fieldMapping": {- "timestamp": "timeframe",- "leftAxisValues": [- "duration"- ],- "leftAxisDimensions": [- "duration.single_value"- ],- "fields": [],- "values": []- },- "categoricalBarChartSettings": {}- },- "singleValue": {- "showLabel": true,- "recordField": "duration.single_value",- "autoscale": true,- "sparklineSettings": {- "showTicks": false,- "variant": "area",- "record": "duration",- "visible": true- },- "trend": {- "visible": true,- "relative": true,- "isVisible": false- },- "label": "Avg Completion Tokens / Request"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- }- }- },- "28": {- "type": "data",- "title": "Top Models by Cost",- "query": "timeseries cost=sum(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { model, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "categoricalBarChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "relative",- "hideLabels": false- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "model",- "categoryAxisLabel": "model",- "valueAxis": [- "cost"- ],- "valueAxisLabel": "cost",- "layout": "horizontal",- "categoryAxisTickLayout": "horizontal",- "colorPaletteMode": "multi-color"- },- "legend": {- "hidden": true- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": null,- "decimals": 3,- "suffix": "",- "delimiter": false,- "added": 1707910273820- }- ]- }- },- "29": {- "type": "data",- "title": "Usage Cost by Platform",- "query": "timeseries cost=avg(doku.llm.usage.cost), by: { generation, endpoint, environment, finish_reason, application, model, source, job, platform }\n| fieldsAdd cost=arrayAvg(cost)\n| summarize { cost=avg(cost) } , by: { model, interval, timeframe }\n| sort cost desc\n| limit 20",- "davis": {- "enabled": false,- "davisVisualization": {- "isAvailable": true- }- },- "visualization": "areaChart",- "visualizationSettings": {- "thresholds": [- {- "id": "0",- "title": "",- "field": "",- "rules": [- {- "id": "0",- "label": "",- "comparator": "β₯",- "color": "#7dc540",- "value": 0- },- {- "id": "1",- "label": "",- "comparator": "β₯",- "color": "#f5d30f",- "value": 5- },- {- "id": "2",- "label": "",- "comparator": "β₯",- "color": "#dc172a",- "value": 10- }- ],- "isEnabled": true- }- ],- "chartSettings": {- "gapPolicy": "connect",- "circleChartSettings": {- "groupingThresholdType": "absolute",- "groupingThresholdValue": 0,- "valueType": "relative",- "hideLabels": false- },- "categoryOverrides": {},- "categoricalBarChartSettings": {- "categoryAxis": "model",- "categoryAxisLabel": "model",- "valueAxis": "cost",- "valueAxisLabel": "cost",- "layout": "horizontal",- "categoryAxisTickLayout": "horizontal"- },- "legend": {- "hidden": true- },- "fieldMapping": {- "leftAxisValues": [- "cost"- ],- "rightAxisValues": [],- "leftAxisDimensions": [- "model"- ]- }- },- "singleValue": {- "showLabel": true,- "label": "",- "prefixIcon": "",- "recordField": "generation",- "autoscale": true,- "alignment": "center",- "colorThresholdTarget": "value"- },- "table": {- "rowDensity": "condensed",- "enableSparklines": false,- "hiddenColumns": [],- "lineWrapIds": [],- "columnWidths": {}- },- "unitsOverrides": [- {- "identifier": "cost",- "unitCategory": "currency",- "baseUnit": "usd",- "displayUnit": null,- "decimals": 3,- "suffix": "",- "delimiter": false,- "added": 1707910273820- }- ]- }- }- },- "layouts": {- "1": {- "x": 0,- "y": 24,- "w": 12,- "h": 8- },- "2": {- "x": 12,- "y": 24,- "w": 12,- "h": 8- },- "7": {- "x": 0,- "y": 0,- "w": 6,- "h": 3- },- "14": {- "x": 6,- "y": 0,- "w": 6,- "h": 3- },- "15": {- "x": 12,- "y": 0,- "w": 6,- "h": 3- },- "17": {- "x": 18,- "y": 0,- "w": 6,- "h": 3- },- "19": {- "x": 0,- "y": 3,- "w": 24,- "h": 5- },- "21": {- "x": 0,- "y": 8,- "w": 6,- "h": 5- },- "22": {- "x": 6,- "y": 8,- "w": 6,- "h": 5- },- "23": {- "x": 18,- "y": 8,- "w": 6,- "h": 5- },- "24": {- "x": 12,- "y": 8,- "w": 6,- "h": 5- },- "25": {- "x": 7,- "y": 13,- "w": 17,- "h": 6- },- "26": {- "x": 0,- "y": 13,- "w": 7,- "h": 3- },- "27": {- "x": 0,- "y": 16,- "w": 7,- "h": 3- },- "28": {- "x": 0,- "y": 19,- "w": 11,- "h": 5- },- "29": {- "x": 11,- "y": 19,- "w": 13,- "h": 5- }- }- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/grafanacloud.mdx b/docs/0.1/connections/grafanacloud.mdxdeleted file mode 100644index 86eb4c73..00000000--- a/docs/0.1/connections/grafanacloud.mdx+++ /dev/null@@ -1,2365 +0,0 @@-----title: 'Grafana Cloud'-description: 'LLM Observability with Grafana Cloud and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/grafana-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/grafana-dashboard-2.jpg?raw=true" />-</Frame>--Doku can automatically send LLM usage data from Doku to Grafana Cloud using the [Grafana Cloud Influx Telegraf](https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-influxdb/push-from-telegraf/) and [Loki Push HTTP API](https://grafana.com/docs/loki/latest/reference/api/#push-log-entries-to-loki)--Make the following curl request to Doku to add a connection for Grafana Cloud. See more on the [Connections API](/0.1/api-reference/endpoint/connections/create)--```shell-curl --request POST \- --url https://<YOUR_DOKU_INGESTER_URL>/api/connections \- --header 'Authorization: <DOKU_API_KEY>' \- --header 'Content-Type: application/json' \- --data '{- "Platform": "grafana",- "MetricsUrl": "<YOUR_GRAFANA_CLOUD_INFLUX_TELEGRAF_URL>",- "MetricsUsername": "<YOUR_GRAFANA_CLOUD_PROMETHEUS_USERNAME>",- "LogsUrl": "<YOUR_GRAFANA_CLOUD_LOGS_URL>",- "LogsUsername": "<YOUR_GRAFANA_CLOUD_LOGS_USERNAME>",- "ApiKey": "<YOUR_GRAFANA_CLOUD_API_KEY>"-}'-```--## Grafana Resources--<Accordion title="Dashboard">- ```json- {- "annotations": {- "list": [- {- "builtIn": 1,- "datasource": {- "type": "grafana",- "uid": "-- Grafana --"- },- "enable": true,- "hide": true,- "iconColor": "rgba(0, 211, 255, 1)",- "name": "Annotations & Alerts",- "type": "dashboard"- }- ]- },- "editable": true,- "fiscalYearStartMonth": 0,- "graphTooltip": 0,- "id": 14,- "links": [- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Doku Documentation",- "tooltip": "",- "type": "link",- "url": "https://docs.dokulabs.com/"- },- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Doku Community",- "tooltip": "",- "type": "link",- "url": "https://dokulabs.slack.com/"- },- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Dokulabs GitHub",- "tooltip": "",- "type": "link",- "url": "https://github.com/dokulabs/"- }- ],- "liveNow": false,- "panels": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "gridPos": {- "h": 4,- "w": 11,- "x": 0,- "y": 0- },- "id": 23,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "---\n---\n---\n---\n---\n---",- "mode": "markdown"- },- "pluginVersion": "10.4.0-65875",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "gridPos": {- "h": 4,- "w": 2,- "x": 11,- "y": 0- },- "id": 2,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "",- "mode": "markdown"- },- "pluginVersion": "10.4.0-65875",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "gridPos": {- "h": 4,- "w": 11,- "x": 13,- "y": 0- },- "id": 22,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "---\n---\n---\n---\n---\n---",- "mode": "markdown"- },- "pluginVersion": "10.4.0-65875",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the total number of requests sent to Large Language Models (LLM) Platforms in the selected time interval.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 4- },- "id": 3,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT count(*) FROM DOKU\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "COUNT",- "parameters": [- {- "name": "environment",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Total Requests",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the average time taken to process each request by the Large Language Models (LLM), offering a snapshot of system performance and efficiency.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "s",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 6,- "y": 4- },- "id": 4,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT AVG(requestduration) FROM doku\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "requestduration",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Avg Request Duration",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "mean"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the average count of Total tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 1000- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 10,- "y": 4- },- "id": 5,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_totalTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT AVG(totaltokens) FROM doku\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Avg Tokens per Request",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "mean"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the average cost incurred per request to the LLM, helping monitor and optimize budget allocation for LLM usage.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 14,- "y": 4- },- "id": 6,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT AVG(usagecost) FROM doku \nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "usagecost",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Avg Cost / Request",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "mean"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the total cost on LLM requests over the selected period.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-BlPu"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- }- ]- },- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 18,- "y": 4- },- "id": 10,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT SUM(usagecost) FROM doku\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "SUM",- "parameters": [- {- "name": "usagecost",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Total Cost",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the count of API requests made to LLMs over the selected time.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-BlPu"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "series",- "axisGridShow": true,- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 54,- "gradientMode": "hue",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": false,- "lineInterpolation": "smooth",- "lineStyle": {- "dash": [- 10,- 10- ],- "fill": "dash"- },- "lineWidth": 2,- "pointSize": 5,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "always",- "spanNulls": true,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "fieldMinMax": false,- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 5,- "w": 24,- "x": 0,- "y": 7- },- "id": 17,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": false- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "count(count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval]))",- "format": "time_series",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "Requests",- "range": true,- "rawQuery": true,- "rawSql": "SELECT\n DATE_TRUNC('day', \"time\") AS \"time\",\n COUNT(endpoint) AS total_requests\nFROM \n doku\nWHERE\n $__timeFilter(\"time\")\nGROUP BY \n DATE_TRUNC('day', \"time\")\nORDER BY \n \"time\";",- "refId": "A",- "sql": {- "columns": [- {- "alias": "\"Prompt Tokens\"",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"time\"",- "parameters": [- {- "name": "\"time\"",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Completion Tokens\"",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Total Tokens\"",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Total Requests overtime",- "transformations": [],- "type": "timeseries"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel illustrates the distribution of LLM requests across different usage categories: Chat Generations, Embeddings, Image Generations, Audio Generations, and Fine Tuning. It visualizes the relative volume of requests, helping to identify which types of operations are most frequently performed and providing insights into usage patterns by category.",- "fieldConfig": {- "defaults": {- "color": {- "fixedColor": "blue",- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "none",- "unitScale": true- },- "overrides": [- {- "__systemRef": "hideSeriesFrom",- "matcher": {- "id": "byNames",- "options": {- "mode": "exclude",- "names": [- "Value (sum)",- "Chat"- ],- "prefix": "All except:",- "readOnly": true- }- },- "properties": [- {- "id": "custom.hideFrom",- "value": {- "legend": false,- "tooltip": false,- "viz": true- }- }- ]- }- ]- },- "gridPos": {- "h": 9,- "w": 6,- "x": 0,- "y": 12- },- "id": 12,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": true,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "allValues"- ],- "fields": "",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT \n category,\n CAST(COUNT(*) AS INTEGER) AS Requests,\n ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage\n FROM \n (\n SELECT \n CASE\n WHEN endpoint LIKE 'openai.chat%' THEN 'Chat'\n WHEN endpoint LIKE 'openai.completions%' THEN 'Chat'\n WHEN endpoint LIKE 'anthropic.messages%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.summarize%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.generate%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.chat%' THEN 'Chat'\n WHEN endpoint LIKE '%embed%' THEN 'Embeddings'\n WHEN endpoint LIKE 'openai.images%' THEN 'Image'\n WHEN endpoint LIKE 'openai.audio%' THEN 'Audio'\n WHEN endpoint LIKE 'openai.fine_tuning%' THEN 'Fine Tuning'\n END AS category,\n endpoint\n FROM doku\n WHERE $__timeFilter(time)\n ) AS subquery\n GROUP BY category",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "useBackend": false- }- ],- "title": "Usage by Category",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "generation": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "Displays the cost breakdown by provider (OpenAI, Cohere, Anthropic) for LLM requests, offering insights into financial deployment across different services.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 6,- "y": 12- },- "id": 16,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": true,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "allValues"- ],- "fields": "",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT\n CASE\n WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n END AS provider,\n SUM(usageCost) AS total_cost\nFROM\n doku\nWHERE $__timeFilter(time)\nGROUP BY\n provider\nORDER BY\n total_cost DESC;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "useBackend": false- }- ],- "title": "Usage cost by Provider",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "generation": {- "aggregations": []- },- "platform": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel presents a pie chart detailing the distribution of expenses for LLM requests by various applications. It shows how budget allocations are consumed by different applications, enabling a deeper understanding of cost drivers and facilitating cost optimization efforts.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 12,- "y": 12- },- "id": 24,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": true,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "allValues"- ],- "fields": "/.*/",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT\n CASE\n WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n END AS provider,\n SUM(usageCost) AS total_cost\nFROM\n doku\nWHERE $__timeFilter(time)\nGROUP BY\n provider\nORDER BY\n total_cost DESC;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "useBackend": false- }- ],- "title": "Usage cost by Application",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "applicationName": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "Visualizes the allocation of LLM request expenses across different environments, such as development, staging, and production. This breakdown helps in tracking and managing costs with respect to operational environments.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 18,- "y": 12- },- "id": 25,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": true,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "allValues"- ],- "fields": "/.*/",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT\n CASE\n WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n END AS provider,\n SUM(usageCost) AS total_cost\nFROM\n doku\nWHERE $__timeFilter(time)\nGROUP BY\n provider\nORDER BY\n total_cost DESC;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "useBackend": false- }- ],- "title": "Usage cost by Environment",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "applicationName": {- "aggregations": []- },- "environment": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the average count of Prompt tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-YlBl"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green"- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 21- },- "id": 9,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_promptTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT AVG(prompttokens) FROM doku WHERE \n $__timeFilter(\"time\")",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Avg Prompt Tokens / Request",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "mean"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "Provides a time-series analysis of token consumption for LLM requests, highlighting trends in usage intensity and complexity over time.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-BlYlRd"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "series",- "axisGridShow": true,- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 50,- "gradientMode": "hue",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": 86400000,- "lineInterpolation": "smooth",- "lineStyle": {- "dash": [- 10,- 10- ],- "fill": "dash"- },- "lineWidth": 1,- "pointSize": 6,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "always",- "spanNulls": true,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "fieldMinMax": false,- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green"- },- {- "color": "red",- "value": 80- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 18,- "x": 6,- "y": 21- },- "id": 11,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "avg(doku_llm_completionTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"})",- "format": "time_series",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "Completion Tokens",- "range": true,- "rawQuery": true,- "rawSql": "SELECT prompttokens AS \"Prompt Tokens\", \"time\" AS \"time\", completiontokens AS \"Completion Tokens\", totaltokens AS \"Total Tokens\" FROM doku",- "refId": "A",- "sql": {- "columns": [- {- "alias": "\"Prompt Tokens\"",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"time\"",- "parameters": [- {- "name": "\"time\"",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Completion Tokens\"",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Total Tokens\"",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "builder",- "expr": "avg(doku_llm_promptTokens)",- "format": "time_series",- "fullMetaSearch": false,- "hide": false,- "includeNullMetadata": true,- "legendFormat": "Prompt Tokens",- "range": true,- "rawQuery": true,- "rawSql": "SELECT prompttokens AS \"Prompt Tokens\", \"time\" AS \"time\", completiontokens AS \"Completion Tokens\", totaltokens AS \"Total Tokens\" FROM doku",- "refId": "B",- "sql": {- "columns": [- {- "alias": "\"Prompt Tokens\"",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"time\"",- "parameters": [- {- "name": "\"time\"",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Completion Tokens\"",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Total Tokens\"",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Token usage overtime",- "type": "timeseries"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "This panel shows the average count of Completion tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-BlPu"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green"- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 24- },- "id": 7,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "doku_llm_completionTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT AVG(completiontokens) FROM doku WHERE \n $__timeFilter(\"time\")",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Avg Completion Tokens / Request",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "mean"- ],- "operation": "aggregate"- },- "job": {- "aggregations": [],- "operation": "groupby"- }- }- }- }- ],- "type": "stat"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "Displays the frequency of model usage over time, identifying the most utilised models and showcasing usage trends across different periods",- "fieldConfig": {- "defaults": {- "color": {- "fixedColor": "purple",- "mode": "continuous-YlBl"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green"- },- {- "color": "red",- "value": 80- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 12,- "x": 0,- "y": 27- },- "id": 13,- "options": {- "displayMode": "lcd",- "maxVizHeight": 165,- "minVizHeight": 0,- "minVizWidth": 75,- "namePlacement": "left",- "orientation": "horizontal",- "reduceOptions": {- "calcs": [- "allValues"- ],- "fields": "",- "values": true- },- "showUnfilled": true,- "sizing": "auto",- "valueMode": "color"- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "topk(5,count by(model) (sum_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])))",- "format": "table",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "__auto",- "range": true,- "rawQuery": true,- "rawSql": "SELECT \n model,\n total_count,\n percentage_usage\nFROM \n (\n SELECT \n model,\n COUNT(*) AS total_count,\n ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage_usage\n FROM \n doku\n WHERE $__timeFilter(time)\n GROUP BY \n model\n ORDER BY \n percentage_usage DESC\n ) sub\nLIMIT 5;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [- {- "name": "model",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Top models by usage",- "transformations": [- {- "id": "groupBy",- "options": {- "fields": {- "Value": {- "aggregations": [- "sum"- ],- "operation": "aggregate"- },- "model": {- "aggregations": [],- "operation": "groupby"- }- }- }- },- {- "id": "sortBy",- "options": {- "fields": {},- "sort": [- {- "desc": true,- "field": "Value (sum)"- }- ]- }- }- ],- "type": "bargauge"- },- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "description": "Breaks down token usage across different LLM models, offering insights into which models are driving the highest token consumption.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "text",- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 23,- "gradientMode": "hue",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": false,- "lineInterpolation": "linear",- "lineStyle": {- "dash": [- 10,- 10- ],- "fill": "dash"- },- "lineWidth": 1,- "pointSize": 9,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "always",- "spanNulls": true,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green"- },- {- "color": "red",- "value": 80- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 12,- "x": 12,- "y": 27- },- "id": 14,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "disableTextWrap": false,- "editorMode": "code",- "expr": "sum_over_time(doku_llm_totalTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",- "format": "time_series",- "fullMetaSearch": false,- "includeNullMetadata": true,- "legendFormat": "{{model}}",- "range": true,- "rawQuery": true,- "rawSql": "SELECT \n DATE_TRUNC('day', \"time\") AS \"time\",\n model,\n COUNT(*) AS \"Model:\"\nFROM \n doku\nWHERE \n $__timeFilter(\"time\")\nGROUP BY \n 1, model\nORDER BY \n \"time\" ASC, model;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [- {- "name": "model",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku",- "useBackend": false- }- ],- "title": "Token usage by model",- "transformations": [],- "type": "timeseries"- },- {- "datasource": {- "type": "loki",- "uid": "grafanacloud-logs"- },- "description": "Displays a log of all prompt messages sent to the LLM, providing insights into the inputs and interactions leading up to LLM responses.",- "gridPos": {- "h": 8,- "w": 12,- "x": 0,- "y": 33- },- "id": 26,- "options": {- "dedupStrategy": "none",- "enableLogDetails": true,- "prettifyLogMessage": true,- "showCommonLabels": false,- "showLabels": false,- "showTime": true,- "sortOrder": "Descending",- "wrapLogMessage": false- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "loki",- "uid": "grafanacloud-logs"- },- "editorMode": "code",- "expr": "{job=\"doku\", type=\"prompt\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "hide": false,- "queryType": "range",- "refId": "B"- }- ],- "title": "Prompts",- "transformations": [- {- "id": "extractFields",- "options": {- "format": "auto",- "source": "labels"- }- }- ],- "transparent": true,- "type": "logs"- },- {- "datasource": {- "type": "loki",- "uid": "grafanacloud-logs"- },- "description": "Displays a log of all responses from the LLM, offering a comprehensive view of how the model interprets prompts and the information it generates.",- "gridPos": {- "h": 8,- "w": 12,- "x": 12,- "y": 33- },- "id": 27,- "options": {- "dedupStrategy": "none",- "enableLogDetails": true,- "prettifyLogMessage": true,- "showCommonLabels": false,- "showLabels": false,- "showTime": true,- "sortOrder": "Descending",- "wrapLogMessage": true- },- "pluginVersion": "10.4.0-65875",- "targets": [- {- "datasource": {- "type": "loki",- "uid": "grafanacloud-logs"- },- "editorMode": "code",- "expr": "{job=\"doku\", type=\"response\", applicationName=~\"$Application\", environment=~\"$Environment\"}",- "hide": false,- "queryType": "range",- "refId": "B"- }- ],- "title": "Responses",- "transformations": [- {- "id": "extractFields",- "options": {- "format": "auto",- "source": "labels"- }- }- ],- "transparent": true,- "type": "logs"- }- ],- "refresh": "",- "schemaVersion": 39,- "tags": [- "Doku",- "OpenAI",- "Cohere",- "Anthropic"- ],- "templating": {- "list": [- {- "current": {- "selected": true,- "text": [- "All"- ],- "value": [- "$__all"- ]- },- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "definition": "label_values(applicationName)",- "hide": 0,- "includeAll": true,- "label": "Application",- "multi": true,- "name": "Application",- "options": [],- "query": {- "qryType": 1,- "query": "label_values(applicationName)",- "refId": "PrometheusVariableQueryEditor-VariableQuery"- },- "refresh": 1,- "regex": "",- "skipUrlSync": false,- "sort": 0,- "type": "query"- },- {- "current": {- "selected": true,- "text": [- "All"- ],- "value": [- "$__all"- ]- },- "datasource": {- "type": "prometheus",- "uid": "grafanacloud-prom"- },- "definition": "label_values(environment)",- "hide": 0,- "includeAll": true,- "label": "Environment",- "multi": true,- "name": "Environment",- "options": [],- "query": {- "qryType": 1,- "query": "label_values(environment)",- "refId": "PrometheusVariableQueryEditor-VariableQuery"- },- "refresh": 1,- "regex": "",- "skipUrlSync": false,- "sort": 0,- "type": "query"- }- ]- },- "time": {- "from": "now-24h",- "to": "now"- },- "timepicker": {},- "timezone": "",- "title": "Doku - LLM Monitoring",- "uid": "doku-llm-monitoring",- "version": 1,- "weekStart": ""- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/grafanaoss.mdx b/docs/0.1/connections/grafanaoss.mdxdeleted file mode 100644index 1abff572..00000000--- a/docs/0.1/connections/grafanaoss.mdx+++ /dev/null@@ -1,1945 +0,0 @@-----title: 'Grafana OSS'-description: 'LLM Observability with Grafana and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/grafana-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/grafana-dashboard-3.jpg?raw=true" />-</Frame>--You can add the Doku's backend storage database (`ClickHouse`) as a datasource in Grafana.--## Steps--1. Navigate to your Grafana Instance.-1. Login with your credentials.-1. Click on the **Connection** on the left sidebar to open the **Add new connection**.-1. In the search box, type `ClickHouse` and then click `Install` button on the top right corner.-1. Click the **Add new data source** button on the top right corner.-1.In the settings form, fill in the details to connect to your ClickHouse database:- 1. **Server address**: Provide the host address of your ClickHouse Database (e.g., `127.0.0.1`).- 1. **Server port**: Provide the port of your ClickHouse Database (e.g., `9000`) and set protocol as `Native`- 1. **Username**: The username for the ClickHouse database. Default user used by Doku is `default`.- 1. **Password**: The password for the database. Default password used by Doku is `DOKU`.- 1. Under **Additional settings**- - Add **Default database**. Default database used by Doku is `default`.-1. Optionally customize the **Additional settings**.-1. Click the **Save & Test** button at the bottom of the page.--Grafana will attempt to connect to the database using the provided settings. If everything is configured correctly, you will see a message indicating the data source is working.--## Grafana Resources--<Accordion title="Dashboard">- ```json- {- "annotations": {- "list": [- {- "builtIn": 1,- "datasource": {- "type": "grafana",- "uid": "-- Grafana --"- },- "enable": true,- "hide": true,- "iconColor": "rgba(0, 211, 255, 1)",- "name": "Annotations & Alerts",- "type": "dashboard"- }- ]- },- "editable": true,- "fiscalYearStartMonth": 0,- "graphTooltip": 0,- "id": 1,- "links": [- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Doku Documentation",- "tooltip": "",- "type": "link",- "url": "https://grafana.com/docs/grafana/latest/"- },- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Doku Community",- "tooltip": "",- "type": "link",- "url": "https://dokulabs.slack.com/"- },- {- "icon": "info",- "tags": [],- "targetBlank": true,- "title": "Dokulabs GitHub",- "tooltip": "",- "type": "link",- "url": "https://github.com/dokulabs/"- }- ],- "liveNow": false,- "panels": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "gridPos": {- "h": 4,- "w": 11,- "x": 0,- "y": 0- },- "id": 23,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "---\n---\n---\n---\n---\n---",- "mode": "markdown"- },- "pluginVersion": "10.3.3",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "gridPos": {- "h": 4,- "w": 2,- "x": 11,- "y": 0- },- "id": 2,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "",- "mode": "markdown"- },- "pluginVersion": "10.3.3",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "gridPos": {- "h": 4,- "w": 11,- "x": 13,- "y": 0- },- "id": 22,- "options": {- "code": {- "language": "plaintext",- "showLineNumbers": false,- "showMiniMap": false- },- "content": "---\n---\n---\n---\n---\n---",- "mode": "markdown"- },- "pluginVersion": "10.3.3",- "transparent": true,- "type": "text"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the total number of requests sent to Large Language Models (LLM) Platforms in the selected time interval.",- "fieldConfig": {- "defaults": {- "color": {- "fixedColor": "yellow",- "mode": "continuous-BlPu"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 4- },- "id": 3,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT count(*) FROM DOKU_LLM_DATA\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "COUNT",- "parameters": [- {- "name": "environment",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Total Requests",- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the average time taken to process each request by the Large Language Models (LLM), offering a snapshot of system performance and efficiency.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "s",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 6,- "y": 4- },- "id": 4,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT AVG(requestDuration) FROM DOKU_LLM_DATA\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "requestduration",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Avg Request Duration",- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the average count of Total tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 1000- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 10,- "y": 4- },- "id": 5,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT AVG(totalTokens) FROM DOKU_LLM_DATA\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Avg Tokens per Request",- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the average cost incurred per request to the LLM, helping monitor and optimize budget allocation for LLM usage.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "thresholds"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 4,- "x": 14,- "y": 4- },- "id": 6,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT AVG(usageCost) FROM DOKU_LLM_DATA \nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "usagecost",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Avg Cost / Request",- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the total cost on LLM requests over the selected period.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-BlPu"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- }- ]- },- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 18,- "y": 4- },- "id": 10,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT SUM(usageCost) FROM DOKU_LLM_DATA\nWHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "name": "SUM",- "parameters": [- {- "name": "usagecost",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Total Cost",- "transparent": true,- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the count of API requests made to LLMs over the selected time.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic-by-name"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "series",- "axisGridShow": true,- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 100,- "gradientMode": "opacity",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": false,- "lineInterpolation": "linear",- "lineStyle": {- "dash": [- 10,- 10- ],- "fill": "dash"- },- "lineWidth": 2,- "pointSize": 5,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "always",- "spanNulls": false,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "fieldMinMax": false,- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 5,- "w": 24,- "x": 0,- "y": 7- },- "id": 17,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": false- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "format": "time_series",- "rawQuery": true,- "rawSql": "SELECT\n DATE_TRUNC('day', \"time\") AS \"time\",\n COUNT(endpoint) AS total_requests\nFROM \n DOKU_LLM_DATA\nWHERE\n $__timeFilter(\"time\")\nGROUP BY \n DATE_TRUNC('day', \"time\")\nORDER BY \n \"time\";",- "refId": "A",- "sql": {- "columns": [- {- "alias": "\"Prompt Tokens\"",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"time\"",- "parameters": [- {- "name": "\"time\"",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Completion Tokens\"",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Total Tokens\"",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Total Requests / Day",- "type": "timeseries"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel illustrates the distribution of LLM requests across different usage categories: Chat Generations, Embeddings, Image Generations, Audio Generations, and Fine Tuning. It visualizes the relative volume of requests, helping to identify which types of operations are most frequently performed and providing insights into usage patterns by category.\n\n",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 0,- "y": 12- },- "id": 12,- "options": {- "displayLabels": [- "name",- "percent"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": false,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [],- "fields": "/^requests$/",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT \n category,\n CAST(COUNT(*) AS INTEGER) AS Requests,\n ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage\n FROM \n (\n SELECT \n CASE\n WHEN endpoint LIKE 'openai.chat%' THEN 'Chat'\n WHEN endpoint LIKE 'openai.completions%' THEN 'Chat'\n WHEN endpoint LIKE 'anthropic.messages%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.summarize%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.generate%' THEN 'Chat'\n WHEN endpoint LIKE 'cohere.chat%' THEN 'Chat'\n WHEN endpoint LIKE '%embed%' THEN 'Embeddings'\n WHEN endpoint LIKE 'openai.images%' THEN 'Image'\n WHEN endpoint LIKE 'openai.audio%' THEN 'Audio'\n WHEN endpoint LIKE 'openai.fine_tuning%' THEN 'Fine Tuning'\n END AS category,\n endpoint\n FROM DOKU_LLM_DATA\n WHERE $__timeFilter(time)\n ) AS subquery\n GROUP BY category",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- }- }- ],- "title": "Usage by Category",- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Displays the cost breakdown by provider (OpenAI, Cohere, Anthropic) for LLM requests, offering insights into financial deployment across different services.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 6,- "y": 12- },- "id": 16,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": false,- "values": []- },- "pieType": "pie",- "reduceOptions": {- "calcs": [],- "fields": "/.*/",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "asc"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT\n CASE\n WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n END AS provider,\n SUM(usageCost) AS total_cost\nFROM\n DOKU_LLM_DATA\nWHERE $__timeFilter(time)\nGROUP BY\n provider\nORDER BY\n total_cost DESC;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- }- }- ],- "title": "Usage cost by Provider",- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel presents a pie chart detailing the distribution of expenses for LLM requests by various applications. It shows how budget allocations are consumed by different applications, enabling a deeper understanding of cost drivers and facilitating cost optimization efforts.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 12,- "y": 12- },- "id": 18,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": false- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "uniqueValues"- ],- "fields": "",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": " SELECT\n applicationName,\n sum(usageCost) AS \"usageCost\"\n FROM\n DOKU_LLM_DATA\n WHERE $__timeFilter(time)\n GROUP BY\n applicationName\n ORDER BY\n \"usageCost\" DESC",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- }- }- ],- "title": "Usage cost by Application",- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Visualizes the allocation of LLM request expenses across different environments, such as development, staging, and production. This breakdown helps in tracking and managing costs with respect to operational environments.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- }- },- "mappings": [],- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 9,- "w": 6,- "x": 18,- "y": 12- },- "id": 19,- "options": {- "displayLabels": [- "name",- "value"- ],- "legend": {- "displayMode": "list",- "placement": "bottom",- "showLegend": false- },- "pieType": "pie",- "reduceOptions": {- "calcs": [- "uniqueValues"- ],- "fields": "",- "values": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": " SELECT\n environment,\n sum(usageCost) AS \"usageCost\"\n FROM\n DOKU_LLM_DATA\n WHERE $__timeFilter(time)\n GROUP BY\n environment\n ORDER BY\n \"usageCost\" DESC",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- }- }- ],- "title": "Usage cost by Environment",- "transparent": true,- "type": "piechart"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the average count of Prompt tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-YlBl"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 21- },- "id": 9,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT AVG(promptTokens) FROM DOKU_LLM_DATA WHERE \n $__timeFilter(\"time\")",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Avg Prompt Tokens / Request",- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Provides a time-series analysis of token consumption for LLM requests, highlighting trends in usage intensity and complexity over time.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "series",- "axisGridShow": true,- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 10,- "gradientMode": "hue",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": 86400000,- "lineInterpolation": "linear",- "lineStyle": {- "fill": "solid"- },- "lineWidth": 1,- "pointSize": 5,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "never",- "spanNulls": true,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "fieldMinMax": false,- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 18,- "x": 6,- "y": 21- },- "id": 11,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT promptTokens AS \"Prompt Tokens\", \"time\" AS \"time\", completionTokens AS \"Completion Tokens\", totalTokens AS \"Total Tokens\" FROM DOKU_LLM_DATA",- "refId": "A",- "sql": {- "columns": [- {- "alias": "\"Prompt Tokens\"",- "parameters": [- {- "name": "prompttokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"time\"",- "parameters": [- {- "name": "\"time\"",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Completion Tokens\"",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "alias": "\"Total Tokens\"",- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Token usage",- "type": "timeseries"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "This panel shows the average count of Completion tokens used per LLM request",- "fieldConfig": {- "defaults": {- "color": {- "mode": "continuous-YlBl"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 5- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 3,- "w": 6,- "x": 0,- "y": 24- },- "id": 7,- "options": {- "colorMode": "background",- "graphMode": "area",- "justifyMode": "auto",- "orientation": "auto",- "reduceOptions": {- "calcs": [- "lastNotNull"- ],- "fields": "",- "values": false- },- "showPercentChange": false,- "textMode": "auto",- "wideLayout": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT AVG(completionTokens) FROM DOKU_LLM_DATA WHERE \n $__timeFilter(\"time\")",- "refId": "A",- "sql": {- "columns": [- {- "name": "AVG",- "parameters": [- {- "name": "completiontokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Avg Completion Tokens / Request",- "type": "stat"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Displays the frequency of model usage over time, identifying the most utilised models and showcasing usage trends across different periods",- "fieldConfig": {- "defaults": {- "color": {- "fixedColor": "purple",- "mode": "continuous-YlBl"- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unit": "none",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 12,- "x": 0,- "y": 27- },- "id": 13,- "options": {- "displayMode": "lcd",- "maxVizHeight": 167,- "minVizHeight": 10,- "minVizWidth": 75,- "namePlacement": "top",- "orientation": "horizontal",- "reduceOptions": {- "calcs": [- "sum"- ],- "fields": "/^total_count$/",- "values": true- },- "showUnfilled": true,- "sizing": "manual",- "valueMode": "text"- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT \n model,\n total_count,\n percentage_usage\nFROM \n (\n SELECT \n model,\n COUNT(*) AS total_count,\n ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage_usage\n FROM \n DOKU_LLM_DATA\n WHERE $__timeFilter(time)\n GROUP BY \n model\n ORDER BY \n percentage_usage DESC\n ) sub\nLIMIT 5;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [- {- "name": "model",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Top models by usage",- "type": "bargauge"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Breaks down token usage across different LLM models, offering insights into which models are driving the highest token consumption.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic"- },- "custom": {- "axisBorderShow": false,- "axisCenteredZero": false,- "axisColorMode": "text",- "axisLabel": "",- "axisPlacement": "auto",- "barAlignment": 0,- "drawStyle": "line",- "fillOpacity": 0,- "gradientMode": "none",- "hideFrom": {- "legend": false,- "tooltip": false,- "viz": false- },- "insertNulls": false,- "lineInterpolation": "linear",- "lineWidth": 1,- "pointSize": 5,- "scaleDistribution": {- "type": "linear"- },- "showPoints": "auto",- "spanNulls": false,- "stacking": {- "group": "A",- "mode": "none"- },- "thresholdsStyle": {- "mode": "off"- }- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 6,- "w": 12,- "x": 12,- "y": 27- },- "id": 14,- "options": {- "legend": {- "calcs": [],- "displayMode": "list",- "placement": "bottom",- "showLegend": true- },- "tooltip": {- "mode": "single",- "sort": "none"- }- },- "pluginVersion": "10.2.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT \n DATE_TRUNC('day', \"time\") AS \"time\",\n model,\n COUNT(*) AS \"Model:\"\nFROM \n DOKU_LLM_DATA\nWHERE \n $__timeFilter(\"time\")\nGROUP BY \n 1, model\nORDER BY \n \"time\" ASC, model;",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [- {- "name": "model",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "Model usage by day",- "type": "timeseries"- },- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "description": "Table showing prompts and responses along with their associated costs and token usage.",- "fieldConfig": {- "defaults": {- "color": {- "mode": "palette-classic-by-name"- },- "custom": {- "align": "center",- "cellOptions": {- "mode": "gradient",- "type": "color-background"- },- "filterable": true,- "inspect": true- },- "mappings": [],- "thresholds": {- "mode": "absolute",- "steps": [- {- "color": "green",- "value": null- },- {- "color": "red",- "value": 80- }- ]- },- "unit": "currencyUSD",- "unitScale": true- },- "overrides": []- },- "gridPos": {- "h": 8,- "w": 24,- "x": 0,- "y": 33- },- "id": 15,- "options": {- "cellHeight": "sm",- "footer": {- "countRows": false,- "fields": "",- "reducer": [- "sum"- ],- "show": false- },- "showHeader": true- },- "pluginVersion": "10.3.3",- "targets": [- {- "datasource": {- "type": "grafana-clickhouse-datasource",- "uid": "${datasource}"- },- "editorMode": "code",- "editorType": "sql",- "format": 1,- "meta": {},- "pluginVersion": "4.0.3",- "queryType": "table",- "rawQuery": true,- "rawSql": "SELECT \"time\", applicationName, model, prompt, response, usageCost FROM DOKU_LLM_DATA WHERE $__timeFilter(time)",- "refId": "A",- "sql": {- "columns": [- {- "parameters": [- {- "name": "endpoint",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "parameters": [- {- "name": "prompt",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "parameters": [- {- "name": "response",- "type": "functionParameter"- }- ],- "type": "function"- },- {- "parameters": [- {- "name": "totaltokens",- "type": "functionParameter"- }- ],- "type": "function"- }- ],- "groupBy": [- {- "property": {- "type": "string"- },- "type": "groupBy"- }- ],- "limit": 50- },- "table": "doku"- }- ],- "title": "User Activity",- "transparent": true,- "type": "table"- }- ],- "refresh": "",- "schemaVersion": 39,- "tags": [- "Doku",- "OpenAI",- "Cohere",- "Anthropic"- ],- "templating": {- "list": [- {- "current": {- "selected": false,- "text": "grafana-clickhouse-datasource",- "value": "ef07bf93-52b4-4c5d-adda-8a498d388510"- },- "hide": 0,- "includeAll": false,- "label": "Datasource",- "multi": false,- "name": "datasource",- "options": [],- "query": "grafana-clickhouse-datasource",- "queryValue": "",- "refresh": 1,- "regex": "",- "skipUrlSync": false,- "type": "datasource"- }- ]- },- "time": {- "from": "now-7d",- "to": "now"- },- "timepicker": {},- "timezone": "",- "title": "Doku - LLM Monitoring",- "uid": "doku-llm-monitoring",- "version": 3,- "weekStart": ""- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/intro.mdx b/docs/0.1/connections/intro.mdxdeleted file mode 100644index ed060e02..00000000--- a/docs/0.1/connections/intro.mdx+++ /dev/null@@ -1,34 +0,0 @@-----title: 'Connect to your existing Observablity Platform'-description: 'Send LLM Monitoring data to your Observablity Platform'-sidebarTitle: 'Introduction'-----Doku enhances observability by seamlessly exporting processed LLM data to your observability platform. This assists developers in bringing together all application-related data, including LLM usage metrics, on a unified platform, simplifying the visualization and assessment of the entire application ecosystem.--Below is a list of observability platforms that work seamlessly with Doku:--<CardGroup cols={2}>- <Card title="Grafana OSS" href="/0.1/connections/grafanaoss" icon={<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Grafana</title><path d="M23.02 10.59a8.578 8.578 0 0 0-.862-3.034 8.911 8.911 0 0 0-1.789-2.445c.337-1.342-.413-2.505-.413-2.505-1.292-.08-2.113.4-2.416.62-.052-.02-.102-.044-.154-.064-.22-.089-.446-.172-.677-.247-.231-.073-.47-.14-.711-.197a9.867 9.867 0 0 0-.875-.161C14.557.753 12.94 0 12.94 0c-1.804 1.145-2.147 2.744-2.147 2.744l-.018.093c-.098.029-.2.057-.298.088-.138.042-.275.094-.413.143-.138.055-.275.107-.41.166a8.869 8.869 0 0 0-1.557.87l-.063-.029c-2.497-.955-4.716.195-4.716.195-.203 2.658.996 4.33 1.235 4.636a11.608 11.608 0 0 0-.607 2.635C1.636 12.677.953 15.014.953 15.014c1.926 2.214 4.171 2.351 4.171 2.351.003-.002.006-.002.006-.005.285.509.615.994.986 1.446.156.19.32.371.488.548-.704 2.009.099 3.68.099 3.68 2.144.08 3.553-.937 3.849-1.173a9.784 9.784 0 0 0 3.164.501h.08l.055-.003.107-.002.103-.005.003.002c1.01 1.44 2.788 1.646 2.788 1.646 1.264-1.332 1.337-2.653 1.337-2.94v-.058c0-.02-.003-.039-.003-.06.265-.187.52-.387.758-.6a7.875 7.875 0 0 0 1.415-1.7c1.43.083 2.437-.885 2.437-.885-.236-1.49-1.085-2.216-1.264-2.354l-.018-.013-.016-.013a.217.217 0 0 1-.031-.02c.008-.092.016-.18.02-.27.011-.162.016-.323.016-.48v-.253l-.005-.098-.008-.135a1.891 1.891 0 0 0-.01-.13c-.003-.042-.008-.083-.013-.125l-.016-.124-.018-.122a6.215 6.215 0 0 0-2.032-3.73 6.015 6.015 0 0 0-3.222-1.46 6.292 6.292 0 0 0-.85-.048l-.107.002h-.063l-.044.003-.104.008a4.777 4.777 0 0 0-3.335 1.695c-.332.4-.592.84-.768 1.297a4.594 4.594 0 0 0-.312 1.817l.003.091c.005.055.007.11.013.164a3.615 3.615 0 0 0 .698 1.82 3.53 3.53 0 0 0 1.827 1.282c.33.098.66.14.971.137.039 0 .078 0 .114-.002l.063-.003c.02 0 .041-.003.062-.003.034-.002.065-.007.099-.01.007 0 .018-.003.028-.003l.031-.005.06-.008a1.18 1.18 0 0 0 .112-.02c.036-.008.072-.013.109-.024a2.634 2.634 0 0 0 .914-.415c.028-.02.056-.041.085-.065a.248.248 0 0 0 .039-.35.244.244 0 0 0-.309-.06l-.078.042c-.09.044-.184.083-.283.116a2.476 2.476 0 0 1-.475.096c-.028.003-.054.006-.083.006l-.083.002c-.026 0-.054 0-.08-.002l-.102-.006h-.012l-.024.006c-.016-.003-.031-.003-.044-.006-.031-.002-.06-.007-.091-.01a2.59 2.59 0 0 1-.724-.213 2.557 2.557 0 0 1-.667-.438 2.52 2.52 0 0 1-.805-1.475 2.306 2.306 0 0 1-.029-.444l.006-.122v-.023l.002-.031c.003-.021.003-.04.005-.06a3.163 3.163 0 0 1 1.352-2.29 3.12 3.12 0 0 1 .937-.43 2.946 2.946 0 0 1 .776-.101h.06l.07.002.045.003h.026l.07.005a4.041 4.041 0 0 1 1.635.49 3.94 3.94 0 0 1 1.602 1.662 3.77 3.77 0 0 1 .397 1.414l.005.076.003.075c.002.026.002.05.002.075 0 .024.003.052 0 .07v.065l-.002.073-.008.174a6.195 6.195 0 0 1-.08.639 5.1 5.1 0 0 1-.267.927 5.31 5.31 0 0 1-.624 1.13 5.052 5.052 0 0 1-3.237 2.014 4.82 4.82 0 0 1-.649.066l-.039.003h-.287a6.607 6.607 0 0 1-1.716-.265 6.776 6.776 0 0 1-3.4-2.274 6.75 6.75 0 0 1-.746-1.15 6.616 6.616 0 0 1-.714-2.596l-.005-.083-.002-.02v-.056l-.003-.073v-.096l-.003-.104v-.07l.003-.163c.008-.22.026-.45.054-.678a8.707 8.707 0 0 1 .28-1.355c.128-.444.286-.872.473-1.277a7.04 7.04 0 0 1 1.456-2.1 5.925 5.925 0 0 1 .953-.763c.169-.111.343-.213.524-.306.089-.05.182-.091.273-.135.047-.02.093-.042.138-.062a7.177 7.177 0 0 1 .714-.267l.145-.045c.049-.015.098-.026.148-.041.098-.029.197-.052.296-.076.049-.013.1-.02.15-.033l.15-.032.151-.028.076-.013.075-.01.153-.024c.057-.01.114-.013.171-.023l.169-.021c.036-.003.073-.008.106-.01l.073-.008.036-.003.042-.002c.057-.003.114-.008.171-.01l.086-.006h.023l.037-.003.145-.007a7.999 7.999 0 0 1 1.708.125 7.917 7.917 0 0 1 2.048.68 8.253 8.253 0 0 1 1.672 1.09l.09.077.089.078c.06.052.114.107.171.159.057.052.112.106.166.16.052.055.107.107.159.164a8.671 8.671 0 0 1 1.41 1.978c.012.026.028.052.04.078l.04.078.075.156c.023.051.05.1.07.153l.065.15a8.848 8.848 0 0 1 .45 1.34.19.19 0 0 0 .201.142.186.186 0 0 0 .172-.184c.01-.246.002-.532-.024-.856z"/></svg>}>- </Card>- <Card title="Grafana Cloud" href="/0.1/connections/grafanacloud" icon={<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Grafana</title><path d="M23.02 10.59a8.578 8.578 0 0 0-.862-3.034 8.911 8.911 0 0 0-1.789-2.445c.337-1.342-.413-2.505-.413-2.505-1.292-.08-2.113.4-2.416.62-.052-.02-.102-.044-.154-.064-.22-.089-.446-.172-.677-.247-.231-.073-.47-.14-.711-.197a9.867 9.867 0 0 0-.875-.161C14.557.753 12.94 0 12.94 0c-1.804 1.145-2.147 2.744-2.147 2.744l-.018.093c-.098.029-.2.057-.298.088-.138.042-.275.094-.413.143-.138.055-.275.107-.41.166a8.869 8.869 0 0 0-1.557.87l-.063-.029c-2.497-.955-4.716.195-4.716.195-.203 2.658.996 4.33 1.235 4.636a11.608 11.608 0 0 0-.607 2.635C1.636 12.677.953 15.014.953 15.014c1.926 2.214 4.171 2.351 4.171 2.351.003-.002.006-.002.006-.005.285.509.615.994.986 1.446.156.19.32.371.488.548-.704 2.009.099 3.68.099 3.68 2.144.08 3.553-.937 3.849-1.173a9.784 9.784 0 0 0 3.164.501h.08l.055-.003.107-.002.103-.005.003.002c1.01 1.44 2.788 1.646 2.788 1.646 1.264-1.332 1.337-2.653 1.337-2.94v-.058c0-.02-.003-.039-.003-.06.265-.187.52-.387.758-.6a7.875 7.875 0 0 0 1.415-1.7c1.43.083 2.437-.885 2.437-.885-.236-1.49-1.085-2.216-1.264-2.354l-.018-.013-.016-.013a.217.217 0 0 1-.031-.02c.008-.092.016-.18.02-.27.011-.162.016-.323.016-.48v-.253l-.005-.098-.008-.135a1.891 1.891 0 0 0-.01-.13c-.003-.042-.008-.083-.013-.125l-.016-.124-.018-.122a6.215 6.215 0 0 0-2.032-3.73 6.015 6.015 0 0 0-3.222-1.46 6.292 6.292 0 0 0-.85-.048l-.107.002h-.063l-.044.003-.104.008a4.777 4.777 0 0 0-3.335 1.695c-.332.4-.592.84-.768 1.297a4.594 4.594 0 0 0-.312 1.817l.003.091c.005.055.007.11.013.164a3.615 3.615 0 0 0 .698 1.82 3.53 3.53 0 0 0 1.827 1.282c.33.098.66.14.971.137.039 0 .078 0 .114-.002l.063-.003c.02 0 .041-.003.062-.003.034-.002.065-.007.099-.01.007 0 .018-.003.028-.003l.031-.005.06-.008a1.18 1.18 0 0 0 .112-.02c.036-.008.072-.013.109-.024a2.634 2.634 0 0 0 .914-.415c.028-.02.056-.041.085-.065a.248.248 0 0 0 .039-.35.244.244 0 0 0-.309-.06l-.078.042c-.09.044-.184.083-.283.116a2.476 2.476 0 0 1-.475.096c-.028.003-.054.006-.083.006l-.083.002c-.026 0-.054 0-.08-.002l-.102-.006h-.012l-.024.006c-.016-.003-.031-.003-.044-.006-.031-.002-.06-.007-.091-.01a2.59 2.59 0 0 1-.724-.213 2.557 2.557 0 0 1-.667-.438 2.52 2.52 0 0 1-.805-1.475 2.306 2.306 0 0 1-.029-.444l.006-.122v-.023l.002-.031c.003-.021.003-.04.005-.06a3.163 3.163 0 0 1 1.352-2.29 3.12 3.12 0 0 1 .937-.43 2.946 2.946 0 0 1 .776-.101h.06l.07.002.045.003h.026l.07.005a4.041 4.041 0 0 1 1.635.49 3.94 3.94 0 0 1 1.602 1.662 3.77 3.77 0 0 1 .397 1.414l.005.076.003.075c.002.026.002.05.002.075 0 .024.003.052 0 .07v.065l-.002.073-.008.174a6.195 6.195 0 0 1-.08.639 5.1 5.1 0 0 1-.267.927 5.31 5.31 0 0 1-.624 1.13 5.052 5.052 0 0 1-3.237 2.014 4.82 4.82 0 0 1-.649.066l-.039.003h-.287a6.607 6.607 0 0 1-1.716-.265 6.776 6.776 0 0 1-3.4-2.274 6.75 6.75 0 0 1-.746-1.15 6.616 6.616 0 0 1-.714-2.596l-.005-.083-.002-.02v-.056l-.003-.073v-.096l-.003-.104v-.07l.003-.163c.008-.22.026-.45.054-.678a8.707 8.707 0 0 1 .28-1.355c.128-.444.286-.872.473-1.277a7.04 7.04 0 0 1 1.456-2.1 5.925 5.925 0 0 1 .953-.763c.169-.111.343-.213.524-.306.089-.05.182-.091.273-.135.047-.02.093-.042.138-.062a7.177 7.177 0 0 1 .714-.267l.145-.045c.049-.015.098-.026.148-.041.098-.029.197-.052.296-.076.049-.013.1-.02.15-.033l.15-.032.151-.028.076-.013.075-.01.153-.024c.057-.01.114-.013.171-.023l.169-.021c.036-.003.073-.008.106-.01l.073-.008.036-.003.042-.002c.057-.003.114-.008.171-.01l.086-.006h.023l.037-.003.145-.007a7.999 7.999 0 0 1 1.708.125 7.917 7.917 0 0 1 2.048.68 8.253 8.253 0 0 1 1.672 1.09l.09.077.089.078c.06.052.114.107.171.159.057.052.112.106.166.16.052.055.107.107.159.164a8.671 8.671 0 0 1 1.41 1.978c.012.026.028.052.04.078l.04.078.075.156c.023.051.05.1.07.153l.065.15a8.848 8.848 0 0 1 .45 1.34.19.19 0 0 0 .201.142.186.186 0 0 0 .172-.184c.01-.246.002-.532-.024-.856z"/></svg>}>- </Card>- <Card title="DataDog" href="/0.1/connections/datadog" icon={<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Datadog</title><path d="M19.57 17.04l-1.997-1.316-1.665 2.782-1.937-.567-1.706 2.604.087.82 9.274-1.71-.538-5.794zm-8.649-2.498l1.488-.204c.241.108.409.15.697.223.45.117.97.23 1.741-.16.18-.088.553-.43.704-.625l6.096-1.106.622 7.527-10.444 1.882zm11.325-2.712l-.602.115L20.488 0 .789 2.285l2.427 19.693 2.306-.334c-.184-.263-.471-.581-.96-.989-.68-.564-.44-1.522-.039-2.127.53-1.022 3.26-2.322 3.106-3.956-.056-.594-.15-1.368-.702-1.898-.02.22.017.432.017.432s-.227-.289-.34-.683c-.112-.15-.2-.199-.319-.4-.085.233-.073.503-.073.503s-.186-.437-.216-.807c-.11.166-.137.48-.137.48s-.241-.69-.186-1.062c-.11-.323-.436-.965-.343-2.424.6.421 1.924.321 2.44-.439.171-.251.288-.939-.086-2.293-.24-.868-.835-2.16-1.066-2.651l-.028.02c.122.395.374 1.223.47 1.625.293 1.218.372 1.642.234 2.204-.116.488-.397.808-1.107 1.165-.71.358-1.653-.514-1.713-.562-.69-.55-1.224-1.447-1.284-1.883-.062-.477.275-.763.445-1.153-.243.07-.514.192-.514.192s.323-.334.722-.624c.165-.109.262-.178.436-.323a9.762 9.762 0 0 0-.456.003s.42-.227.855-.392c-.318-.014-.623-.003-.623-.003s.937-.419 1.678-.727c.509-.208 1.006-.147 1.286.257.367.53.752.817 1.569.996.501-.223.653-.337 1.284-.509.554-.61.99-.688.99-.688s-.216.198-.274.51c.314-.249.66-.455.66-.455s-.134.164-.259.426l.03.043c.366-.22.797-.394.797-.394s-.123.156-.268.358c.277-.002.838.012 1.056.037 1.285.028 1.552-1.374 2.045-1.55.618-.22.894-.353 1.947.68.903.888 1.609 2.477 1.259 2.833-.294.295-.874-.115-1.516-.916a3.466 3.466 0 0 1-.716-1.562 1.533 1.533 0 0 0-.497-.85s.23.51.23.96c0 .246.03 1.165.424 1.68-.039.076-.057.374-.1.43-.458-.554-1.443-.95-1.604-1.067.544.445 1.793 1.468 2.273 2.449.453.927.186 1.777.416 1.997.065.063.976 1.197 1.15 1.767.306.994.019 2.038-.381 2.685l-1.117.174c-.163-.045-.273-.068-.42-.153.08-.143.241-.5.243-.572l-.063-.111c-.348.492-.93.97-1.414 1.245-.633.359-1.363.304-1.838.156-1.348-.415-2.623-1.327-2.93-1.566 0 0-.01.191.048.234.34.383 1.119 1.077 1.872 1.56l-1.605.177.759 5.908c-.337.048-.39.071-.757.124-.325-1.147-.946-1.895-1.624-2.332-.599-.384-1.424-.47-2.214-.314l-.05.059a2.851 2.851 0 0 1 1.863.444c.654.413 1.181 1.481 1.375 2.124.248.822.42 1.7-.248 2.632-.476.662-1.864 1.028-2.986.237.3.481.705.876 1.25.95.809.11 1.577-.03 2.106-.574.452-.464.69-1.434.628-2.456l.714-.104.258 1.834 11.827-1.424zM15.05 6.848c-.034.075-.085.125-.007.37l.004.014.013.032.032.073c.14.287.295.558.552.696.067-.011.136-.019.207-.023.242-.01.395.028.492.08.009-.048.01-.119.005-.222-.018-.364.072-.982-.626-1.308-.264-.122-.634-.084-.757.068a.302.302 0 0 1 .058.013c.186.066.06.13.027.207m1.958 3.392c-.092-.05-.52-.03-.821.005-.574.068-1.193.267-1.328.372-.247.191-.135.523.047.66.511.382.96.638 1.432.575.29-.038.546-.497.728-.914.124-.288.124-.598-.058-.698m-5.077-2.942c.162-.154-.805-.355-1.556.156-.554.378-.571 1.187-.041 1.646.053.046.096.078.137.104a4.77 4.77 0 0 1 1.396-.412c.113-.125.243-.345.21-.745-.044-.542-.455-.456-.146-.749"/></svg>}>- </Card>- <Card title="New Relic" href="/0.1/connections/new-relic" icon={<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>New Relic</title><path d="M8.0015 14.3091v7.384L12.0008 24V12.0008L1.6078 5.9996v4.6167ZM12.0008 0 2.8232 5.2976 6.8209 7.606l5.1799-2.9893 6.3936 3.6913v7.384l-5.1783 2.9908v4.6167l9.176-5.2991V5.9996Z"/></svg>}>- </Card>- <Card title="SigNoz" href="/0.1/connections/signoz" icon={<svg role="img" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><title>SigNoz</title><path opacity="0.1" d="M100.279 199.833C44.5682 199.833 0 156.12 0 101.479C0 47.3844 44.5682 3.125 100.279 3.125H163.231C183.844 3.125 200 19.5174 200 39.1882V101.479C200 156.12 155.432 199.833 100.279 199.833Z"/><path d="M99.4919 58.9008C57.8802 58.9008 34.4413 93.3585 33.4637 94.8253C31.0537 98.4385 31.0537 103.111 33.4655 106.727C34.4413 108.191 57.8802 142.649 99.4919 142.649C141.103 142.649 164.543 108.191 165.52 106.724C167.93 103.111 167.93 98.4385 165.518 94.8227C164.542 93.3585 141.103 58.9008 99.4919 58.9008ZM39.2234 102.886C38.3677 101.604 38.3677 99.9463 39.2234 98.6633C40.0095 97.4834 56.6976 72.9705 86.5341 67.0904C73.0136 72.3095 63.393 85.4356 63.393 100.775C63.393 116.114 73.0136 129.24 86.5341 134.459C56.6976 128.579 40.0095 104.066 39.2234 102.886ZM82.8568 100.775C82.8568 102.686 81.3074 104.235 79.396 104.235C77.4845 104.235 75.9352 102.686 75.9352 100.775C75.9352 87.7858 86.5024 77.2185 99.4916 77.2185C101.403 77.2185 102.952 78.7676 102.952 80.6792C102.952 82.5908 101.403 84.1398 99.4916 84.1398C90.3189 84.1398 82.8568 91.6019 82.8568 100.775ZM99.4919 109.188C94.8525 109.188 91.0783 105.414 91.0783 100.775C91.0783 96.1356 94.8525 92.3612 99.4919 92.3612C104.132 92.3612 107.906 96.1354 107.906 100.775C107.906 105.414 104.132 109.188 99.4919 109.188ZM159.76 102.886C158.974 104.066 142.286 128.579 112.45 134.459C125.971 129.24 135.591 116.114 135.591 100.775C135.591 85.4358 125.971 72.3096 112.45 67.0905C142.286 72.971 158.974 97.4837 159.76 98.6634C160.616 99.9463 160.616 101.604 159.76 102.886Z"/></svg>}>- </Card>- <Card title="Dynatrace" href="/0.1/connections/dynatrace" icon={<svg viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg"><title>Dynatrace icon</title><path d="M9.373 0c-.31.006-.93.09-1.521.654C6.98 1.478 2.628 5.61.88 7.27.09 8.024.16 8.865.16 8.934v.377c.067-.292.187-.499.427-.825.496-.616 1.3-.788 1.627-.822a64.233 64.233 0 0 1 .002 0 64.233 64.233 0 0 1 6.527-.549c4.335-.137 7.197.225 7.197.225l6.084-5.793s-3.188-.6-6.82-1.027A93.394 93.394 0 0 0 9.566.006c-.021 0-.09-.008-.193-.006zm13.56 2.508l-6.066 5.79s.222 2.88-.137 7.198c-.189 2.45-.584 4.866-.875 6.494-.052.326-.256 1.114-.925 1.594-.29.198-.491.295-.748.363 1.546-.51 1.091-7.047 1.091-7.047-4.335.137-7.214-.222-7.214-.222L1.975 22.47s3.222.634 6.855 1.045c2.056.24 4.833.429 5.227.463.023 0 .045-.007.068-.012-.013.003-.022.009-.035.012.138 0 .259.015.379.015.085 0 .925.105 1.713-.648 1.748-1.663 6.083-5.81 6.94-6.633.788-.754.72-1.594.72-1.68a81.84 81.84 0 0 0-.207-5.654c-.24-3.65-.701-6.871-.701-6.871zM3.856 8.305C2.125 8.307.348 8.513.16 9.326c.017 1.216.05 3.137.205 5.28.24 3.65.703 6.886.703 6.886l6.082-5.79c-.017.017-.239-2.88.121-7.198H7.27s-1.684-.202-3.415-.2z"/></svg>}>- </Card>-</CardGroup>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/new-relic.mdx b/docs/0.1/connections/new-relic.mdxdeleted file mode 100644index 3a49a025..00000000--- a/docs/0.1/connections/new-relic.mdx+++ /dev/null@@ -1,589 +0,0 @@-----title: 'New Relic'-description: 'LLM Observability with New Relic and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/new-relic-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/new-relic-dashboard-2.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/new-relic-dashboard-3.jpg?raw=true" />-</Frame>--Doku can automatically send LLM usage data from Doku to New Relic using the [Report Metrics HTTP API](https://docs.newrelic.com/docs/data-apis/ingest-apis/metric-api/report-metrics-metric-api/) and [Send Logs API](https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/)--Make the following curl request to Doku to add a connection for New Relic. See more on the [Connections API](/0.1/api-reference/endpoint/connections/create)--```shell-curl --request POST \- --url https://<YOUR_DOKU_INGESTER_URL>/api/connections \- --header 'Authorization: <DOKU_API_KEY>' \- --header 'Content-Type: application/json' \- --data '{- "Platform": "newrelic",- "MetricsUrl": "<YOUR_NEWRELIC_METRICS_URL>",- "LogsUrl": "<YOUR_NEWRELIC_LOGS_URL>",- "ApiKey": "<YOUR_NEWRELIC_API_KEY>"-}'-```--## New Relic Resources--<Accordion title="Dashboard">- ```json- {- "name": "Doku - LLM Monitoring",- "description": null,- "permissions": "PUBLIC_READ_WRITE",- "pages": [- {- "name": "Doku - LLM Monitoring",- "description": null,- "widgets": [- {- "title": "",- "layout": {- "column": 1,- "row": 1,- "width": 1,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.markdown"- },- "rawConfiguration": {- "text": ""- }- },- {- "title": "",- "layout": {- "column": 2,- "row": 1,- "width": 2,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT COUNT(doku.LLM.Request.Duration) AS 'Total Requests' FROM Metric WHERE job.name='doku'"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Seconds",- "layout": {- "column": 4,- "row": 1,- "width": 2,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT average(doku.LLM.Request.Duration) AS 'Avg Request Duration' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "",- "layout": {- "column": 6,- "row": 1,- "width": 2,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT AVERAGE(doku.LLM.Total.Tokens) AS 'Average Tokens / Request' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "",- "layout": {- "column": 8,- "row": 1,- "width": 2,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT AVERAGE(doku.LLM.Usage.Cost) AS 'Average Cost / Request' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "",- "layout": {- "column": 10,- "row": 1,- "width": 3,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT SUM(doku.LLM.Usage.Cost) AS 'Average Cost / Request' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Total Request ",- "layout": {- "column": 1,- "row": 2,- "width": 12,- "height": 2- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.area"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": false- },- "legend": {- "enabled": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT count(doku.LLM.Request.Duration) FROM Metric TIMESERIES"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Usage Cost by Category",- "layout": {- "column": 1,- "row": 4,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.pie"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": true- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT SUM(doku.LLM.Usage.Cost AS 'Generation') FROM Metric FACET generation\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Usage cost by Platform",- "layout": {- "column": 7,- "row": 4,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.pie"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": true- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT sum(doku.LLM.Usage.Cost AS 'Platform') FROM Metric FACET platform\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Usage Cost by Environment",- "layout": {- "column": 1,- "row": 7,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.pie"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": true- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT sum(doku.LLM.Usage.Cost AS 'Environment') FROM Metric FACET environment\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Usage Cost by Application",- "layout": {- "column": 7,- "row": 7,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.pie"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": true- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT SUM(doku.LLM.Usage.Cost AS 'Applications') FROM Metric FACET applicationName\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Average Tokens ",- "layout": {- "column": 1,- "row": 10,- "width": 12,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.stacked-bar"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": false- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT average(doku.LLM.Prompt.Tokens), average(doku.LLM.Completion.Tokens) FROM Metric TIMESERIES"- }- ],- "platformOptions": {- "ignoreTimeRange": false- },- "units": {- "unit": "COUNT"- }- }- },- {- "title": "",- "layout": {- "column": 1,- "row": 13,- "width": 6,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT AVERAGE(doku.LLM.Prompt.Tokens) AS 'Average Prompt Tokens / Request' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "",- "layout": {- "column": 7,- "row": 13,- "width": 6,- "height": 1- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.billboard"- },- "rawConfiguration": {- "dataFormatters": [],- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT AVERAGE(doku.LLM.Completion.Tokens) AS 'Average Completion Tokens / Request' FROM Metric"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Top Models by Usage",- "layout": {- "column": 1,- "row": 14,- "width": 4,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.bar"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": false- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT COUNT(doku.LLM.Request.Duration AS 'Generation') FROM Metric FACET model\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- }- }- },- {- "title": "Average Cost / Model",- "layout": {- "column": 5,- "row": 14,- "width": 8,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "viz.area"- },- "rawConfiguration": {- "facet": {- "showOtherSeries": false- },- "legend": {- "enabled": true- },- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT AVERAGE(doku.LLM.Usage.Cost AS 'Generation') FROM Metric FACET model TIMESERIES\n"- }- ],- "platformOptions": {- "ignoreTimeRange": false- },- "units": {- "unit": "APDEX"- }- }- },- {- "title": "Prompts",- "layout": {- "column": 1,- "row": 17,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "logger.log-table-widget"- },- "rawConfiguration": {- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT timestamp, message FROM Log WHERE job.name='doku' AND type='prompt'"- }- ]- }- },- {- "title": "Response's",- "layout": {- "column": 7,- "row": 17,- "width": 6,- "height": 3- },- "linkedEntityGuids": null,- "visualization": {- "id": "logger.log-table-widget"- },- "rawConfiguration": {- "nrqlQueries": [- {- "accountIds": [- 4060909- ],- "query": "SELECT timestamp, message FROM Log WHERE job.name='doku' AND type='response' OR type='image'"- }- ]- }- }- ]- }- ],- "variables": []- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/connections/signoz.mdx b/docs/0.1/connections/signoz.mdxdeleted file mode 100644index a56d52aa..00000000--- a/docs/0.1/connections/signoz.mdx+++ /dev/null@@ -1,1480 +0,0 @@-----title: 'SigNoz'-description: 'LLM Observability with SigNoz and Doku'------<Frame>- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/signoz-dashboard-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/doku/blob/main/docs/images/signoz-dashboard-2.jpg?raw=true" />-</Frame>--Doku can automatically send LLM usage data from Doku to SigNoz using the [HTTP Logs API](https://signoz.io/docs/userguide/send-logs-http/)--Make the following curl request to Doku to add a connection for SigNoz. See more on the [Connections API](/0.1/api-reference/endpoint/connections/create)--```shell-curl --request POST \- --url https://<YOUR_DOKU_INGESTER_URL>/api/connections \- --header 'Authorization: <DOKU_API_KEY>' \- --header 'Content-Type: application/json' \- --data '{- "Platform": "signoz",- "LogsUrl": "<YOUR_SIGNOZ_LOGS_URL>",- "ApiKey": "<YOUR_SIGNOZ_API_KEY>"-}'-```--## SigNoz Resources--<Accordion title="Dashboard">- ```json- {- "description": "This dashboard tracks costs, tokens, & model usage for LLM Applications via Doku for enhanced performance and evaluation.",- "layout": [- {- "h": 3,- "i": "4d33e5a0-2e34-4626-9dff-f795cd8e62ee",- "moved": false,- "static": false,- "w": 9,- "x": 0,- "y": 5- },- {- "h": 3,- "i": "5705486f-dfab-4428-96ce-97d5ccfc0620",- "moved": false,- "static": false,- "w": 6,- "x": 6,- "y": 17- },- {- "h": 3,- "i": "532306fd-bc68-4e3e-a76f-313b92d22f0e",- "moved": false,- "static": false,- "w": 3,- "x": 9,- "y": 14- },- {- "h": 3,- "i": "60e26de7-3b68-4348-b31b-bb7275a26a45",- "moved": false,- "static": false,- "w": 12,- "x": 0,- "y": 2- },- {- "h": 2,- "i": "443e85bf-9863-4002-abd4-0407fa12e92d",- "moved": false,- "static": false,- "w": 3,- "x": 2,- "y": 0- },- {- "h": 3,- "i": "84dc9645-8c6c-4b9a-9558-2386b6eb4d10",- "moved": false,- "static": false,- "w": 6,- "x": 0,- "y": 17- },- {- "h": 2,- "i": "99d0eee5-9e91-4496-a7ee-70508cbbca6b",- "moved": false,- "static": false,- "w": 3,- "x": 5,- "y": 0- },- {- "h": 2,- "i": "a0f453e8-0b6f-45bb-910c-6171a50919a9",- "moved": false,- "static": false,- "w": 2,- "x": 0,- "y": 0- },- {- "h": 2,- "i": "4f778a79-54cd-4a99-a5b0-3d06647c1fb9",- "moved": false,- "static": false,- "w": 4,- "x": 8,- "y": 0- },- {- "h": 3,- "i": "1128a154-ed4f-4189-b1ca-d52f28a78d28",- "moved": false,- "static": false,- "w": 3,- "x": 9,- "y": 11- },- {- "h": 3,- "i": "0c3a8c8a-5116-47f2-9dfe-242440ee65df",- "moved": false,- "static": false,- "w": 3,- "x": 9,- "y": 8- },- {- "h": 3,- "i": "ec9a5671-4a0c-4172-a383-82f37ab682f7",- "moved": false,- "static": false,- "w": 3,- "x": 9,- "y": 5- },- {- "h": 3,- "i": "af5f5471-e523-49e5-8de3-17a8c43fd115",- "moved": false,- "static": false,- "w": 9,- "x": 0,- "y": 8- },- {- "h": 3,- "i": "4f33601c-9707-4b52-8194-e6671c52666e",- "moved": false,- "static": false,- "w": 9,- "x": 0,- "y": 11- },- {- "h": 3,- "i": "11cba8dc-b2de-4eb6-a546-8a3cbe43cba2",- "moved": false,- "static": false,- "w": 9,- "x": 0,- "y": 14- }- ],- "name": "",- "tags": [- "Doku",- "OpenAI",- "Cohere",- "Anthropic"- ],- "title": "Doku - LLM Monitoring",- "variables": {},- "widgets": [- {- "description": "",- "fillSpans": false,- "id": "a0f453e8-0b6f-45bb-910c-6171a50919a9",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "value",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "",- "id": "------false",- "isColumn": false,- "isJSON": false,- "key": "",- "type": ""- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "9a3b0db1",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "984ba011-8db8-45aa-a4e2-8668569236bb",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Total Requests",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "99d0eee5-9e91-4496-a7ee-70508cbbca6b",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "value",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "totalTokens--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "totalTokens",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [],- "op": "AND"- },- "groupBy": [],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "last",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "ebc81d59-4638-46a7-b111-adb28ccf64ac",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Tokens / Request",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "84dc9645-8c6c-4b9a-9558-2386b6eb4d10",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "table",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "eb4d013a",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "model--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "model",- "type": "tag"- }- ],- "having": [],- "legend": "Count",- "limit": null,- "orderBy": [- {- "columnName": "timestamp",- "order": "desc"- }- ],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "2e7436ea-db19-4790-aeef-e905849ed401",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Model Usage",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "4f778a79-54cd-4a99-a5b0-3d06647c1fb9",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "value",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "6ce37ed5",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "last",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "6d5d2593-1ae7-481f-88be-ba762b9196a0",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost / Request",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "443e85bf-9863-4002-abd4-0407fa12e92d",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "value",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "65e9c28f",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "last",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "38484c36-2230-45a7-9f0d-4211c9d00975",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Request Duration",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "60e26de7-3b68-4348-b31b-bb7275a26a45",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "f28b0509",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [],- "having": [],- "legend": "Count",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "c6d1c906-6116-4559-a1eb-33b53d0abfcd",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Requests overtime",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "532306fd-bc68-4e3e-a76f-313b92d22f0e",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "table",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "78e35563",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "applicationName--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "applicationName",- "type": "tag"- }- ],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "24b9c833-d9ef-40de-b10c-1dbfbd7ef7c5",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Usage by Application",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "1128a154-ed4f-4189-b1ca-d52f28a78d28",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "table",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "c79b6091",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "environment--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "environment",- "type": "resource"- }- ],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "790116c6-535c-4e08-9fa2-0a158eb7b796",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Usage by Environment",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "0c3a8c8a-5116-47f2-9dfe-242440ee65df",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "table",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "b575368c",- "key": {- "dataType": "string",- "id": "applicationName--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "applicationName",- "type": "tag"- },- "op": "exists",- "value": ""- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "platform--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "platform",- "type": "tag"- }- ],- "having": [],- "legend": "",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "d59f9848-99b6-4d7b-9c3f-ab4752623cff",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Usage by Platform",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "ec9a5671-4a0c-4172-a383-82f37ab682f7",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "table",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "requestDuration--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "requestDuration",- "type": "tag"- },- "aggregateOperator": "count",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "5a2b96e0",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "generation--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "generation",- "type": "tag"- }- ],- "having": [],- "legend": "",- "limit": null,- "orderBy": [- {- "columnName": "#SIGNOZ_VALUE",- "order": "desc"- }- ],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "db77fe7d-8982-4f4a-ab90-b139151ae121",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Usage by Category",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "5705486f-dfab-4428-96ce-97d5ccfc0620",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "67d33dbc",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "model--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "model",- "type": "tag"- }- ],- "having": [],- "legend": "{{model}}",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "9d51906e-c800-4063-b355-333f882cfa74",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost by Model",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "4d33e5a0-2e34-4626-9dff-f795cd8e62ee",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "b906c8d2",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "generation--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "generation",- "type": "tag"- }- ],- "having": [],- "legend": "{{generation}}",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "a6678a16-3579-4037-8644-aa29c102dc41",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost by Category",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "af5f5471-e523-49e5-8de3-17a8c43fd115",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "11c2ee90",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "platform--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "platform",- "type": "tag"- }- ],- "having": [],- "legend": "{{platform}}",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "490a0010-6497-4caf-a19f-06532673278c",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost by Platform",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "4f33601c-9707-4b52-8194-e6671c52666e",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "e2a969e5",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "environment--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "environment",- "type": "resource"- }- ],- "having": [],- "legend": "{{environment}}",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "8bb7bebd-1472-4f1b-8ab8-9c649581bac0",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost by Environment",- "yAxisUnit": "none"- },- {- "description": "",- "fillSpans": false,- "id": "11cba8dc-b2de-4eb6-a546-8a3cbe43cba2",- "isStacked": false,- "nullZeroValues": "zero",- "opacity": "1",- "panelTypes": "graph",- "query": {- "builder": {- "queryData": [- {- "aggregateAttribute": {- "dataType": "float64",- "id": "usageCost--float64--tag--false",- "isColumn": false,- "isJSON": false,- "key": "usageCost",- "type": "tag"- },- "aggregateOperator": "avg",- "dataSource": "logs",- "disabled": false,- "expression": "A",- "filters": {- "items": [- {- "id": "e2a969e5",- "key": {- "dataType": "string",- "id": "job--string--resource--false",- "isColumn": false,- "isJSON": false,- "key": "job",- "type": "resource"- },- "op": "=",- "value": "doku"- }- ],- "op": "AND"- },- "groupBy": [- {- "dataType": "string",- "id": "applicationName--string--tag--false",- "isColumn": false,- "isJSON": false,- "key": "applicationName",- "type": "tag"- }- ],- "having": [],- "legend": "{{applicationName}}",- "limit": null,- "orderBy": [],- "queryName": "A",- "reduceTo": "sum",- "stepInterval": 60- }- ],- "queryFormulas": []- },- "clickhouse_sql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "id": "9c3b02ce-4ff7-4992-a323-0e492f85cb5b",- "promql": [- {- "disabled": false,- "legend": "",- "name": "A",- "query": ""- }- ],- "queryType": "builder"- },- "softMax": null,- "softMin": null,- "thresholds": [],- "timePreferance": "GLOBAL_TIME",- "title": "Avg Cost by Application",- "yAxisUnit": "none"- }- ]- }- ```-</Accordion>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/installation.mdx b/docs/0.1/installation.mdxdeleted file mode 100644index eb76e6da..00000000--- a/docs/0.1/installation.mdx+++ /dev/null@@ -1,121 +0,0 @@-----title: 'Installation'-description: 'Self-host Doku in your preferred environment'-icon: 'circle-down'------Doku flexibly adapts to your preferred environment. Select a deployment method that best fits your needs:--<CardGroup cols={2}>- <Card- title="Kubernetes"- icon={<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">- <title>Kubernetes</title>- <path fill="#FFA500" d="M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"/></svg>}- href="/0.1/installation#kubernetes"- >- Deploy Doku on a Kubernetes for scalable LLM Monitoring capabilities.- </Card>- <Card- title="Docker"- icon="docker"- href="/0.1/installation#docker"- >- Deploy Doku using Docker for an easy-to-manage LLM Monitoring setup.- </Card>-</CardGroup>--## Kubernetes--Deploy Doku on your Kubernetes cluster using the [Doku Helm chart](https://github.com/dokulabs/helm/tree/main/charts/doku) for a reliable and scalable solution.-<Steps>- <Step title="Helm Repo Setup">- ```shell shell- helm repo add dokulabs https://dokulabs.github.io/helm/- helm repo update- ```- </Step>- <Step title="Installing the Helm Chart">- ```shell shell- helm install doku dokulabs/doku --version="0.1.3"- ```- </Step>-</Steps>--## Docker-For a quick and straightforward setup, Docker Compose can be used to deploy Doku.--<Steps>- <Step title="Create `docker-compose.yml`">- ```yaml- version: '3.8'-- services:- clickhouse:- image: clickhouse/clickhouse-server:24.2.2- container_name: clickhouse- environment:- CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- CLICKHOUSE_USER: ${DOKU_DB_USER:-default}- volumes:- - clickhouse-data:/var/lib/clickhouse- ports:- - "9000:9000"- - "8123:8123"- restart: always-- doku-ingester:- image: ghcr.io/dokulabs/doku-ingester:0.1.3- container_name: doku-ingester- environment:- DOKU_DB_HOST: clickhouse- DOKU_DB_PORT: 9000- DOKU_DB_NAME: ${DOKU_DB_NAME:-default}- DOKU_DB_USER: ${DOKU_DB_USER:-default}- DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- ports:- - "9044:9044"- depends_on:- - clickhouse- restart: always-- doku-client:- image: ghcr.io/dokulabs/doku-client:0.1.3- container_name: doku-client- environment:- INIT_DB_HOST: clickhouse- INIT_DB_PORT: 8123- INIT_DB_DATABASE: ${DOKU_DB_NAME:-default}- INIT_DB_USERNAME: ${DOKU_DB_USER:-default}- INIT_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- SQLITE_DATABASE_URL: file:/app/client/data/data.db- ports:- - "3000:3000"- depends_on:- - clickhouse- volumes:- - doku-client-data:/app/client/data- restart: always-- volumes:- clickhouse-data:- doku-client-data:- ```- </Step>- <Step title="Start Docker Compose">- ```shell- docker-compose up -d- ```- </Step>-</Steps>-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/anthropic/examples/messages.mdx b/docs/0.1/integrations/anthropic/examples/messages.mdxdeleted file mode 100644index 1bf4d688..00000000--- a/docs/0.1/integrations/anthropic/examples/messages.mdx+++ /dev/null@@ -1,148 +0,0 @@-----title: 'Messages'-description: 'Monitor Anthropic `messages` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">-- ### Synchronous Usage- <CodeGroup>- ```python default- from anthropic import Anthropic- import dokumetry-- client = Anthropic(- api_key="YOUR_ANTHROPIC_API_KEY",- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- message = client.messages.create(- messages=[{ "role": "user", "content": "Hello, Explain LLM Monitoring in one sentence"}],- model="claude-3-opus-20240229",- max_tokens=1024- )- print(message.content)- ```- ```python streaming- from anthropic import Anthropic- import dokumetry-- client = Anthropic(- api_key="YOUR_ANTHROPIC_API_KEY",- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- stream = client.messages.create(- messages=[{"role": "user", "content": "Hello, Explain LLM Monitoring in one sentence"}],- max_tokens=1024,- model="claude-3-opus-20240229",- stream=True,- )- for event in stream:- print(event.type)- ```- </CodeGroup>-- ### Asynchronous usage- <CodeGroup>- ```python default- import asyncio- from anthropic import AsyncAnthropic- import dokumetry-- client = AsyncAnthropic(- api_key="YOUR_ANTHROPIC_API_KEY",- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- message = await client.messages.create(- messages=[{"role": "user","content": "Hello, How to monitor LLM Applications?"}],- model="claude-3-opus-20240229",- )- print(message.content)-- asyncio.run(main())- ```-- ```python streaming- import asyncio- from anthropic import AsyncAnthropic- import dokumetry-- client = AsyncAnthropic(- api_key="YOUR_ANTHROPIC_API_KEY",- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- stream = await client.messages.create(- messages=[{"role": "user","content": "What metrics to monitor for my LLM Applications?"}],- model="claude-3-opus-20240229",- stream=True,- )- async for event in stream:- print(event.type)-- asyncio.run(main())- ```- </CodeGroup>- </Tab>- <Tab title="Javascript">- <CodeGroup>- ```javascript default- import Anthropic from '@anthropic-ai/sdk';- import DokuMetry from 'dokumetry';-- const anthropic = new Anthropic({- apiKey: 'my_api_key',- });-- // Pass the above `anthropic` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- DokuMetry.init({llm: anthropic, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const message = await anthropic.messages.create({- messages: [{ role: 'user', content: 'How to monitor my LLM Applications?' }],- model: 'claude-3-opus-20240229',- });-- console.log(message.content);- }-- main();- ```-- ```javascript streaming- import Anthropic from '@anthropic-ai/sdk';- import DokuMetry from 'dokumetry';-- const anthropic = new Anthropic({- apiKey: 'my_api_key',- });-- // Pass the above `anthropic` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- DokuMetry.init({llm: anthropic, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const stream = await anthropic.messages.create({- messages: [{ role: 'user', content: 'How to setup LLM Obserability?' }],- model: 'claude-3-opus-20240229',- stream: true,- });- for await (const messageStreamEvent of stream) {- console.log(messageStreamEvent.type);- }- ```- </CodeGroup>- </Tab>-</Tabs>-diff --git a/docs/0.1/integrations/anthropic/introduction.mdx b/docs/0.1/integrations/anthropic/introduction.mdxdeleted file mode 100644index 87ddbe2e..00000000--- a/docs/0.1/integrations/anthropic/introduction.mdx+++ /dev/null@@ -1,93 +0,0 @@-----title: 'Anthropic Integration'-sidebarTitle: 'Get Started'------DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor Anthropic usage data and metrics from your Python/NodeJS code.--## Get Started--The integration is compatible with-- Anthropic Python SDK client `>=0.19.0`-- Anthropic JS/TS SDK client `>=0.9.0`--<Tabs>- <Tab title="Python">- ```shell- pip install dokumetry==0.1.1- ```-- ```python- from anthropic import Anthropic- import dokumetry-- anthropic = Anthropic(- api_key="anthropic_api_key",- )-- dokumetry.init(llm = anthropic, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")- ```- </Tab>- <Tab title="Javascript">- ```shell- npm install [email protected]- ```-- ```javascript- import Anthropic from '@anthropic-ai/sdk';- import DokuMetry from 'dokumetry';-- const anthropic = new Anthropic({- apiKey: 'anthropic_api_key',- });-- DokuMetry.init({llm: anthropic, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})- ```- </Tab>-</Tabs>--## Supported Endpoints--The following Anthropic Endpoints are supported for monitoring with DokuMetry--- [messages](/0.1/integrations/anthropic/examples/messages)--## Parameters-<Tabs>- <Tab title="Python">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Anthropic Object to track | Yes |- | doku_url | URL of your Doku Ingester | Yes |- | api_key | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | application_name | Custom application name tag for your metrics | Optional |- | skip_resp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>- <Tab title="NodeJS">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Anthropic Object to track | Yes |- | dokuUrl | URL of your Doku Ingester | Yes |- | apiKey | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | applicationName | Custom application name tag for your metrics | Optional |- | skipResp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>-</Tabs>--## Advanced Usage-When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.--To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.-------<CardGroup cols={2}>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/azure-openai/examples/chat.mdx b/docs/0.1/integrations/azure-openai/examples/chat.mdxdeleted file mode 100644index 8edbec85..00000000--- a/docs/0.1/integrations/azure-openai/examples/chat.mdx+++ /dev/null@@ -1,437 +0,0 @@-----title: 'Chat Completions'-description: 'Monitor Azure OpenAI `chat.completions` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">-- ### Synchronous Usage- <CodeGroup>- ```python Default- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model=azure_model_deployment,- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ]- )-- print(completion.choices[0].message)- ```-- ```python Streaming- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model=azure_model_deployment,- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream=True- )-- for chunk in completion:- print(chunk.choices[0].delta)- ```-- ```python Functions- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ]- messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]- completion = client.chat.completions.create(- model=azure_model_deployment,- messages=messages,- tools=tools,- tool_choice="auto"- )-- print(completion)- ```-- ```python LogProbs- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model=azure_model_deployment,- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- logprobs=True,- top_logprobs=2- )-- print(completion.choices[0].message)- print(completion.choices[0].logprobs)- ```- </CodeGroup>-- ### Asynchronous Usage-- <CodeGroup>- ```python Default- import asyncio- from openai import AsyncAzureOpenAI- import dokumetry-- client = AsyncAzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- chat_completion = await client.chat.completions.create(- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- model=azure_model_deployment,- )-- asyncio.run(main())- ```-- ```python Streaming- import asyncio- from openai import AsyncAzureOpenAI- import dokumetry-- client = AsyncAzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main():- stream = await client.chat.completions.create(- model=azure_model_deployment,- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream=True,- )- async for chunk in stream:- print(chunk.choices[0].delta.content or "", end="")--- asyncio.run(main())- ```-- ```python Functions- import asyncio- from openai import AsyncAzureOpenAI- import dokumetry-- client = AsyncAzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ]- messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]-- async def main() -> None:- completion = await client.chat.completions.create(- model=azure_model_deployment,- messages=messages,- tools=tools,- tool_choice="auto"- )-- asyncio.run(main())- ```-- ```python LogProbs- import asyncio- from openai import AsyncAzureOpenAI- import dokumetry-- client = AsyncAzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- completion = await client.chat.completions.create(- model=azure_model_deployment,- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- logprobs=True,- top_logprobs=2- )-- asyncio.run(main())- ```- </CodeGroup>- </Tab>- <Tab title="NodeJS">- <CodeGroup>- ```javascript Default- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await client.chat.completions.create({- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- model: azureModelDeployment,- });-- console.log(completion.choices[0]);- }-- main();- ```-- ```javascript Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await client.chat.completions.create({- model: azureModelDeployment,- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream: true,- });-- for await (const chunk of completion) {- console.log(chunk.choices[0].delta.content);- }- }-- main();- ```-- ```javascript Functions- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const messages = [{"role": "user", "content": "What's the weather like in Boston today?"}];- const tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ];-- const response = await client.chat.completions.create({- model: azureModelDeployment,- messages: messages,- tools: tools,- tool_choice: "auto",- });-- console.log(response);- }-- main();- ```-- ```javascript LogProbs- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await client.chat.completions.create({- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my Azure OpenAI based LLM Applications?"}- ],- model: azureModelDeployment,- logprobs: true,- top_logprobs: 2,- });-- console.log(completion.choices[0]);- }-- main();- ```- </CodeGroup>- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/azure-openai/examples/completions.mdx b/docs/0.1/integrations/azure-openai/examples/completions.mdxdeleted file mode 100644index 313a3a23..00000000--- a/docs/0.1/integrations/azure-openai/examples/completions.mdx+++ /dev/null@@ -1,118 +0,0 @@-----title: 'Completions'-description: 'Monitor Azure OpenAI `completions` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">- <CodeGroup>- ```python No Streaming- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.completions.create(- model=azure_model_deployment,- prompt="What is LLM Observablity?",- )-- print(respomse.choices[0].text)- ```-- ```python Streaming- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.completions.create(- model=azure_model_deployment,- prompt="How to monitor LLM Applications?",- stream=True- )-- for chunk in respomse:- print(chunk.choices[0].text)- ```- </CodeGroup>- </Tab>- <Tab title="NodeJS">- <CodeGroup>- ```javascript No Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await client.completions.create({- model: azureModelDeployment,- prompt: "How to monitor LLM Applications?",- });-- console.log(response);- }- main();- ```-- ```javascript Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- // Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await client.completions.create({- model: azureModelDeployment,- prompt: "How to monitor LLM Applications?",- stream: true,- });-- for await (const chunk of response) {- console.log(chunk.choices[0].text)- }- }- main();- ```- </CodeGroup>- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/azure-openai/examples/embeddings.mdx b/docs/0.1/integrations/azure-openai/examples/embeddings.mdxdeleted file mode 100644index c218f846..00000000--- a/docs/0.1/integrations/azure-openai/examples/embeddings.mdx+++ /dev/null@@ -1,61 +0,0 @@-----title: 'Embeddings'-description: 'Monitor OpenAI Embeddings API usage'------## Create Embeddings-<Tabs>- <Tab title="Python">- ```python- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- client.embeddings.create(- model=azure_model_deployment,- input="LLM monitoring",- encoding_format="float"- )- ```- </Tab>- <Tab title="javascript">- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async function main() {- const embedding = await client.embeddings.create({- model: azureModelDeployment,- input: "The quick brown fox jumped over the lazy dog",- encoding_format: "float",- });-- console.log(embedding);- }-- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/azure-openai/examples/image.mdx b/docs/0.1/integrations/azure-openai/examples/image.mdxdeleted file mode 100644index 36074dd7..00000000--- a/docs/0.1/integrations/azure-openai/examples/image.mdx+++ /dev/null@@ -1,60 +0,0 @@-----title: 'Image'-description: 'Monitor Azure OpenAI `image` API usage for cost, performance & user interactions'------## Create Image--<Tabs>- <Tab title="Python">- ```python- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- azure_model_deployment = "YOUR_AZURE_OPENAI_DEPLOYMENT"-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- image = client.images.generate(- model=azure_model_deployment,- prompt="Create a dashboard for LLM Observability data",- n=1,- size="1024x1024"- )-- print(image.data)- ```- </Tab>- <Tab title="Javascript">- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- const azureModelDeployment = 'YOUR_AZURE_OPENAI_DEPLOYMENT';-- async function main() {- const image = await client.images.generate({- model: azureModelDeployment,- prompt: "Create a dashboard for LLM Observability data"- });-- console.log(image.data);- }- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/azure-openai/introduction.mdx b/docs/0.1/integrations/azure-openai/introduction.mdxdeleted file mode 100644index 2774476c..00000000--- a/docs/0.1/integrations/azure-openai/introduction.mdx+++ /dev/null@@ -1,102 +0,0 @@-----title: 'Azure OpenAI Integration'-sidebarTitle: 'Get Started'------DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor Azure OpenAI usage data and metrics from your Python/NodeJS code.--## Get Started--The integration is compatible with-- OpenAI Python SDK client `>=1.13.0`-- OpenAI JS/TS SDK client `>=4.28.0`--<Tabs>- <Tab title="Python">- ```shell- pip install dokumetry==0.1.1- ```-- ```python- from openai import AzureOpenAI- import dokumetry-- client = AzureOpenAI(- api_key = "YOUR_AZURE_OPENAI_API_KEY",- api_version = "2024-02-01",- azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"- )-- dokumetry.init(llm = client, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")- ```- </Tab>- <Tab title="Javascript">- ```shell- npm install [email protected]- ```-- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI({- apiKey: "YOUR_AZURE_OPENAI_API_KEY",- baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,- defaultQuery: { 'api-version': "2024-02-01" },- defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },- });-- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})- ```- </Tab>-</Tabs>--## Supported Endpoints--The following Azure OpenAI Endpoints are supported for monitoring with DokuMetry--- [Chat completions](/0.1/integrations/azure-openai/examples/chat)-- [Image Create](/0.1/integrations/azure-openai/examples/image#create-image)-- [Embeddings](/0.1/integrations/azure-openai/examples/embeddings)-- [Completions](/0.1/integrations/azure-openai/examples/completions)--## Parameters--<Tabs>- <Tab title="Python">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Azure OpenAI Object to track | Yes |- | doku_url | URL of your Doku Ingester | Yes |- | api_key | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | application_name | Custom application name tag for your metrics | Optional |- | skip_resp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>- <Tab title="NodeJS">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Azure OpenAI Object to track | Yes |- | dokuUrl | URL of your Doku Ingester | Yes |- | apiKey | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | applicationName | Custom application name tag for your metrics | Optional |- | skipResp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>-</Tabs>--## Advanced Usage-When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.--To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.-------<CardGroup cols={2}>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/cohere/examples/cochat.mdx b/docs/0.1/integrations/cohere/examples/cochat.mdxdeleted file mode 100644index 84718404..00000000--- a/docs/0.1/integrations/cohere/examples/cochat.mdx+++ /dev/null@@ -1,106 +0,0 @@-----title: 'Chat'-description: 'Monitor Cohere `chat` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">- <CodeGroup>- ```python No Streaming- import cohere- import dokumetry-- co = cohere.Client("YOUR_COHERE_API_KEY")-- # Pass the above `co` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- dokumetry.init(llm=co, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = co.chat(- chat_history=[- {"role": "USER", "message": "What is LLM Observability?"},- {"role": "CHATBOT", "message": "The best tool to monitor LLM Applications is Doku!"}- ],- message="How to monitor LLM Applications?",- )- print(response.text)- ```-- ```python Streaming- import cohere- import dokumetry-- co = cohere.Client("YOUR_COHERE_API_KEY")-- # Pass the above `co` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- dokumetry.init(llm=co, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = co.chat_steam(- chat_history=[- {"role": "USER", "message": "What is LLM Observability?"},- {"role": "CHATBOT", "message": "The best tool to monitor LLM Applications is Doku!"}- ],- message="How to monitor LLM Applications?",- )- for text in response:- if text.event_type === "text-generation":- print(text)- ```- </CodeGroup>- </Tab>- <Tab title="Javascript">- <CodeGroup>- ```javascript No Streaming- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const cohere = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- (async () => {- // Pass the above `cohere` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const response = await cohere.chat({- chatHistory: [- {"role": "USER", "message": "What is LLM Observability?"},- {"role": "CHATBOT", "message": "The best tool to monitor LLM Applications is Doku!"}- ],- message: "How to monitor LLM Applications?",- model: 'command',- });-- console.log(response.text)- })();- ```-- ```javascript Streaming- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const cohere = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- (async () => {- // Pass the above `cohere` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const response = await cohere.chatStream({- chatHistory: [- {"role": "USER", "message": "What is LLM Observability?"},- {"role": "CHATBOT", "message": "The best tool to monitor LLM Applications is Doku!"}- ],- message: "How to monitor LLM Applications?",- model: 'command',- });- for await (const message of response) {- if (message.eventType === "text-generation") {- console.log(message);- }- }- })();- ```- </CodeGroup>- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/cohere/examples/embed.mdx b/docs/0.1/integrations/cohere/examples/embed.mdxdeleted file mode 100644index 57a3835a..00000000--- a/docs/0.1/integrations/cohere/examples/embed.mdx+++ /dev/null@@ -1,47 +0,0 @@-----title: 'Embed'-description: 'Monitor Cohere Embed API usage'------<Tabs>- <Tab title="Python">- ```python- import cohere- import dokumetry-- co = cohere.Client("YOUR_COHERE_API_KEY")-- # Pass the above `co` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- dokumetry.init(llm=co, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = co.embed(- texts=['LLM', 'Monitoring', 'Observability'],- model='embed-english-v3.0',- input_type='classification'- )- print(response)- ```- </Tab>- <Tab title="Javascript">- ```javascript- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const cohere = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- (async () => {- // Pass the above `cohere` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const embed = await cohere.embed({- texts: ['LLM', 'Monitoring', 'Observability'],- model: "embed-english-v3.0",- inputType: "classification",- });- console.log(embed);- })();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/cohere/examples/generate.mdx b/docs/0.1/integrations/cohere/examples/generate.mdxdeleted file mode 100644index 012c50d0..00000000--- a/docs/0.1/integrations/cohere/examples/generate.mdx+++ /dev/null@@ -1,44 +0,0 @@-----title: 'Generate'-description: 'Monitor Cohere `generate` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">- ```python- import cohere- import dokumetry-- co = cohere.Client("YOUR_COHERE_API_KEY")-- # Pass the above `co` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- dokumetry.init(llm=co, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = co.generate(- prompt='How to monitor my LLM Applications?',- )- print(response)- ```- </Tab>- <Tab title="Javascript">- ```javascript- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const cohere = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- (async () => {- // Pass the above `cohere` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const generate = await cohere.generate({- prompt: "What is LLM Monitoring?",- });-- console.log(generate);- })();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/cohere/examples/summarize.mdx b/docs/0.1/integrations/cohere/examples/summarize.mdxdeleted file mode 100644index 3715c67b..00000000--- a/docs/0.1/integrations/cohere/examples/summarize.mdx+++ /dev/null@@ -1,86 +0,0 @@-----title: 'Summarize'-description: 'Monitor Cohere `summarize` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">- ```python- import cohere- import dokumetry-- co = cohere.Client("YOUR_COHERE_API_KEY")-- # Pass the above `co` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- dokumetry.init(llm=co, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- text=(- "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. "- "It may be made from milk or cream and is flavoured with a sweetener, "- "either sugar or an alternative, and a spice, such as cocoa or vanilla, "- "or with fruit such as strawberries or peaches. "- "It can also be made by whisking a flavored cream base and liquid nitrogen together. "- "Food coloring is sometimes added, in addition to stabilizers. "- "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces "- "and to prevent detectable ice crystals from forming. The result is a smooth, "- "semi-solid foam that is solid at very low temperatures (below 2 Β°C or 35 Β°F). "- "It becomes more malleable as its temperature increases.\n\n"- "The meaning of the name \"ice cream\" varies from one country to another. "- "In some countries, such as the United States, \"ice cream\" applies only to a specific variety, "- "and most governments regulate the commercial use of the various terms according to the "- "relative quantities of the main ingredients, notably the amount of cream. "- "Products that do not meet the criteria to be called ice cream are sometimes labelled "- "\"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, "- "one word is used fo\r all variants. Analogues made from dairy alternatives, "- "such as goat's or sheep's milk, or milk substitutes "- "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are "- "lactose intolerant, allergic to dairy protein or vegan."- )-- response = co.summarize(- text=text,- )- print(response)- ```- </Tab>- <Tab title="Javascript">- ```javascript- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const cohere = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- (async () => {- // Pass the above `cohere` object along with your Doku Ingester URL and API key and this will make sure that all Cohere calls are automatically tracked.- DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const summarize = await cohere.summarize({- text: "Ice cream is a sweetened frozen food typically eaten as a snack or dessert. "- + "It may be made from milk or cream and is flavoured with a sweetener, "- + "either sugar or an alternative, and a spice, such as cocoa or vanilla, "- + "or with fruit such as strawberries or peaches. "- + "It can also be made by whisking a flavored cream base and liquid nitrogen together. "- + "Food coloring is sometimes added, in addition to stabilizers. "- + "The mixture is cooled below the freezing point of water and stirred to incorporate air spaces "- + "and to prevent detectable ice crystals from forming. The result is a smooth, "- + "semi-solid foam that is solid at very low temperatures (below 2 Β°C or 35 Β°F). "- + "It becomes more malleable as its temperature increases.\n\n"- + "The meaning of the name \"ice cream\" varies from one country to another. "- + "In some countries, such as the United States, \"ice cream\" applies only to a specific variety, "- + "and most governments regulate the commercial use of the various terms according to the "- + "relative quantities of the main ingredients, notably the amount of cream. "- + "Products that do not meet the criteria to be called ice cream are sometimes labelled "- + "\"frozen dairy dessert\" instead. In other countries, such as Italy and Argentina, "- + "one word is used fo\r all variants. Analogues made from dairy alternatives, "- + "such as goat's or sheep's milk, or milk substitutes "- + "(e.g., soy, cashew, coconut, almond milk or tofu), are available for those who are "- + "lactose intolerant, allergic to dairy protein or vegan.",- });-- console.log(summarize);- })();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/cohere/introduction.mdx b/docs/0.1/integrations/cohere/introduction.mdxdeleted file mode 100644index 90bd57d3..00000000--- a/docs/0.1/integrations/cohere/introduction.mdx+++ /dev/null@@ -1,94 +0,0 @@-----title: 'Cohere integration'-sidebarTitle: 'Get Started'------DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor Cohere usage data and metrics from your Python/NodeJS code.--## Get Started--The integration is compatible with-- Cohere Python SDK client `>=5.0.0`-- Cohere JS/TS SDK client `>=7.6.0`--<Tabs>- <Tab title="Python">- ```shell- pip install dokumetry==0.1.1- ```-- ```python- import cohere- import dokumetry-- co = cohere.Client('YOUR_API_KEY')-- dokumetry.init(llm = co, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")- ```- </Tab>- <Tab title="Javascript">- ```shell- npm install [email protected]- ```-- ```javascript- import { CohereClient } from "cohere-ai";- import DokuMetry from 'dokumetry';-- const co = new CohereClient({- token: "YOUR_COHERE_API_KEY",- });-- DokuMetry.init({llm: co, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})- ```- </Tab>-</Tabs>--## Supported Endpoints-The following Cohere Endpoints are supported for monitoring with DokuMetry--- [Chat](/0.1/integrations/cohere/examples/cochat)-- [Generate](/0.1/integrations/cohere/examples/generate)-- [Summarize](/0.1/integrations/cohere/examples/summarize)-- [Embed](/0.1/integrations/cohere/examples/embed)--## Parameters--<Tabs>- <Tab title="Python">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Cohere Object to track | Yes |- | doku_url | URL of your Doku Ingester | Yes |- | api_key | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | application_name | Custom application name tag for your metrics | Optional |- | skip_resp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>- <Tab title="NodeJS">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Cohere Object to track | Yes |- | dokuUrl | URL of your Doku Ingester | Yes |- | apiKey | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | applicationName | Custom application name tag for your metrics | Optional |- | skipResp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>-</Tabs>--## Advanced Usage-When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.--To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.-------<CardGroup cols={2}>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/introduction.mdx b/docs/0.1/integrations/introduction.mdxdeleted file mode 100644index fc483028..00000000--- a/docs/0.1/integrations/introduction.mdx+++ /dev/null@@ -1,106 +0,0 @@-----sidebarTitle: 'Introduction'-title: 'Monitor your LLM usage'-description: 'Monitor LLM Costs, Tokens and Performance along with User Interactions'------Start integrating and monitoring your applications with Doku effortlessly. Choose from a range of providers to **start tracking LLM performance, usage, and costs** without hassle.--<CardGroup cols={2}>- <Card- title="OpenAI"- href="/0.1/integrations/openai/introduction"- icon={- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">- <title>OpenAI</title>- <path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" />- </svg>- }- iconType="duotone"- >- </Card>- <Card- title="Cohere"- href="/0.1/integrations/cohere/introduction"- icon={- <svg role="image" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">- <g>- <g>- <g>- <path d="M24.3,44.7c2,0,6-0.1,11.6-2.4c6.5-2.7,19.3-7.5,28.6-12.5c6.5-3.5,9.3-8.1,9.3-14.3C73.8,7,66.9,0,58.3,0- h-36C10,0,0,10,0,22.3S9.4,44.7,24.3,44.7z">- </path>- <path d="M30.4,60c0-6,3.6-11.5,9.2-13.8l11.3-4.7C62.4,36.8,75,45.2,75,57.6C75,67.2,67.2,75,57.6,75l-12.3,0- C37.1,75,30.4,68.3,30.4,60z">- </path>- <path d="M12.9,47.6L12.9,47.6C5.8,47.6,0,53.4,0,60.5v1.7C0,69.2,5.8,75,12.9,75h0c7.1,0,12.9-5.8,12.9-12.9v-1.7- C25.7,53.4,20,47.6,12.9,47.6z">- </path>- </g>- </g>- </g>- </svg>- }- iconType="duotone"- >- </Card>- <Card- title="Anthropic"- href="/0.1/integrations/anthropic/introduction"- icon={- <svg viewBox="0 0 255 255" xmlns="http://www.w3.org/2000/svg">- <path d="M147.486878,0 C147.486878,0 217.568251,175.780074 217.568251,175.780074 C217.568251,175.780074 256,175.780074 256,175.780074 C256,175.780074 185.918621,0 185.918621,0 C185.918621,0 147.486878,0 147.486878,0 C147.486878,0 147.486878,0 147.486878,0 Z"></path>- <path d="M66.1828124,106.221191 C66.1828124,106.221191 90.1624677,44.4471185 90.1624677,44.4471185 C90.1624677,44.4471185 114.142128,106.221191 114.142128,106.221191 C114.142128,106.221191 66.1828124,106.221191 66.1828124,106.221191 C66.1828124,106.221191 66.1828124,106.221191 66.1828124,106.221191 Z M70.0705318,0 C70.0705318,0 0,175.780074 0,175.780074 C0,175.780074 39.179211,175.780074 39.179211,175.780074 C39.179211,175.780074 53.5097704,138.86606 53.5097704,138.86606 C53.5097704,138.86606 126.817544,138.86606 126.817544,138.86606 C126.817544,138.86606 141.145724,175.780074 141.145724,175.780074 C141.145724,175.780074 180.324935,175.780074 180.324935,175.780074 C180.324935,175.780074 110.254409,0 110.254409,0 C110.254409,0 70.0705318,0 70.0705318,0 C70.0705318,0 70.0705318,0 70.0705318,0 Z"></path>- </svg>- }- iconType="duotone"- >- </Card>- <Card- title="Azure OpenAI"- href="/0.1/integrations/azure-openai/introduction"- icon={- <svg viewBox="0 0 525 525" xmlns="http://www.w3.org/2000/svg"><g>- <path d="M52.091 10.225h40.684L50.541 135.361a6.5 6.5 0 01-6.146 4.412H12.732c-3.553 0-6.477-2.923-6.477-6.476 0-.704.115-1.403.34-2.07L45.944 14.638a6.501 6.501 0 016.147-4.415v.002z" transform="translate(2.076 1.626) scale(3.37462)"/><path d="M377.371 319.374H159.644c-5.527 0-10.076 4.549-10.076 10.077 0 2.794 1.164 5.466 3.206 7.37l139.901 130.577a21.986 21.986 0 0015.004 5.91H430.96l-53.589-153.934z"/><path d="M52.091 10.225a6.447 6.447 0 00-6.161 4.498L6.644 131.12a6.457 6.457 0 00-.38 2.185c0 3.548 2.92 6.468 6.469 6.468H45.23a6.95 6.95 0 005.328-4.531l7.834-23.089 27.985 26.102a6.622 6.622 0 004.165 1.518h36.395l-15.962-45.615-46.533.011 28.48-83.944H52.091z" transform="translate(2.076 1.626) scale(3.37462)"/><path d="M104.055 14.631a6.492 6.492 0 00-6.138-4.406H52.575a6.493 6.493 0 016.138 4.406l39.35 116.594c.225.668.34 1.367.34 2.072 0 3.554-2.924 6.478-6.478 6.478h45.344c3.553-.001 6.476-2.925 6.476-6.478 0-.705-.115-1.404-.34-2.072l-39.35-116.594z" transform="translate(2.076 1.626) scale(3.37462)"/></g><defs><linearGradient id="prefix___Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(108.701 26.35 33.911) scale(131.7791)"><stop offset="0"/><stop offset="1"/></linearGradient><linearGradient id="prefix___Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(161.318 33.644 45.587) scale(10.31703)"><stop offset="0"/><stop offset=".07"/><stop offset=".32"/><stop offset=".62"/><stop offset="1"/></linearGradient><linearGradient id="prefix___Linear3" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(69.426 25.69 62.036) scale(131.9816)"><stop offset="0"/><stop offset="1"/></linearGradient></defs>- </svg>- }- iconType="duotone"- >- </Card>- <Card- title="Mistral"- href="/0.1/integrations/mistral/introduction"- icon={- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 355 355">- <path d="M0 0 C27.39 0 54.78 0 83 0 C83 17.82 83 35.64 83 54 C100.82 54 118.64 54 137 54 C137 71.82 137 89.64 137 108 C145.58 108 154.16 108 163 108 C163 90.18 163 72.36 163 54 C180.82 54 198.64 54 217 54 C217 36.18 217 18.36 217 0 C244.39 0 271.78 0 300 0 C300 90.09 300 180.18 300 273 C272.61 273 245.22 273 217 273 C217 237.36 217 201.72 217 165 C208.75 165 200.5 165 192 165 C192 182.82 192 200.64 192 219 C164.28 219 136.56 219 108 219 C108 201.18 108 183.36 108 165 C99.75 165 91.5 165 83 165 C83 200.64 83 236.28 83 273 C55.61 273 28.22 273 0 273 C0 182.91 0 92.82 0 0 Z "/>- <path d="M0 0 C27.39 0 54.78 0 83 0 C83 35.97 83 71.94 83 109 C37.79 109 -7.42 109 -54 109 C-54 90.85 -54 72.7 -54 54 C-36.18 54 -18.36 54 0 54 C0 36.18 0 18.36 0 0 Z "/>- <path d="M0 0 C18.48 0 36.96 0 56 0 C56 17.82 56 35.64 56 54 C73.82 54 91.64 54 110 54 C110 72.15 110 90.3 110 109 C73.7 109 37.4 109 0 109 C0 73.03 0 37.06 0 0 Z "/>- <path d="M0 0 C8.91 0 17.82 0 27 0 C27 90.09 27 180.18 27 273 C18.09 273 9.18 273 0 273 C0 182.91 0 92.82 0 0 Z " transform="translate(0,0)"/>- <path d="M0 0 C9.57 0 19.14 0 29 0 C29 17.82 29 35.64 29 54 C46.82 54 64.64 54 83 54 C83 72.15 83 90.3 83 109 C55.61 109 28.22 109 0 109 C0 73.03 0 37.06 0 0 Z "/>- <path d="M0 0 C1.01154144 -0.00311188 2.02308289 -0.00622375 3.0652771 -0.00942993 C4.7290892 -0.00645401 4.7290892 -0.00645401 6.42651367 -0.00341797 C7.57181549 -0.00473724 8.71711731 -0.00605652 9.89712524 -0.00741577 C13.62960487 -0.0093378 17.3620104 -0.00299456 21.09448242 0.00439453 C22.34907257 0.00528076 23.60366272 0.00616699 24.89627075 0.00708008 C42.72160294 0.02199104 60.47499934 0.28646042 78.28198242 1.12939453 C78.28198242 19.27939453 78.28198242 37.42939453 78.28198242 56.12939453 C50.56198242 56.12939453 22.84198242 56.12939453 -5.71801758 56.12939453 C-5.73864258 47.07501953 -5.75926758 38.02064453 -5.78051758 28.69189453 C-5.79417358 24.39847046 -5.79417358 24.39847046 -5.80810547 20.01831055 C-5.8110244 17.76497444 -5.81357301 15.5116378 -5.81567383 13.25830078 C-5.82078979 12.07586792 -5.82590576 10.89343506 -5.83117676 9.6751709 C-5.83129761 8.55864136 -5.83141846 7.44211182 -5.83154297 6.29174805 C-5.83376358 5.31689957 -5.83598419 4.34205109 -5.83827209 3.33766174 C-5.61659259 -0.73310076 -3.57396693 0.00319344 0 0 Z "/>- <path d="M0 0 C0.33 0 0.66 0 1 0 C1 35.97 1 71.94 1 109 C19.15 109 37.3 109 56 109 C56 127.15 56 145.3 56 164 C37.52 164 19.04 164 0 164 C0 109.88 0 55.76 0 0 Z "/>- <path d="M0 0 C9.24 0 18.48 0 28 0 C28 35.97 28 71.94 28 109 C18.76 109 9.52 109 0 109 C0 73.03 0 37.06 0 0 Z " transform="translate(217,164)"/>- <path d="M0 0 C18.15 0 36.3 0 55 0 C55.020625 8.889375 55.04125 17.77875 55.0625 26.9375 C55.071604 29.74757568 55.08070801 32.55765137 55.09008789 35.45288086 C55.09300683 37.66520134 55.09555544 39.87752235 55.09765625 42.08984375 C55.10277222 43.25068481 55.10788818 44.41152588 55.11315918 45.60754395 C55.11334045 47.25188416 55.11334045 47.25188416 55.11352539 48.92944336 C55.115746 49.88652695 55.11796661 50.84361053 55.12025452 51.82969666 C55 54 55 54 54 55 C52.31198015 55.09353163 50.62004793 55.11744791 48.92944336 55.11352539 C47.83321655 55.11340454 46.73698975 55.11328369 45.60754395 55.11315918 C44.44670288 55.10804321 43.28586182 55.10292725 42.08984375 55.09765625 C41.02930786 55.09664917 39.96877197 55.09564209 38.87609863 55.09460449 C34.89655483 55.08935387 30.91702638 55.07539276 26.9375 55.0625 C18.048125 55.041875 9.15875 55.02125 0 55 C0 36.85 0 18.7 0 0 Z "/>- <path d="M0 0 C7.33845237 -0.02590394 14.6768925 -0.04309155 22.01538086 -0.05493164 C24.49845825 -0.05988087 26.98153287 -0.0666419 29.46459961 -0.07543945 C47.00774093 -0.13592078 64.47120007 0.2552166 82 1 C82 18.82 82 36.64 82 55 C64.18 55 46.36 55 28 55 C28 37.18 28 19.36 28 1 C18.76 1 9.52 1 0 1 C0 0.67 0 0.34 0 0 Z "/>- <path d="M0 0 C18.15 0 36.3 0 55 0 C55 17.82 55 35.64 55 54 C36.85 54 18.7 54 0 54 C0 36.18 0 18.36 0 0 Z "/>- <path d="M0 0 C17.82 0 35.64 0 54 0 C54 18.15 54 36.3 54 55 C36.18 55 18.36 55 0 55 C0 36.85 0 18.7 0 0 Z "/>- <path d="M0 0 C9.24 0 18.48 0 28 0 C28 18.15 28 36.3 28 55 C18.76 55 9.52 55 0 55 C0 36.85 0 18.7 0 0 Z "/>- <path d="M0 0 C9.24 0 18.48 0 28 0 C28 18.15 28 36.3 28 55 C18.76 55 9.52 55 0 55 C0 36.85 0 18.7 0 0 Z "/>- <path d="M0 0 C9.24 0 18.48 0 28 0 C28 17.82 28 35.64 28 54 C18.76 54 9.52 54 0 54 C0 36.18 0 18.36 0 0 Z "/>- </svg>- }- iconType="duotone"- >- </Card>-</CardGroup>-------<CardGroup cols={2}>-<Card title="Quickstart" href="/0.1/quickstart" icon='bolt'>-Get Started with monitoring your LLM Applications in 2 simple steps-</Card>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/mistral/examples/embedding.mdx b/docs/0.1/integrations/mistral/examples/embedding.mdxdeleted file mode 100644index a9a3dc71..00000000--- a/docs/0.1/integrations/mistral/examples/embedding.mdx+++ /dev/null@@ -1,79 +0,0 @@-----title: 'Embedding'-description: 'Monitor Mistral Embedding API Usage'------<Tabs>- <Tab title="Python">-- ### Synchronous Usage-- ```python default- from mistralai.client import MistralClient- import dokumetry-- mistral = MistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = mistral.embeddings(- model="mistral-embed",- input=["Monitor LLM Applications"]- )- print(response)- ```-- ### Asynchronous usage- ```python default- import asyncio- from mistralai.client import AsyncMistralClient- import dokumetry-- mistral = AsyncMistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- mistral.embeddings(- model="mistral-embed",- input=["Monitor LLM Applications"]- )-- print(response)-- asyncio.run(main())- ```- </Tab>- <Tab title="Javascript">-- ```javascript default- import MistralClient from '@mistralai/mistralai';- import DokuMetry from 'dokumetry';-- const mistral = new MistralClient("YOUR_MISTRAL_API_KEY");-- // Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- DokuMetry.init({llm: mistral, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const input = [];- for (let i = 0; i < 1; i++) {- input.push('LLM Monitoring');- }- const embeddingsBatchResponse = await mistral.embeddings({- model: 'mistral-embed',- input: input,- });- }-- main();- ```- </Tab>-</Tabs>-diff --git a/docs/0.1/integrations/mistral/examples/mistral-chat.mdx b/docs/0.1/integrations/mistral/examples/mistral-chat.mdxdeleted file mode 100644index cde33eaf..00000000--- a/docs/0.1/integrations/mistral/examples/mistral-chat.mdx+++ /dev/null@@ -1,142 +0,0 @@-----title: 'Chat'-description: 'Monitor Mistral `chat` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">-- ### Synchronous Usage- <CodeGroup>- ```python default- from mistralai.client import MistralClient- import dokumetry-- mistral = MistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = mistral.chat(- model="mistral-small-latest",- messages=[ChatMessage(role="user", content="Guide to Monitor my LLM Applications")],- )- print(response)- ```-- ```python streaming- from mistralai.client import MistralClient- import dokumetry-- mistral = MistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = mistral.chat_stream(- model="mistral-small-latest",- messages=[ChatMessage(role="user", content="Guide to Monitor my LLM Applications")],- )- for chunk in response:- print(chunk)- ```- </CodeGroup>-- ### Asynchronous usage- <CodeGroup>- ```python default- import asyncio- from mistralai.client import AsyncMistralClient- import dokumetry-- mistral = AsyncMistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- response = mistral.chat(- model="mistral-small-latest",- messages=[ChatMessage(role="user", content="Guide to Monitor my LLM Applications")],- )- print(message)-- asyncio.run(main())- ```-- ```python streaming- import asyncio- from mistralai.client import AsyncMistralClient- import dokumetry-- mistral = AsyncMistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- # Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- dokumetry.init(llm=mistral, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- response = mistral.chat_stream(- model="mistral-small-latest",- messages=[ChatMessage(role="user", content="Guide to Monitor my LLM Applications")],- )- for chunk in response:- print(chunk)-- asyncio.run(main())- ```- </CodeGroup>- </Tab>- <Tab title="Javascript">- <CodeGroup>-- ```javascript default- import MistralClient from '@mistralai/mistralai';- import DokuMetry from 'dokumetry';-- const mistral = new MistralClient("YOUR_MISTRAL_API_KEY");-- // Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- DokuMetry.init({llm: mistral, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await mistral.chat({- model: 'mistral-small-latest',- messages: [{role: 'user', content: 'What is LLM Observability?'}],- });-- console.log(response);- }-- main();- ```-- ```javascript streaming- import MistralClient from '@mistralai/mistralai';- import DokuMetry from 'dokumetry';-- const mistral = new MistralClient("YOUR_MISTRAL_API_KEY");-- // Pass the above `mistral` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.- DokuMetry.init({llm: mistral, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const response = await mistral.chatStream({- model: 'mistral-small-latest',- messages: [{role: 'user', content: 'What is LLM Observability?'}],- });-- for await (const message of response) {- console.log(message)- }- ```- </CodeGroup>- </Tab>-</Tabs>-diff --git a/docs/0.1/integrations/mistral/introduction.mdx b/docs/0.1/integrations/mistral/introduction.mdxdeleted file mode 100644index f79022c9..00000000--- a/docs/0.1/integrations/mistral/introduction.mdx+++ /dev/null@@ -1,92 +0,0 @@-----title: 'Mistral Integration'-sidebarTitle: 'Get Started'------DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor Mistral usage data and metrics from your Python/NodeJS code.--## Get Started--The integration is compatible with-- Mistral Python SDK client `>=0.1.0`-- Mistral JS/TS SDK client `>=0.1.0`--<Tabs>- <Tab title="Python">- ```shell- pip install dokumetry==0.1.1- ```-- ```python- from mistralai.client import MistralClient- import dokumetry-- mistral = MistralClient(- api_key="YOUR_MISTRAL_API_KEY"- )-- dokumetry.init(llm = Mistral, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")- ```- </Tab>- <Tab title="Javascript">- ```shell- npm install [email protected]- ```-- ```javascript- import MistralClient from '@mistralai/mistralai';- import DokuMetry from 'dokumetry';-- const mistral = new MistralClient("YOUR_MISTRAL_API_KEY");-- DokuMetry.init({llm: mistral, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})- ```- </Tab>-</Tabs>--## Supported Endpoints--The following Mistral Endpoints are supported for monitoring with DokuMetry--- [chat](/0.1/integrations/mistral/examples/mistral-chat)-- [embedding](/0.1/integrations/mistral/examples/embedding)--## Parameters-<Tabs>- <Tab title="Python">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Mistral Object to track | Yes |- | doku_url | URL of your Doku Ingester | Yes |- | api_key | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | application_name | Custom application name tag for your metrics | Optional |- | skip_resp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>- <Tab title="NodeJS">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | Mistral Object to track | Yes |- | dokuUrl | URL of your Doku Ingester | Yes |- | apiKey | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | applicationName | Custom application name tag for your metrics | Optional |- | skipResp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>-</Tabs>--## Advanced Usage-When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.--To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.-------<CardGroup cols={2}>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/audio.mdx b/docs/0.1/integrations/openai/examples/audio.mdxdeleted file mode 100644index 7a1108c2..00000000--- a/docs/0.1/integrations/openai/examples/audio.mdx+++ /dev/null@@ -1,58 +0,0 @@-----title: 'Audio'-description: 'Monitor OpenAI Audio API usage'------## Create Speech--<Tabs>- <Tab title="Python">- ```python- from pathlib import Path- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- speech_file_path = Path(__file__).parent / "speech.mp3"- response = client.audio.speech.create(- model= "tts-1",- voice= "alloy",- input= "The quick brown fox jumped over the lazy dog."- )- response.stream_to_file(speech_file_path)- ```- </Tab>- <Tab title="NodeJS">- ```javascript- import fs from "fs";- import path from "path";- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- const speechFile = path.resolve("./speech.mp3");-- async function main() {- const mp3 = await openai.audio.speech.create({- model: "tts-1",- voice: "alloy",- input: "Today is a wonderful day to build something people love!",- });- console.log(speechFile);- const buffer = Buffer.from(await mp3.arrayBuffer());- await fs.promises.writeFile(speechFile, buffer);- }- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/chatCompletions.mdx b/docs/0.1/integrations/openai/examples/chatCompletions.mdxdeleted file mode 100644index f4770f05..00000000--- a/docs/0.1/integrations/openai/examples/chatCompletions.mdx+++ /dev/null@@ -1,472 +0,0 @@-----title: 'Chat Completions'-description: 'Monitor OpenAI `chat.completions` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">-- ### Synchronous Usage- <CodeGroup>- ```python Default- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model="gpt-3.5-turbo",- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ]- )-- print(completion.choices[0].message)- ```-- ```python Image Input- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.chat.completions.create(- model="gpt-4-vision-preview",- messages=[- {- "role": "user",- "content": [- {"type": "text", "text": "Whatβs in this image?"},- {- "type": "image_url",- "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",- },- ],- }- ],- max_tokens=300,- )-- print(response.choices[0])- ```-- ```python Streaming- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model="gpt-3.5-turbo",- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream=True- )-- for chunk in completion:- print(chunk.choices[0].delta)- ```-- ```python Functions- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ]- messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]- completion = client.chat.completions.create(- model="gpt-3.5-turbo",- messages=messages,- tools=tools,- tool_choice="auto"- )-- print(completion)- ```-- ```python LogProbs- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- completion = client.chat.completions.create(- model="gpt-3.5-turbo",- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- logprobs=True,- top_logprobs=2- )-- print(completion.choices[0].message)- print(completion.choices[0].logprobs)- ```- </CodeGroup>-- ### Asynchronous Usage-- <CodeGroup>- ```python Default- import asyncio- from openai import AsyncOpenAI- import dokumetry-- client = AsyncOpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- chat_completion = await client.chat.completions.create(- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- model="gpt-3.5-turbo",- )-- asyncio.run(main())- ```-- ```python Image Input- import asyncio- from openai import AsyncOpenAI- import dokumetry-- client = AsyncOpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- response = await client.chat.completions.create(- model="gpt-4-vision-preview",- messages=[- {- "role": "user",- "content": [- {"type": "text", "text": "Whatβs in this image?"},- {- "type": "image_url",- "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",- },- ],- }- ],- max_tokens=300,- )-- asyncio.run(main())- ```-- ```python Streaming- import asyncio- from openai import AsyncOpenAI- import dokumetry-- client = AsyncOpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main():- stream = await client.chat.completions.create(- model="gpt-4",- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream=True,- )- async for chunk in stream:- print(chunk.choices[0].delta.content or "", end="")--- asyncio.run(main())- ```-- ```python Functions- import asyncio- from openai import AsyncOpenAI- import dokumetry-- client = AsyncOpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ]- messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]-- async def main() -> None:- completion = await client.chat.completions.create(- model="gpt-3.5-turbo",- messages=messages,- tools=tools,- tool_choice="auto"- )-- asyncio.run(main())- ```-- ```python LogProbs- import asyncio- from openai import AsyncOpenAI- import dokumetry-- client = AsyncOpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- async def main() -> None:- completion = await client.chat.completions.create(- model="gpt-3.5-turbo",- messages=[- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- logprobs=True,- top_logprobs=2- )-- asyncio.run(main())- ```- </CodeGroup>- </Tab>- <Tab title="NodeJS">- <CodeGroup>- ```javascript Default- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await openai.chat.completions.create({- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- model: "gpt-3.5-turbo",- });-- console.log(completion.choices[0]);- }-- main();- ```-- ```javascript Image Input- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await openai.chat.completions.create({- model: "gpt-4-vision-preview",- messages: [- {- role: "user",- content: [- { type: "text", text: "Whatβs in this image?" },- {- type: "image_url",- image_url:- "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",- },- ],- },- ],- });- console.log(response.choices[0]);- }- main();- ```-- ```javascript Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await openai.chat.completions.create({- model: "gpt-3.5-turbo",- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- stream: true,- });-- for await (const chunk of completion) {- console.log(chunk.choices[0].delta.content);- }- }-- main();- ```-- ```javascript Functions- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const messages = [{"role": "user", "content": "What's the weather like in Boston today?"}];- const tools = [- {- "type": "function",- "function": {- "name": "get_current_weather",- "description": "Get the current weather in a given location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- },- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},- },- "required": ["location"],- },- }- }- ];-- const response = await openai.chat.completions.create({- model: "gpt-3.5-turbo",- messages: messages,- tools: tools,- tool_choice: "auto",- });-- console.log(response);- }-- main();- ```-- ```javascript LogProbs- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const completion = await openai.chat.completions.create({- messages: [- {"role": "system", "content": "You are a expert at monitoring LLM Applications"},- {"role": "user", "content": "Hello! How do I monitor my OpenAI based LLM Applications?"}- ],- model: "gpt-3.5-turbo",- logprobs: true,- top_logprobs: 2,- });-- console.log(completion.choices[0]);- }-- main();- ```- </CodeGroup>- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/completions.mdx b/docs/0.1/integrations/openai/examples/completions.mdxdeleted file mode 100644index 07a00c0d..00000000--- a/docs/0.1/integrations/openai/examples/completions.mdx+++ /dev/null@@ -1,96 +0,0 @@-----title: 'Completions'-description: 'Monitor OpenAI `completions` API usage for cost, performance & user interactions'------<Tabs>- <Tab title="Python">- <CodeGroup>- ```python No Streaming- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.completions.create(- model="gpt-3.5-turbo-instruct",- prompt="What is LLM Observablity?",- )-- print(respomse.choices[0].text)- ```-- ```python Streaming- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.completions.create(- model="gpt-3.5-turbo-instruct",- prompt="How to monitor LLM Applications?",- stream=True- )-- for chunk in respomse:- print(chunk.choices[0].text)- ```- </CodeGroup>- </Tab>- <Tab title="NodeJS">- <CodeGroup>- ```javascript No Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await openai.completions.create({- model: "gpt-3.5-turbo-instruct",- prompt: "How to monitor LLM Applications?",- });-- console.log(response);- }- main();- ```-- ```javascript Streaming- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const response = await openai.completions.create({- model: "gpt-3.5-turbo-instruct",- prompt: "How to monitor LLM Applications?",- stream: true,- });-- for await (const chunk of response) {- console.log(chunk.choices[0].text)- }- }- main();- ```- </CodeGroup>- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/embeddings.mdx b/docs/0.1/integrations/openai/examples/embeddings.mdxdeleted file mode 100644index c72bf9a9..00000000--- a/docs/0.1/integrations/openai/examples/embeddings.mdx+++ /dev/null@@ -1,50 +0,0 @@-----title: 'Embeddings'-description: 'Monitor OpenAI Embeddings API usage'------## Create Embeddings-<Tabs>- <Tab title="Python">- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- client.embeddings.create(- model="text-embedding-ada-002",- input="The food was delicious and the waiter...",- encoding_format="float"- )- ```- </Tab>- <Tab title="javascript">- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const embedding = await openai.embeddings.create({- model: "text-embedding-ada-002",- input: "The quick brown fox jumped over the lazy dog",- encoding_format: "float",- });-- console.log(embedding);- }-- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/fine-tuning.mdx b/docs/0.1/integrations/openai/examples/fine-tuning.mdxdeleted file mode 100644index 4be10b0e..00000000--- a/docs/0.1/integrations/openai/examples/fine-tuning.mdx+++ /dev/null@@ -1,47 +0,0 @@-----title: 'Fine Tuning'-description: 'Monitor OpenAI Fine Tuning API usage'------## Create Fine Tuning Job-<Tabs>- <Tab title="Python">- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- client.fine_tuning.jobs.create(- training_file="file-abc123",- model="gpt-3.5-turbo"- )- ```- </Tab>- <Tab title="javascript">- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const fineTune = await openai.fineTuning.jobs.create({- training_file: "file-abc123"- });-- console.log(fineTune);- }-- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/examples/image.mdx b/docs/0.1/integrations/openai/examples/image.mdxdeleted file mode 100644index f327ebf1..00000000--- a/docs/0.1/integrations/openai/examples/image.mdx+++ /dev/null@@ -1,94 +0,0 @@-----title: 'Image'-description: 'Monitor OpenAI `image` API usage for cost, performance & user interactions'------## Create Image--<Tabs>- <Tab title="Python">- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- image = client.images.generate(- model="dall-e-3",- prompt="Create a dashboard for LLM Observability data",- n=1,- size="1024x1024"- )-- print(image.data)- ```- </Tab>- <Tab title="Javascript">- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const image = await openai.images.generate({ model: "dall-e-3", prompt: "Create a dashboard for LLM Observability data" });-- console.log(image.data);- }- main();- ```- </Tab>-</Tabs>--## Create Image Variation--<Tabs>- <Tab title="Python">- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key = "YOUR_OPENAI_API_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-- response = client.images.create_variation(- image=open("image_edit_original.png", "rb"),- n=2,- size="1024x1024"- )- ```- </Tab>- <Tab title="Javascript">- ```javascript- import fs from "fs";- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const openai = new OpenAI();-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const image = await openai.images.createVariation({- image: fs.createReadStream("otter.png"),- });-- console.log(image.data);- }- main();- ```- </Tab>-</Tabs>\ No newline at end of filediff --git a/docs/0.1/integrations/openai/introduction.mdx b/docs/0.1/integrations/openai/introduction.mdxdeleted file mode 100644index 0a03cc63..00000000--- a/docs/0.1/integrations/openai/introduction.mdx+++ /dev/null@@ -1,95 +0,0 @@-----title: 'OpenAI Integration'-sidebarTitle: 'Get Started'------DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor OpenAI usage data and metrics from your Python/NodeJS code.--## Get Started--The integration is compatible with-- OpenAI Python SDK client `>=1.13.0`-- OpenAI JS/TS SDK client `>=4.28.0`--<Tabs>- <Tab title="Python">- ```shell- pip install dokumetry==0.1.1- ```-- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI()-- dokumetry.init(llm = client, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")- ```- </Tab>- <Tab title="Javascript">- ```shell- npm install [email protected]- ```-- ```javascript- import OpenAI from "openai";- import DokuMetry from 'dokumetry';-- const client = new OpenAI();-- DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})- ```- </Tab>-</Tabs>--## Supported Endpoints--The following OpenAI Endpoints are supported for monitoring with DokuMetry--- [Chat completions](/0.1/integrations/openai/examples/chatCompletions)-- [Image Create](/0.1/integrations/openai/examples/image#create-image) and [Image Variations](/0.1/integrations/openai/examples/image#create-image-variation)-- [Audio Speech Create](/0.1/integrations/openai/examples/audio)-- [Embeddings](/0.1/integrations/openai/examples/embeddings)-- [Fine Tunings](/0.1/integrations/openai/examples/fine-tuning)-- [Completions](/0.1/integrations/openai/examples/completions)--## Parameters--<Tabs>- <Tab title="Python">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | OpenAI Object to track | Yes |- | doku_url | URL of your Doku Ingester | Yes |- | api_key | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | application_name | Custom application name tag for your metrics | Optional |- | skip_resp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>- <Tab title="NodeJS">- | Parameter | Description | Required |- |-------------------|-----------------------------------------------------------|---------------|- | llm | OpenAI Object to track | Yes |- | dokuUrl | URL of your Doku Ingester | Yes |- | apiKey | Your Doku API key | Yes |- | environment | Custom environment tag to include in your metrics | Optional |- | applicationName | Custom application name tag for your metrics | Optional |- | skipResp | Skip response from the Doku Ingester for faster execution | Optional |- </Tab>-</Tabs>--## Advanced Usage-When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.--To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.-------<CardGroup cols={2}>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-<Card title="API Reference" href="/0.1/api-reference/introduction" icon='code'>-OpenAPI specification for API Endpoints in Doku-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/introduction.mdx b/docs/0.1/introduction.mdxdeleted file mode 100644index fb716d2a..00000000--- a/docs/0.1/introduction.mdx+++ /dev/null@@ -1,79 +0,0 @@-----title: What is Doku?-description: 'Open-source platform for monitoring and evaluating LLMs at scale'------<iframe- width="560"- height="315"- src="https://www.youtube.com/embed/6jhxVesllEY?si=M8dkLVVE2G7WhmBo"- title="Demo: Monitoring LLM Application with Doku"- frameborder="0"- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; playsinline"- allowfullscreen-></iframe>--Doku is an **open-source LLMOps tool** engineered to enables developers with comprehensive capabilities to monitor, analyze, and optimize LLM applications. It provides valuable real-time data on **LLM usage, performance, and costs**. Through seamless integrations with leading LLM platforms, including OpenAI, Cohere, and Anthropic, Doku acts as a central command center for all your LLM needs. It effectively guides your efforts, ensuring that your LLM applications not only operate at peak efficiency but also scale successfully.--## Why use Doku?-Get advanced monitoring and evaluation for your LLM applications with these key benefits:--- **Granular Usage Insights of your LLM Applications**: Assess your LLM's performance and costs with fine-grained control, breaking down metrics by environment (such as staging or production) or application, to optimize for efficiency and scalability.-- **Real-Time Data Streaming**: Unlike other platforms where you might wait minutes to see your data due to data being sent in batches, Doku is able to display data as it streams. This immediate insight enables quick decision-making and adjustments.-- **Zero Added Latency**: Doku's smart data handling ensures rapid data processing without impacting your application's performance, maintaining the responsiveness of your LLM applications.-- **Connect to Observability Platforms**: Doku seamlessly connects with leading observability platforms like Grafana Cloud and Datadog, among others to automatically export data.--## How it works-<Frame>- <img src="https://raw.githubusercontent.com/dokulabs/.github/main/profile/assets/banner.gif" />-</Frame>--### Step 1: Instrument your Application-Integrating the `dokumetry` SDK into LLM applications is straightforward with SDKs designed for Python and NodeJS. Start monitoring for your LLM Application with just **two lines of code**:--<CodeGroup>-```python python-import dokumetry--dokumetry.init(llm=openai, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")-```--```javascript NodeJS-import DokuMetry from 'dokumetry';--DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})-```-</CodeGroup>--### Step 2: Data processed by Doku Ingester-Once the `dokumetry` SDKs are configured in your LLM application, Monitoring data starts streaming to the [Doku Ingester](https://github.com/dokulabs/doku/tree/main/src/ingester#readme). It processes and safely stores your data in ClickHouse, keeping your LLM Monitoring data **secure** and **compliant** in your environment.--You can choose to use a new ClickHouse database setup or connect to your existing one to work with Doku.--### Step 3: Visualize and analyze-With your LLM monitoring data processed and securely stored, you can now leverage the Doku UI for in-depth visualization and analysis. Doku UI allows you to explore LLM costs, token usage, performance metrics, and user interactions in an intuitive interface. This powerful tool enhances your ability to observe and optimize your LLM applications, ensuring you make data-driven decisions for improvement.--<Frame>- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-2.jpg?raw=true" />- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-3.jpg?raw=true" />-</Frame>--For those with a preferred observability platform, you can also integrate and visualize this data elsewhere with ease. This flexibility ensures optimal monitoring workflow integration, regardless of your platform choice. For more details on how to set up these connections, check out the [Connections](https://example.com/0.1/connections/intro) guide.-## Getting Started-Select from the following guides to learn more about how to use Doku:--<CardGroup cols={2}>-<Card title="Quickstart" href="/0.1/quickstart" icon='bolt'>-Get Started with monitoring your LLM Applications in 2 simple steps-</Card>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="Installation" href="/0.1/installation" icon='circle-down'>-Deploy Doku in your preferred environment-</Card>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/0.1/quickstart.mdx b/docs/0.1/quickstart.mdxdeleted file mode 100644index d17e0dcc..00000000--- a/docs/0.1/quickstart.mdx+++ /dev/null@@ -1,199 +0,0 @@-----title: 'Quickstart'-description: 'Quickly start **monitoring** your **LLM Applications** in just **two lines** of code'-icon: 'bolt'------This guide will walk you through setting up monitoring for your LLM Application with minimal effort. In just a few steps, you'll be able to track and analyze the performance and usage of your Large Language Model (LLM) applications.--<Steps>- <Step title="Deploy Doku">- <Steps>- <Step title="Prepare your Environment">- ```yaml docker-compose.yml- version: '3.8'-- services:- clickhouse:- image: clickhouse/clickhouse-server:24.2.2- container_name: clickhouse- environment:- CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- CLICKHOUSE_USER: ${DOKU_DB_USER:-default}- volumes:- - clickhouse-data:/var/lib/clickhouse- ports:- - "9000:9000"- - "8123:8123"- restart: always-- doku-ingester:- image: ghcr.io/dokulabs/doku-ingester:0.1.3- container_name: doku-ingester- environment:- DOKU_DB_HOST: clickhouse- DOKU_DB_PORT: 9000- DOKU_DB_NAME: ${DOKU_DB_NAME:-default}- DOKU_DB_USER: ${DOKU_DB_USER:-default}- DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- ports:- - "9044:9044"- depends_on:- - clickhouse- restart: always-- doku-client:- image: ghcr.io/dokulabs/doku-client:0.1.3- container_name: doku-client- environment:- INIT_DB_HOST: clickhouse- INIT_DB_PORT: 8123- INIT_DB_DATABASE: ${DOKU_DB_NAME:-default}- INIT_DB_USERNAME: ${DOKU_DB_USER:-default}- INIT_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- SQLITE_DATABASE_URL: file:/app/client/data/data.db- ports:- - "3000:3000"- depends_on:- - clickhouse- volumes:- - doku-client-data:/app/client/data- restart: always-- volumes:- clickhouse-data:- doku-client-data:- ```- </Step>- <Step title="Launch Doku">- ```shell- docker-compose up -d- ```- </Step>- </Steps>- </Step>- <Step title="Access Doku UI and Generate an API Key">- With Doku running, the next step is to access the Doku UI and generate an API key for secure communication between your applications and Doku.- 1. Open your browser and go to Doku UI at `127.0.0.1:3000/login`- 2. Login using theb default credentials- - Email as `[email protected]`- - Password as `dokulabsuser`- 3. Once you have logged into Doku UI, Go to [API Keys page](http://127.0.0.1:3000/api-keys) and Create an API Key. Copy the generated API Key.-- <Tip>Alternatively, you can use the HTTP API to create your Doku API Key. For further details, take a look at the [API Reference](/0.1/api-reference/endpoint/api-keys/create) section.</Tip>- </Step>- <Step title="Instrument your Application">- Choose the appropriate SDK for your LLM application's programming language and follow the steps to integrate monitoring with just **two lines of code**.- <Tabs>- <Tab title="Python">- <Steps>- <Step title="Install the dokumetry Python SDK using pip">- ```shell- pip install dokumetry- ```- </Step>- <Step title="Add the following two lines to your application code:">- Add the snippet below to your Python application, replace `YOUR_DOKU_TOKEN` with API key you created in Step 2.-- ```python- import dokumetry-- dokumetry.init(llm=client, doku_url="http://127.0.0.1:9044/", api_key="YOUR_DOKU_TOKEN")- ```-- Example Usage for monitoring `OpenAI` Usage:-- ```python- from openai import OpenAI- import dokumetry-- client = OpenAI(- api_key="YOUR_OPENAI_KEY"- )-- # Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- dokumetry.init(llm=client, doku_url="http://127.0.0.1:9044/", api_key="YOUR_DOKU_TOKEN")-- chat_completion = client.chat.completions.create(- messages=[- {- "role": "user",- "content": "What is LLM Observability",- }- ],- model="gpt-3.5-turbo",- )- ```-- Refer to the `dokumetry` [Python SDK repository](https://github.com/dokulabs/dokumetry-python) for more advanced configurations and use cases.- </Step>- </Steps>- </Tab>- <Tab title="NodeJS">- <Steps>- <Step title="Install the dokumetry NodeJS SDK using npm">- ```shell- npm install dokumetry- ```- </Step>- <Step title="Add the following two lines to your application code">- Add the snippet below to your NodeJS application, replace `YOUR_DOKU_TOKEN` with API key you created in Step 2.- ```javascript- import DokuMetry from 'dokumetry';-- DokuMetry.init({llm: openai, dokuUrl: "http://127.0.0.1:9044/", apiKey: "YOUR_DOKU_TOKEN"})- ```-- Example Usage for monitoring `OpenAI` Usage:-- ```javascript- import OpenAI from 'openai';- import DokuMetry from 'dokumetry';-- const openai = new OpenAI({- apiKey: 'My API Key', // defaults to process.env["OPENAI_API_KEY"]- });-- // Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.- DokuMetry.init({llm: openai, dokuUrl: "http://127.0.0.1:9044/", apiKey: "YOUR_DOKU_TOKEN"})-- async function main() {- const chatCompletion = await openai.chat.completions.create({- messages: [{ role: 'user', content: 'What are the key to effective observability?' }],- model: 'gpt-3.5-turbo',- });- }-- main();- ```-- Refer to the `dokumetry` [NodeJS SDK repository](https://github.com/dokulabs/dokumetry-node) for more advanced configurations and use cases.- </Step>- </Steps>- </Tab>- </Tabs>- </Step>- <Step title="Visualize and Analyze">- Once you have Doku Ingester and `DokuMetry` SKDs set up, you can instantly get insights into how your LLM applications. Just head over to Doku UI at `127.0.0.1:3000` on your browser to start exploring.--With Doku, you get a simple, powerful view into important info like how much you're spending on LLMs, which parts of your app are using them the most, and how well they're performing. Find out which LLM models are favorites among your applications, and dive deep into performance details to make smart decisions. This setup is perfect for optimizing your app performance and keeping an eye on costs.- <Frame>- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-1.jpg?raw=true" />- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-2.jpg?raw=true" />- <img src="https://github.com/dokulabs/.github/blob/main/profile/assets/doku-client-3.jpg?raw=true" />- </Frame>- </Step>-</Steps>--You're all set! Following these steps should have you on your way to effectively monitoring your LLM applications. If you have any questions or need support, reach out to our [community](https://join.slack.com/t/doku-0tq5728/shared_invite/zt-2a9aql9xx-FN5EIZ2DtZ~XtJoYdxUDtA).-------<CardGroup cols={2}>-<Card title="Integrations" href="/0.1/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku-</Card>-<Card title="Connections" href="/0.1/connections/intro" icon='link'>-Connect to your existing Observablity Platform-</Card>-</CardGroup>\ No newline at end of filediff --git a/docs/latest/configuration.mdx b/docs/latest/configuration.mdxindex 1e0ff873..8b79b933 100644--- a/docs/latest/configuration.mdx+++ b/docs/latest/configuration.mdx@@ -1,17 +1,17 @@---title: 'Configuration'-description: 'Configuring Options for Doku'+description: 'Configuring Options for OpenLIT'icon: 'sliders'----This guide covers all the available environment variables to fine-tune Doku according to your needs.+This guide covers all the available environment variables to fine-tune OpenLIT according to your needs.-## Doku Client+## OpenLIT Client### Environment Varibales<ResponseField name="INIT_DB_HOST" required>- Sets the host address of the ClickHouse server for Doku Client to connect+ Sets the host address of the ClickHouse server for OpenLIT Client to connect**Example**:```yaml@@ -29,7 +29,7 @@ This guide covers all the available environment variables to fine-tune Doku acco</ResponseField><ResponseField name="INIT_DB_DATABASE" required>- Sets the name of the database in Clickhouse to be used by Doku+ Sets the name of the database in Clickhouse to be used by OpenLIT**Example**:```yaml@@ -71,16 +71,16 @@ INIT_DB_HOST="127.0.0.1"INIT_DB_PORT="8123"INIT_DB_DATABASE="default"INIT_DB_USERNAME="default"-INIT_DB_PASSWORD="DOKU"+INIT_DB_PASSWORD="OPENLIT"SQLITE_DATABASE_URL="file:/app/client/data/data.db"```-## Doku Ingester+## OpenLIT Ingester### Environment Varibales<ResponseField name="DOKU_DB_HOST" required>- Sets the host address of the ClickHouse server for Doku Ingester to connect+ Sets the host address of the ClickHouse server for OpenLIT Ingester to connect**Example**:```yaml@@ -98,7 +98,7 @@ SQLITE_DATABASE_URL="file:/app/client/data/data.db"</ResponseField><ResponseField name="DOKU_DB_NAME" required>- Sets the name of the database in Clickhouse to be used by Doku+ Sets the name of the database in Clickhouse to be used by OpenLIT**Example**:```yaml@@ -120,7 +120,7 @@ SQLITE_DATABASE_URL="file:/app/client/data/data.db"**Example**:```yaml- export DOKU_DB_PASSWORD=DOKU+ export DOKU_DB_PASSWORD=OPENLIT```</ResponseField>@@ -188,14 +188,14 @@ DOKU_DB_HOST="127.0.0.1"DOKU_DB_PORT="9000"DOKU_DB_NAME="default"DOKU_DB_USER="default"-DOKU_DB_PASSWORD="DOKU"+DOKU_DB_PASSWORD="OPENLIT"```---<CardGroup cols={2}><Card title="Integrations" href="/latest/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku+Integrate your LLM Provider with OpenLIT</Card><Card title="Connections" href="/latest/connections/intro" icon='link'>Connect to your existing Observablity Platformdiff --git a/docs/latest/installation.mdx b/docs/latest/installation.mdxindex 1cb10c9f..97570625 100644--- a/docs/latest/installation.mdx+++ b/docs/latest/installation.mdx@@ -1,10 +1,10 @@---title: 'Installation'-description: 'Self-host Doku in your preferred environment'+description: 'Self-host OpenLIT in your preferred environment'icon: 'circle-down'----Doku flexibly adapts to your preferred environment. Select a deployment method that best fits your needs:+OpenLIT flexibly adapts to your preferred environment. Select a deployment method that best fits your needs:<CardGroup cols={2}><Card@@ -14,20 +14,20 @@ Doku flexibly adapts to your preferred environment. Select a deployment method t<path fill="#FFA500" d="M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"/></svg>}href="/latest/installation#kubernetes">- Deploy Doku on a Kubernetes for scalable LLM Monitoring capabilities.+ Deploy OpenLIT on a Kubernetes for scalable LLM Monitoring capabilities.</Card><Cardtitle="Docker"icon="docker"href="/latest/installation#docker">- Deploy Doku using Docker for an easy-to-manage LLM Monitoring setup.+ Deploy OpenLIT using Docker for an easy-to-manage LLM Monitoring setup.</Card></CardGroup>## Kubernetes-Deploy Doku on your Kubernetes cluster using the [Doku Helm chart](https://github.com/dokulabs/helm/tree/main/charts/doku) for a reliable and scalable solution.+Deploy OpenLIT on your Kubernetes cluster using the [OpenLIT Helm chart](https://github.com/dokulabs/helm/tree/main/charts/doku) for a reliable and scalable solution.<Steps><Step title="Helm Repo Setup">```shell shell@@ -43,7 +43,7 @@ Deploy Doku on your Kubernetes cluster using the [Doku Helm chart](https://githu</Steps>## Docker-For a quick and straightforward setup, Docker Compose can be used to deploy Doku.+For a quick and straightforward setup, Docker Compose can be used to deploy OpenLIT.<Steps><Step title="Create `docker-compose.yml`">@@ -55,7 +55,7 @@ For a quick and straightforward setup, Docker Compose can be used to deploy Dokuimage: clickhouse/clickhouse-server:24.2.2container_name: clickhouseenvironment:- CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}+ CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-OPENLIT}CLICKHOUSE_USER: ${DOKU_DB_USER:-default}volumes:- clickhouse-data:/var/lib/clickhouse@@ -72,7 +72,7 @@ For a quick and straightforward setup, Docker Compose can be used to deploy DokuDOKU_DB_PORT: 9000DOKU_DB_NAME: ${DOKU_DB_NAME:-default}DOKU_DB_USER: ${DOKU_DB_USER:-default}- DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}+ DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-OPENLIT}ports:- "9044:9044"depends_on:@@ -113,7 +113,7 @@ For a quick and straightforward setup, Docker Compose can be used to deploy Doku<CardGroup cols={2}><Card title="Integrations" href="/latest/integrations/introduction" icon='circle-nodes'>-Integrate your LLM Provider with Doku+Integrate your LLM Provider with OpenLIT</Card><Card title="Connections" href="/latest/connections/intro" icon='link'>Connect to your existing Observablity Platformdiff --git a/docs/mint.json b/docs/mint.jsonindex f569cb38..7ffe1561 100644--- a/docs/mint.json+++ b/docs/mint.json@@ -1,10 +1,10 @@{"$schema": "https://mintlify.com/schema.json",- "versions": ["latest", "0.1"],- "name": "Doku",+ "versions": ["latest"],+ "name": "OpenLIT","logo": {- "dark": "https://github.com/dokulabs/.github/blob/main/profile/assets/dark-bg-with-text-logo.jpg?raw=true",- "light": "https://github.com/dokulabs/.github/blob/main/profile/assets/light-bg-with-text-logo.jpg?raw=true"+ "dark": "https://github.com/openlit/.github/blob/main/profile/assets/dark-bg-with-text-logo.jpg?raw=true",+ "light": "https://github.com/openlit/.github/blob/main/profile/assets/light-bg-with-text-logo.jpg?raw=true"},"favicon": "favicon.png","colors": {@@ -19,7 +19,7 @@"topbarCtaButton":{"name": "Website",- "url": "https://dokulabs.com/"+ "url": "https://openlit.io/"},"modeToggle": {"default": "light"@@ -32,12 +32,12 @@{"name": "Community","icon": "slack",- "url": "https://dokulabs.slack.com"+ "url": "https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ"},{"name": "GitHub","icon": "github",- "url": "https://github.com/dokulabs/"+ "url": "https://github.com/openlit/"}],"navigation": [@@ -179,145 +179,6 @@}],"version": "latest"- },- {- "group": "Introduction",- "pages": [- "0.1/introduction",- "0.1/quickstart",- "0.1/installation",- "0.1/configuration"- ],- "version": "0.1"- },- {- "group": "Integrations",- "version": "0.1",- "pages": [- "0.1/integrations/introduction",- {- "group": "OpenAI",- "version": "0.1",- "pages": [- "0.1/integrations/openai/introduction",- {- "group": "Examples",- "version": "0.1",- "pages": [- "0.1/integrations/openai/examples/chatCompletions",- "0.1/integrations/openai/examples/image",- "0.1/integrations/openai/examples/embeddings",- "0.1/integrations/openai/examples/audio",- "0.1/integrations/openai/examples/fine-tuning",- "0.1/integrations/openai/examples/completions"- ]- }- ]- },- {- "group": "Cohere",- "version": "0.1",- "pages": [- "0.1/integrations/cohere/introduction",- {- "group": "Examples",- "version": "0.1",- "pages": [- "0.1/integrations/cohere/examples/cochat",- "0.1/integrations/cohere/examples/generate",- "0.1/integrations/cohere/examples/summarize",- "0.1/integrations/cohere/examples/embed"- ]- }- ]- },- {- "group": "Anthropic",- "version": "0.1",- "pages": [- "0.1/integrations/anthropic/introduction",- {- "group": "Examples",- "version": "0.1",- "pages": [- "0.1/integrations/anthropic/examples/messages"- ]- }- ]- },- {- "group": "Mistral",- "version": "0.1",- "pages": [- "0.1/integrations/mistral/introduction",- {- "group": "Examples",- "version": "0.1",- "pages": [- "0.1/integrations/mistral/examples/mistral-chat",- "0.1/integrations/mistral/examples/embedding"- ]- }- ]- },- {- "group": "Azure OpenAI",- "version": "0.1",- "pages": [- "0.1/integrations/azure-openai/introduction",- {- "group": "Examples",- "version": "0.1",- "pages": [- "0.1/integrations/azure-openai/examples/chat",- "0.1/integrations/azure-openai/examples/image",- "0.1/integrations/azure-openai/examples/embeddings",- "0.1/integrations/azure-openai/examples/completions"- ]- }- ]- }- ]- },- {- "group": "Connections",- "pages": [- "0.1/connections/intro",- "0.1/connections/grafanaoss",- "0.1/connections/grafanacloud",- "0.1/connections/datadog",- "0.1/connections/new-relic",- "0.1/connections/signoz",- "0.1/connections/dynatrace"- ],- "version": "0.1"- },- {- "group": "API Reference",- "pages": [- "0.1/api-reference/introduction",- {- "group": "API Keys",- "icon": "key",- "pages": [- "0.1/api-reference/endpoint/api-keys/create",- "0.1/api-reference/endpoint/api-keys/get",- "0.1/api-reference/endpoint/api-keys/delete"- ],- "version": "0.1"- },- {- "group": "Connections",- "icon": "link",- "pages": [- "0.1/api-reference/endpoint/connections/create",- "0.1/api-reference/endpoint/connections/delete",- "0.1/api-reference/endpoint/connections/get"- ],- "version": "0.1"- }- ],- "version": "0.1"}],"analytics": {@@ -326,9 +187,9 @@}},"footerSocials": {- "github": "https://github.com/dokulabs/",- "slack": "https://join.slack.com/t/dokulabs/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ",- "twitter": "https://twitter.com/doku_labs",+ "github": "https://github.com/openlit/",+ "slack": "https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ",+ "twitter": "https://twitter.com/openlit_io","discord": "https://discord.gg/pGKEqmDE"}}diff --git a/sdk/python/README.md b/sdk/python/README.mdindex e75dc091..e4549fcf 100644--- a/sdk/python/README.md+++ b/sdk/python/README.md@@ -1,17 +1,17 @@<div align="center">-<img src="https://github.com/dokulabs/.github/blob/main/profile/assets/wide-logo-no-bg.png?raw=true" alt="Doku Logo" width="30%"><h1>-OpenTelemetry Auto-Instrumentation for GenAI & LLM Application</h1>+<img src="https://github.com/openlit/.github/blob/main/profile/assets/wide-logo-no-bg.png?raw=true" alt="OpenLIT Logo" width="30%"><h1>+OpenTelemetry Auto-Instrumentation for GenAI & LLM Applications</h1>-**[Documentation](https://docs.dokulabs.com/) | [Quickstart](#-getting-started-with-doku) | [Python SDK](https://github.com/dokulabs/doku/tree/main/sdk/python)**+**[Documentation](https://docs.openlit.io/) | [Quickstart](#-getting-started) | [Python SDK](https://github.com/openlit/openlit/tree/main/sdk/python)**-[](https://github.com/open-lit/openlit)-[](https://github.com/open-lit/openlit/blob/main/LICENSE)+[](https://github.com/openlit/openlit)+[](https://github.com/openlit/openlit/blob/main/LICENSE)[](https://pepy.tech/project/dokumetry)-[](https://github.com/open-lit/openlit/pulse)-[](https://github.com/open-lit/openlit/graphs/contributors)+[](https://github.com/openlit/openlit/pulse)+[](https://github.com/openlit/openlit/graphs/contributors)-[](https://join.slack.com/t/dokulabs/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)-[](https://twitter.com/doku_labs)+[](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ)+[](https://twitter.com/openlit_io)</div>@@ -55,10 +55,20 @@ This project adheres to the [Semantic Conventions](https://github.com/open-telempip install openlit```-## β‘ Quick Integration+## π Getting Started++## Step 1: Install OpenLIT SDK++```bash+pip install openlit+```++### Step 2: Instrument your Application+Integrating the OpenLIT into LLM applications is straightforward. Start monitoring for your LLM Application with just **one line of code**:```pythonimport openlit+openlit.init()```@@ -66,6 +76,42 @@ By default, OpenLIT directs traces and metrics straight to your console. To forwTo send telemetry to OpenTelemetry backends requiring authentication, set the `otlp_headers` parameter with its desired value. Alternatively, you can configure the endpoint by setting the `OTEL_EXPORTER_OTLP_HEADERS` environment variable as recommended in the OpenTelemetry documentation.+#### Example++Here is how you can send telemetry from OpenLIT to Grafana Cloud++```python+openlit.init(+ otlp_endpoint="https://otlp-gateway-prod-us-east-0.grafana.net/otlp",+ otlp_headers="Authorization=Basic%20<base64 encoded Instance ID and API Token>"+)+```++Alternatively, You can also choose to set these values using `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables++```python+openlit.init()+```++```env+export OTEL_EXPORTER_OTLP_ENDPOINT = "https://otlp-gateway-prod-us-east-0.grafana.net/otlp"+export OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Basic%20<base64 encoded Instance ID and API Token>"+```++### Step 3: Visualize and Optimize!+With the LLM Observability data now being collected and sent to your chosen OpenTelemetry backend, the next step is to visualize and analyze this data to glean insights into your application's performance, behavior, and identify areas of improvement. Here is how you would use the data in Grafana, follow these detailed instructions to explore your LLM application's Telemetry data.++ - Select the **Explore** option from Grafana's sidebar.+ - At the top, ensure the correct Tempo data source is selected from the dropdown menu.+ - Use the **Query** field to specify any particular traces you are interested in, or leave it empty to browse through all the available traces.+ - You can adjust the time range to focus on specific periods of interest.+ - Hit **Run Query** to fetch your trace data. You'll see a visual representation of your traces along with detailed information on particular spans when clicked.++#### Next Steps++- **Create Dashboards:** Beyond just exploring traces, consider creating dashboards in Grafana to monitor key performance indicators (KPIs) and metrics over time. Dashboards can be customized with various panels to display graphs, logs, and single stats that are most relevant to your application's performance and usage patterns.+- **Set Alerts:** Grafana also allows you to set up alerts based on specific thresholds. This feature can be invaluable in proactively managing your application's health by notifying you of potential issues before they impact users.+- **Iterate and Optimize:** Use the insights gained from your observability data to make informed decisions on optimizing your LLM application. This might involve refining model parameters, adjusting scaling strategies, or identifying and resolving bottlenecks.### Configuration@@ -99,7 +145,7 @@ Your input helps us grow and improve, and we're here to support you every step oConnect with the OpenLIT community and maintainers for support, discussions, and updates:-- π If you like it, Leave a star on our [GitHub](https://github.com/open-lit/openlit/)+- π If you like it, Leave a star on our [GitHub](https://github.com/openlit/openlit/)- π Join our [Slack](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) Community for live interactions and questions.-- π Report bugs on our [GitHub Issues](https://github.com/open-lit/openlit/issues) to help us improve OpenLIT.+- π Report bugs on our [GitHub Issues](https://github.com/openlit/openlit/issues) to help us improve OpenLIT.- π Follow us on [X](https://twitter.com/openlit) for the latest updates and news.\ No newline at end of filediff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.tomlindex 332aaf16..dbf64284 100644--- a/sdk/python/pyproject.toml+++ b/sdk/python/pyproject.toml@@ -3,9 +3,9 @@ name = "openlit"version = "0.0.2"description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects"authors = ["OpenLIT"]-repository = "https://github.com/open-lit/openlit/tree/main/openlit/python"+repository = "https://github.com/openlit/openlit/tree/main/openlit/python"readme = "README.md"-homepage = "https://github.com/open-lit/openlit/tree/main/openlit/python"+homepage = "https://github.com/openlit/openlit/tree/main/openlit/python"keywords = ["OpenTelemetry", "otel", "otlp","llm", "tracing", "openai", "anthropic", "claude", "cohere", "llm monitoring", "observability", "monitoring", "gpt", "Generative AI", "chatGPT"][tool.poetry.dependencies]diff --git a/sdk/python/src/openlit/__helpers.py b/sdk/python/src/openlit/__helpers.pyindex 09802b6f..53ebb766 100644--- a/sdk/python/src/openlit/__helpers.py+++ b/sdk/python/src/openlit/__helpers.py@@ -124,7 +124,7 @@ def get_audio_model_cost(model, pricing_info, prompt):def fetch_pricing_info():"""Fetches pricing information from a specified URL."""- pricing_url = "https://raw.githubusercontent.com/dokulabs/doku/main/assets/pricing.json"+ pricing_url = "https://raw.githubusercontent.com/openlit/openlit/main/assets/pricing.json"try:# Set a timeout of 10 seconds for both the connection and the readresponse = requests.get(pricing_url, timeout=20)diff --git a/src/README.md b/src/README.mdindex e255364e..9dfd37d3 100644--- a/src/README.md+++ b/src/README.md@@ -1,6 +1,6 @@# Testing and Developing Locally-This guide covers the steps needed to set up the development environment for Doku Stack using Docker Compose. Our setup includes two main components: `ingester` and `client`, both of which are orchestrated by a Docker Compose file named `dev-docker-compose.yml`.+This guide covers the steps needed to set up the development environment for OpenLIT Stack using Docker Compose. Our setup includes two main components: `client`, both of which are orchestrated by a Docker Compose file named `dev-docker-compose.yml`.## Running the Development Environment@@ -16,7 +16,7 @@ To run the development environment, follow these steps:The `--build` flag ensures that Docker builds images for our services (if needed) before starting the containers.-4. Once the command completes, the `ingester` and `client` services should be running in containers, and you can access Doku Client at 127.0.0.1:3000 and Doku Ingester at `127.0.0.1:9044`.+4. Once the command completes, the `client` services should be running in containers, and you can access OpenLIT Client at 127.0.0.1:3000.5. To stop the services and remove the containers, you can use the following command:diff --git a/src/client/README.md b/src/client/README.mdindex 86e4538e..baf0626a 100644--- a/src/client/README.md+++ b/src/client/README.md@@ -1,8 +1,8 @@-# Doku Client+# OpenLIT Client-[](https://github.com/dokulabs/doku)-[](https://github.com/dokulabs/doku/blob/main/LICENSE)-[](https://github.com/dokulabs/doku/tags)+[](https://github.com/openlit/openlit)+[](https://github.com/openlit/openlit/blob/main/LICENSE)+[](https://github.com/openlit/openlit/tags)@@ -11,24 +11,24 @@-Doku Client serves as the frontend UI for displaying visualizations and observability data for Large Language Models (LLM), drawing data from ClickHouse. The platform leverages the power of modern web technologies like Next.js and TailwindCSS to offer an intuitive and responsive user experience.+OpenLIT Client serves as the frontend UI for displaying visualizations and observability data for Large Language Models (LLM), drawing data from ClickHouse. The platform leverages the power of modern web technologies like Next.js and TailwindCSS to offer an intuitive and responsive user experience.## Features- **Comprehensive Analytics Dashboard**: Easily monitor Large Language Model performance, user activity, and critical metrics related to costs and tokens in real-time.- **User Management System**: Offers built-in user management to ensure secure access control and smooth authentication processes.-- **Versatile Data Source Connectivity**: Seamlessly adjust and integrate your ClickHouse database details directly within the UI. This flexibility enables quick switches between databases to keep your Doku Client running efficiently.+- **Versatile Data Source Connectivity**: Seamlessly adjust and integrate your ClickHouse database details directly within the UI. This flexibility enables quick switches between databases to keep your OpenLIT Client running efficiently.## π Quick Start-Follow the steps below to get Doku Client running in your environment. Both Docker and manual installation options are provided.+Follow the steps below to get OpenLIT Client running in your environment. Both Docker and manual installation options are provided.### Docker1. **Pull the Docker image**```bash- docker pull ghcr.io/dokulabs/doku-client:latest+ docker pull ghcr.io/openlit/openlit-client:latest```2. **Run the container with Environment Variables**@@ -41,24 +41,24 @@ Follow the steps below to get Doku Client running in your environment. Both Dock-e INIT_DB_USERNAME="<ClickHouse-username>" \-e INIT_DB_PASSWORD="<ClickHouse-password>" \-e SQLITE_DATABASE_URL=file:/app/client/data/data.db \- --name doku-client ghcr.io/dokulabs/doku-client:latest+ --name openlit-client ghcr.io/openlit/openlit-client:latest```-3. Login to Doku UI at `127.0.0.1:3000` using the default credentials and start monitoring and evaluating your LLM Applications- - Email as `[email protected]`- - Password as `dokulabsuser`+3. Login to OpenLIT UI at `127.0.0.1:3000` using the default credentials and start monitoring and evaluating your LLM Applications+ - Email as `[email protected]`+ - Password as `openlituser`-You can also use the [Doku Helm Chart](https://github.com/dokulabs/helm/tree/main/charts/doku) to deploy Doku Client in Kubernetes+You can also use the [OpenLIT Helm Chart](https://github.com/openlit/helm/tree/main/charts/openlit) to deploy OpenLIT Client in Kubernetes### Manual Setup (Development)-1. **Clone the doku repository**+1. **Clone the openlit repository**```sh- git clone https://github.com/dokulabs/doku.git+ git clone https://github.com/openlit/openlit.git```2. **Navigate to the client folder**```sh- cd doku/src/client+ cd openlit/src/client```3. **Install the dependencies**```sh@@ -85,7 +85,7 @@ You can also use the [Doku Helm Chart](https://github.com/dokulabs/helm/tree/mai```6. **(Optional) Seed the database**- If desired, seed the database to create a default user (`[email protected]` with the password `dokulabsuser`) and database configuration.+ If desired, seed the database to create a default user (`[email protected]` with the password `openlituser`) and database configuration.```shnpx prisma db seed```@@ -95,38 +95,38 @@ You can also use the [Doku Helm Chart](https://github.com/dokulabs/helm/tree/mai```shnpm run dev```-8. Login to Doku UI at `127.0.0.1:3000` using the default credentials and start monitoring and evaluating your LLM Applications- - Email as `[email protected]`- - Password as `dokulabsuser`+8. Login to OpenLIT UI at `127.0.0.1:3000` using the default credentials and start monitoring and evaluating your LLM Applications+ - Email as `[email protected]`+ - Password as `openlituser`## Configuration-To configure Doku Client, you can pass the following environment values, each tailored to suit your infrastructure and operational preferences. This customization allows Doku Client to seamlessly integrate with your existing setup and respond to its demands effectively.+To configure OpenLIT Client, you can pass the following environment values, each tailored to suit your infrastructure and operational preferences. This customization allows OpenLIT Client to seamlessly integrate with your existing setup and respond to its demands effectively.| Variable | Description | Required | Example ||----------------------|-----------------------------------------------------------------------------|:--------:|---------------------------------------|| `INIT_DB_HOST` | Host address of the ClickHouse server to connect to. | β | `127.0.0.1` || `INIT_DB_PORT` | Port on which ClickHouse listens. | β | `8123` |-| `INIT_DB_DATABASE` | Database name in ClickHouse for Doku Client. | | `default` |+| `INIT_DB_DATABASE` | Database name in ClickHouse for OpenLIT Client. | | `default` || `INIT_DB_USERNAME` | Username for authenticating with ClickHouse. | | `default` || `INIT_DB_PASSWORD` | Password for authenticating with ClickHouse. | | `default` |-| `SQLITE_DATABASE_URL`| Location of the SQLITE database for Doku Client data storage. | β | `file:/app/client/data/data.db` |+| `SQLITE_DATABASE_URL`| Location of the SQLITE database for OpenLIT Client data storage. | β | `file:/app/client/data/data.db` |-For more detailed information on configuration options and additional settings, please visit the Doku documentation page: [Doku Configuration Details](https://docs.dokulabs.com/latest/configuration).+For more detailed information on configuration options and additional settings, please visit the OpenLIT documentation page: [OpenLIT Configuration Details](https://docs.openlit.io/latest/configuration).## Security-We take security seriously. Doku Client incorporates best practices for authentication, authorization, and secure communication to ensure data privacy and protection.+We take security seriously. OpenLIT Client incorporates best practices for authentication, authorization, and secure communication to ensure data privacy and protection.## Contributing-Contributions to Doku Client are greatly appreciated. Whether you have suggestions for bug fixes, improvements, or new features, please see [CONTRIBUTING](../../CONTRIBUTING.md) for more details on submitting pull requests or opening issues.+Contributions to OpenLIT Client are greatly appreciated. Whether you have suggestions for bug fixes, improvements, or new features, please see [CONTRIBUTING](../../CONTRIBUTING.md) for more details on submitting pull requests or opening issues.## License-Doku Client is available under the [Apache-2.0 license](../../LICENSE).+OpenLIT Client is available under the [Apache-2.0 license](../../LICENSE).## Support-For support, issues, or feature requests, please submit an issue through the [GitHub issues](https://github.com/dokulabs/doku/issues) page for this repository.+For support, issues, or feature requests, please submit an issue through the [GitHub issues](https://github.com/openlit/openlit/issues) page for this repository.diff --git a/src/dev-docker-compose.yml b/src/dev-docker-compose.ymlindex ed23c1d2..729f537d 100644--- a/src/dev-docker-compose.yml+++ b/src/dev-docker-compose.yml@@ -5,8 +5,8 @@ services:image: clickhouse/clickhouse-server:24.2.2container_name: clickhouseenvironment:- CLICKHOUSE_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- CLICKHOUSE_USER: ${DOKU_DB_USER:-default}+ CLICKHOUSE_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}+ CLICKHOUSE_USER: ${OPENLIT_DB_USER:-default}volumes:- clickhouse-data:/var/lib/clickhouseports:@@ -14,45 +14,47 @@ services:- "8123:8123"restart: always- doku-ingester:- image: doku-ingester+ openlit:+ image: openlitbuild:- context: ./ingester+ context: ./clientdockerfile: Dockerfile- container_name: doku-ingester+ container_name: openlitenvironment:- DOKU_DB_HOST: clickhouse- DOKU_DB_PORT: 9000- DOKU_DB_NAME: ${DOKU_DB_NAME:-default}- DOKU_DB_USER: ${DOKU_DB_USER:-default}- DOKU_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}+ INIT_DB_HOST: clickhouse+ INIT_DB_PORT: 8123+ INIT_DB_DATABASE: ${OPENLIT_DB_NAME:-openlit}+ INIT_DB_USERNAME: ${OPENLIT_DB_USER:-default}+ INIT_DB_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}+ SQLITE_DATABASE_URL: file:/app/client/data/data.dbports:- - "9044:9044"+ - "3000:3000"depends_on:- clickhouse+ volumes:+ - openlit-data:/app/client/datarestart: always-- doku-client:- image: doku-client- build:- context: ./client- dockerfile: Dockerfile- container_name: doku-client++ otel-collector:+ image: otel/opentelemetry-collector-contrib:0.94.0+ container_name: otel-collectorenvironment:INIT_DB_HOST: clickhouseINIT_DB_PORT: 8123- INIT_DB_DATABASE: ${DOKU_DB_NAME:-default}- INIT_DB_USERNAME: ${DOKU_DB_USER:-default}- INIT_DB_PASSWORD: ${DOKU_DB_PASSWORD:-DOKU}- SQLITE_DATABASE_URL: file:/app/client/data/data.db+ INIT_DB_DATABASE: ${OPENLIT_DB_NAME:-openlit}+ INIT_DB_USERNAME: ${OPENLIT_DB_USER:-default}+ INIT_DB_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}ports:- - "3000:3000"+ - "4317:4317"+ - "4318:4318"+ - "8888:8888"+ - "55679:55679"depends_on:- clickhousevolumes:- - doku-client-data:/app/client/data+ - ./assets/otel-collector-config.yaml:/etc/otelcol-contrib/config.yamlrestart: alwaysvolumes:clickhouse-data:- doku-client-data:\ No newline at end of file+ openlit-data:\ No newline at end of filediff --git a/src/ingester/Dockerfile b/src/ingester/Dockerfiledeleted file mode 100644index 96a873b2..00000000--- a/src/ingester/Dockerfile+++ /dev/null@@ -1,30 +0,0 @@-# Build stage-FROM golang:1.22.1-alpine3.19 AS builder--# Set the working directory-WORKDIR /app--# Copy the Go Modules manifests and download dependencies-COPY go.mod go.sum ./-RUN go mod download--# Copy the rest of the source code-COPY . .--# Build the Go application and name the executable "ingester"-RUN CGO_ENABLED=0 go build -o ingester--# Final stage: Use a minimal alpine image-FROM alpine:3.19--# Install ca-certificates in case your application makes outgoing HTTPS requests-RUN apk --no-cache add ca-certificates--# Set the working directory-WORKDIR /app--# Copy the binary from the builder stage-COPY --from=builder /app/ingester .--# Command to run the executable-CMD ["./ingester"]\ No newline at end of filediff --git a/src/ingester/README.md b/src/ingester/README.mddeleted file mode 100644index e8e14f0a..00000000--- a/src/ingester/README.md+++ /dev/null@@ -1,108 +0,0 @@-# Doku Ingester--[](https://github.com/dokulabs/doku)-[](https://github.com/dokulabs/doku/blob/main/LICENSE)-[](https://github.com/dokulabs/doku/tags)------Doku Ingester facilitates real-time data ingestion from `dokumetry` [Python](https://github.com/dokulabs/dokumetry-python) and [Node](https://github.com/dokulabs/dokumetry-node) SDKs for Large Language Models (LLM) analytics. It ensures the secure collection of telemetry data, enabling insights on usage patterns, performance metrics, and cost management for LLMs.--## Features--- **High-Performance Data Ingestion**: Optimized for minimum latency LLM Observability data ingestion to support fast-paced environments where response times are pivotal.-- **Secure Authentication**: Robust key-based authentication to safeguard transmission and storage of Generative AI Observability data.-- **Scalable Architecture**: Designed with a scalable mindset to grow with your needs, handling increasing loads smoothly and efficiently.-- **Customizable Caching**: Configurable in-memory caching for improved performance.--## π Quick Start--Follow the steps below to get Doku Ingester running in your environment. Both Docker and manual installation options are provided.--### Docker-1. **Pull the Docker image**-- ```bash- docker pull ghcr.io/dokulabs/doku-ingester:latest- ```--2. **Run the container with environment variables**-- In this command, replace `"<ClickHouse-URL>"`, `"<ClickHouse-Port>"`, `"<ClickHouse-Database-name>"`, `"<ClickHouse-username>"`, and `"<ClickHouse-password>"` with your actual ClickHouse configuration details.-- ```bash- docker run -d -p 9044:9044 \- -e DOKU_DB_HOST="<ClickHouse-URL>" \- -e DOKU_DB_PORT="<ClickHouse-Port>" \- -e DOKU_DB_NAME="<ClickHouse-Database-name>" \- -e DOKU_DB_USER="<ClickHouse-username>" \- -e DOKU_DB_PASSWORD="<ClickHouse-password>" \- --name doku-ingester ghcr.io/dokulabs/doku-ingester:latest- ```---You can also use the [Doku Helm Chart](https://github.com/dokulabs/helm/tree/main/charts/doku) to deploy Doku Ingester in Kubernetes--### Manual Setup (Development)--1. Clone the doku repository- ```sh- git clone [email protected]:dokulabs/doku.git- ````-2. Go to the ingester folder- ```sh- cd src/ingester- ````-3. Build the Go Package- ```sh- go build -o doku-ingester .- ````-4. **Run the Doku Ingester Go Binary with Environment Variables**-- Before running the following command, ensure you replace `"<ClickHouse-URL>"`, `"<ClickHouse-Port>"`, `"<ClickHouse-Database-name>"`, `"<ClickHouse-username>"`, and `"<ClickHouse-password>"` with your actual values.-- ```sh- export DOKU_DB_HOST="<ClickHouse-URL>"- export DOKU_DB_PORT="<ClickHouse-Port>"- export DOKU_DB_NAME="<ClickHouse-Database-name>"- export DOKU_DB_USER="<ClickHouse-Username>"- export DOKU_DB_PASSWORD="<ClickHouse-Password>"- ./doku-ingester- ```--## Configuration--To configure Doku Ingester, you can pass the following environment values, each tailored to suit your infrastructure and operational preferences. This customization allows Doku Ingester to seamlessly integrate with your existing setup and respond to its demands effectively.---| Variable | Description | Required | Example |-|----------------------------|-----------------------------------------------------------------|:--------:|----------------------------------------|-| `DOKU_DB_HOST` | Host address of the ClickHouse server for Doku to connect to. | β | `127.0.0.1` |-| `DOKU_DB_PORT` | Port on which ClickHouse listens. | β | `9000` |-| `DOKU_DB_NAME` | Database name in ClickHouse to be used by Doku. | β | `default` |-| `DOKU_DB_USER` | Username for authenticating with ClickHouse. | β | `default` |-| `DOKU_DB_PASSWORD` | Password for authenticating with ClickHouse. | β | `DOKU` |-| `DOKU_PRICING_JSON_URL` | URL of the JSON file containing LLM Pricing data. | | `URL` |-| `DOKU_DB_MAX_IDLE_CONNS` | Maximum number of concurrent idle database connections. | | `10` |-| `DOKU_DB_MAX_OPEN_CONNS` | Maximum number of concurrent open database connections. | | `20` |-| `DOKU_DB_RETENTION_PERIOD` | TTL for data in ClickHouse. | | `6 MONTH` |--For more detailed information on configuration options and additional settings, please visit the Doku documentation page: [Doku Configuration Details](https://docs.dokulabs.com/latest/configuration).--## Security--Doku Ingester uses key based authentication mechanism to ensure the security of your data. Be sure to keep your API keys confidential and manage permissions diligently. Refer to our [Security Policy](../../SECURITY.md)--## Contributing--We welcome contributions to the Doku Ingester project. Please refer to [CONTRIBUTING](../../CONTRIBUTING.md) for detailed guidelines on how you can participate.--## License--Doku Ingester is available under the [Apache-2.0 license](../../LICENSE).--## Support--For support, issues, or feature requests, submit an issue through the [GitHub issues](https://github.com/dokulabs/doku/issues) associated with this repository.diff --git a/src/ingester/api/handlers.go b/src/ingester/api/handlers.godeleted file mode 100644index 1127e8e8..00000000--- a/src/ingester/api/handlers.go+++ /dev/null@@ -1,329 +0,0 @@-package api--import (- "encoding/json"- "fmt"- "net/http"- "strings"-- "ingester/auth"- "ingester/db"-- "github.com/rs/zerolog/log"-)--const (- // Constants for error messages- errMsgKeyExists = "An API Key with the name '%s' already exists"- errMsgAuthFailed = "Unauthorized: Please check your API Key and try again"- errMsgKeyNotFound = "Unable to find API Key with the given name %s"- errMsgInvalidBody = "Invalid request body"-)--// APIKeyRequest represents the expected request structure for API Key related endpoints.-type APIKeyRequest struct {- Name string `json:"name"`-}--// jsonResponse represents the expected response structure for all endpoints.-type jsonResponse struct {- Status int `json:"status"`- Message string `json:"message"`- Data interface{} `json:"data,omitempty"`-}--// Normalize capitalizes names fields in the request body.-func (r *APIKeyRequest) Normalize() {- r.Name = strings.ToLower(r.Name)-}--// decodeRequestBody decodes the JSON request body into the destination struct.-func decodeRequestBody(r *http.Request, dest interface{}) error {- return json.NewDecoder(r.Body).Decode(dest)-}--func validateConnectionRequest(request *db.ConnectionRequest) error {- // Define valid platforms and their required fields- var err error-- switch request.Platform {- case "grafana":- // For Grafana, all fields are required- if request.MetricsUsername == "" || request.LogsUserName == "" || request.ApiKey == "" || request.MetricsURL == "" || request.LogsURL == "" {- err = fmt.Errorf("valid parameters for platform 'grafana' are - 'metricsUsername', 'logsUserName', 'apiKey', 'metricsURL', and 'logsURL'")- }- case "datadog", "newrelic", "dynatrace":- // For Datadog, New Relic, and Dynatrace, apiKey, metricsURL, and logsURL are required- if request.ApiKey == "" || request.MetricsURL == "" || request.LogsURL == "" || request.MetricsUsername != "" || request.LogsUserName != "" {- err = fmt.Errorf("valid parameters for platform '%s' are - 'apiKey', 'metricsURL', and 'logsURL", request.Platform)- }- case "signoz":- // For SigNoz, apiKey and logsURL are required- if request.ApiKey == "" || request.LogsURL == "" {- err = fmt.Errorf("valid parameters for platform 'signoz' are - 'apiKey' and 'logsURL'")- }- default:- // Platform not supported- err = fmt.Errorf("unsupported platform '%s'. Supported platforms are: 'grafana', 'datadog', 'newrelic', 'dynatrace', 'signoz'", request.Platform)- }-- return err-}--// getAuthKey retrieves the API Key from the request header.-func getAuthKey(r *http.Request) string {- return r.Header.Get("Authorization")-}--// sendJSONResponse constructs and sends a JSON response with appropriate headers.-func sendJSONResponse(w http.ResponseWriter, status int, message string) {- w.Header().Set("Content-Type", "application/json")- w.WriteHeader(status)-- response := jsonResponse{- Status: status,- Message: message,- }-- json.NewEncoder(w).Encode(response)-}--// handleAPIKeyErrors centralizes the error handling logic for API Key operations.-func handleAPIKeyErrors(w http.ResponseWriter, err error, name string) {- if err.Error() == "KEYEXISTS" {- sendJSONResponse(w, http.StatusConflict, fmt.Sprintf(errMsgKeyExists, name))- return- } else if err.Error() == "AUTHFAILED" {- sendJSONResponse(w, http.StatusUnauthorized, errMsgAuthFailed)- return- } else if err.Error() == "NOTFOUND" {- sendJSONResponse(w, http.StatusNotFound, fmt.Sprintf(errMsgKeyNotFound, name))- return- } else {- sendJSONResponse(w, http.StatusInternalServerError, err.Error())- return- }-}--// generateConnectionsHandler handles the creation of a new Connection-func generateConnectionsHandler(w http.ResponseWriter, r *http.Request) {- var request db.ConnectionRequest-- if err := decodeRequestBody(r, &request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }-- if err := validateConnectionRequest(&request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, err.Error())- return- }-- err := db.GenerateConnection(getAuthKey(r), request)- if err != nil {- if err.Error() == "AUTHFAILED" {- sendJSONResponse(w, http.StatusUnauthorized, errMsgAuthFailed)- return- }- sendJSONResponse(w, http.StatusBadRequest, "Error creating connection: "+err.Error())- return- }-- sendJSONResponse(w, http.StatusOK, "Connection created successfully")-}--// deleteConnectionsHandler handles the creation of a new Connection-func deleteConnectionsHandler(w http.ResponseWriter, r *http.Request) {- var request db.ConnectionRequest-- if err := decodeRequestBody(r, &request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }-- if err := validateConnectionRequest(&request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, err.Error())- return- }-- err := db.DeleteConnection(getAuthKey(r))- if err != nil {- if err.Error() == "NOTFOUND" {- sendJSONResponse(w, http.StatusNotFound, "No existing Connection found")- return- }- if err.Error() == "AUTHFAILED" {- sendJSONResponse(w, http.StatusUnauthorized, errMsgAuthFailed)- return- }- sendJSONResponse(w, http.StatusBadRequest, "Error deleting connection: "+err.Error())- return- }-- sendJSONResponse(w, http.StatusOK, "Connection deleted successfully")-}--// getConnectionsHandler handles the retrieval of a new Connection-func getConnectionsHandler(w http.ResponseWriter, r *http.Request) {-- observability, err := db.GetConnection(getAuthKey(r))- if err != nil {- if err.Error() == "NOTFOUND" {- sendJSONResponse(w, http.StatusNotFound, "No existing Connection found")- return- }- if err.Error() == "AUTHFAILED" {- sendJSONResponse(w, http.StatusUnauthorized, errMsgAuthFailed)- return- }- sendJSONResponse(w, http.StatusBadRequest, "Error getting connection: "+err.Error())- return- }-- response := map[string]interface{}{- "status": http.StatusOK,- "connections": observability,- }-- w.Header().Set("Content-Type", "application/json")- w.WriteHeader(http.StatusOK) // Setting the status code here is actually superfluous since `Encode` will write it as well.-- if err := json.NewEncoder(w).Encode(response); err != nil {- http.Error(w, "Error encoding JSON", http.StatusInternalServerError)- }-}--// generateAPIKeyHandler handles the creation of a new API Key-func generateAPIKeyHandler(w http.ResponseWriter, r *http.Request) {- var request APIKeyRequest-- if err := decodeRequestBody(r, &request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }- request.Normalize()- if request.Name != "doku-client-internal" {- newAPIKey, err := db.GenerateAPIKey(getAuthKey(r), request.Name)- if err != nil {- handleAPIKeyErrors(w, err, request.Name)- return- }-- sendJSONResponse(w, http.StatusOK, newAPIKey)- } else {- sendJSONResponse(w, http.StatusBadRequest, "API Key name 'doku-client-internal' is reserved and cannot be used")- }-}--// getAPIKeyHandler handles retrieving an existing API key.-func getAPIKeyHandler(w http.ResponseWriter, r *http.Request) {- var request APIKeyRequest-- if err := decodeRequestBody(r, &request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }- request.Normalize()- if request.Name != "doku-client-internal" {- apiKey, err := db.GetAPIKeyForName(getAuthKey(r), request.Name)- if err != nil {- handleAPIKeyErrors(w, err, request.Name)- return- }-- sendJSONResponse(w, http.StatusOK, apiKey)- } else {- sendJSONResponse(w, http.StatusBadRequest, "API Key name 'doku-client-internal' is reserved and cannot be accessed")- }-}--// deleteAPIKeyHandler handles deleting an existing API key.-func deleteAPIKeyHandler(w http.ResponseWriter, r *http.Request) {- var request APIKeyRequest-- if err := decodeRequestBody(r, &request); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }-- request.Normalize()- if request.Name != "doku-client-internal" {- err := db.DeleteAPIKey(getAuthKey(r), request.Name)- if err != nil {- handleAPIKeyErrors(w, err, request.Name)- return- }- sendJSONResponse(w, http.StatusOK, "API key deleted successfully")- } else {- sendJSONResponse(w, http.StatusBadRequest, "API Key name 'doku-client-internal' is reserved and cannot be deleted")- }-}--// DataHandler handles data related operations recieved on `/api/push` endpoint.-func DataHandler(w http.ResponseWriter, r *http.Request) {- var data map[string]interface{}-- if err := decodeRequestBody(r, &data); err != nil {- sendJSONResponse(w, http.StatusBadRequest, errMsgInvalidBody)- return- }-- var err error- _, err = auth.AuthenticateRequest(getAuthKey(r))- if err != nil {- handleAPIKeyErrors(w, err, "")- return- }-- // Check if skipResp is true- skipResp, ok := data["skipResp"].(bool)- if ok && skipResp == true {- sendJSONResponse(w, http.StatusAccepted, "Insertion started in background")- go db.PerformDatabaseInsertion(data) // Running as a goroutine for async processing- return- }-- responseMessage, statusCode := db.PerformDatabaseInsertion(data)-- // Respond to the user with the insertion status and any potential errors- sendJSONResponse(w, statusCode, responseMessage)-}--// APIKeyHandler handles all API Key tasks recieved on `/api/keys` endpoint.-func APIKeyHandler(w http.ResponseWriter, r *http.Request) {- switch r.Method {- case "GET":- getAPIKeyHandler(w, r)- case "POST":- generateAPIKeyHandler(w, r)- case "DELETE":- deleteAPIKeyHandler(w, r)- default:- w.WriteHeader(http.StatusMethodNotAllowed)- }-}--// ConnectionsHandler handles all 'Connections' tasks recieved on `/api/connections` endpoint.-func ConnectionsHandler(w http.ResponseWriter, r *http.Request) {- switch r.Method {- case "GET":- getConnectionsHandler(w, r)- case "POST":- generateConnectionsHandler(w, r)- case "DELETE":- deleteConnectionsHandler(w, r)- default:- w.WriteHeader(http.StatusMethodNotAllowed)- }-}--// BaseEndpoint serves as a health check and entry point for the service.-func BaseEndpoint(w http.ResponseWriter, r *http.Request) {- if err := db.PingDB(); err != nil {- log.Error().Err(err).Msgf("Health check failed") // Log the error- sendJSONResponse(w, http.StatusServiceUnavailable, "Database is currently not reachable from the server")- return- }- // The database is up and reachable.- sendJSONResponse(w, http.StatusOK, "Welcome to Doku Ingester - Service operational")-}diff --git a/src/ingester/auth/auth.go b/src/ingester/auth/auth.godeleted file mode 100644index e19ecec4..00000000--- a/src/ingester/auth/auth.go+++ /dev/null@@ -1,75 +0,0 @@-package auth--import (- "database/sql"- "fmt"- "time"-- "github.com/rs/zerolog/log"- "ingester/db"-)--var (- // CacheEntryDuration defines how long an item should stay in the cache before being re-validated.- CacheEntryDuration = time.Minute * 10-)--// cacheEntry represents an entry in the API key cache.-type cacheEntry struct {- Name string- Timestamp time.Time-}--// InitializeCacheEviction sets up periodic eviction of expired cache entries.-func InitializeCacheEviction() {- go func() {- ticker := time.NewTicker(CacheEntryDuration)- defer ticker.Stop()-- for {- <-ticker.C // This blocks until the ticker sends a value- log.Info().Msg("Evicting Expired API Key Cache Entries")- evictExpiredEntries()- db.EvictExpiredEntries()- }- }()-}--// EvictExpiredEntries goes through the cache and evicts expired entries.-func evictExpiredEntries() {- now := time.Now()- db.ApiKeyCache.Range(func(key, value interface{}) bool {- if entry, ok := value.(cacheEntry); ok {- if now.Sub(entry.Timestamp) >= CacheEntryDuration {- db.ApiKeyCache.Delete(key)- }- }- return true- })-}--// AuthenticateRequest checks the provided API key against the known keys.-func AuthenticateRequest(apiKey string) (string, error) {- /// Attempt to retrieve API Key from the cache.- if val, ok := db.ApiKeyCache.Load(apiKey); ok {- entry := val.(cacheEntry)- if time.Since(entry.Timestamp) < CacheEntryDuration {- return entry.Name, nil- }- }-- // If the key is not in the cache or the cache has expired, call the db to check the API key.- name, err := db.CheckAPIKey(apiKey)- if err != nil {- if err == sql.ErrNoRows {- log.Warn().Msg("Authorization Failed for an API Key")- return "", fmt.Errorf("AUTHFAILED")- }- return "", err- }-- // The API key has been successfully authenticated, so cache it.- db.ApiKeyCache.Store(apiKey, cacheEntry{Name: name, Timestamp: time.Now()})-- return name, nil-}diff --git a/src/ingester/config/config.go b/src/ingester/config/config.godeleted file mode 100644index 4d3f503d..00000000--- a/src/ingester/config/config.go+++ /dev/null@@ -1,88 +0,0 @@-package config--import (- "fmt"- "os"- "strconv"- "strings"-)--// Assuming Configuration struct definition is globally accessible-type Configuration struct {- Pricing struct {- URL string `json:"url"`- } `json:"pricing"`- Database struct {- Host string `json:"host"`- Name string `json:"name"`- Password string `json:"password"`- Port string `json:"port"`- User string `json:"user"`- MaxIdleConns int `json:"maxIdleConns"`- MaxOpenConns int `json:"maxOpenConns"`- RetentionPeriod string `json:"retentionPeriod"`- } `json:"database"`-}--func getIntFromEnv(envKey string) int {- valueStr := os.Getenv(envKey)- if value, err := strconv.Atoi(valueStr); err == nil {- return value- }- return 0-}--func LoadConfigFromEnv() (*Configuration, error) {- // Creating the configuration instance- config := &Configuration{}-- // Loading configuration from environment variables- config.Database.Host = os.Getenv("DOKU_DB_HOST")- config.Database.Name = os.Getenv("DOKU_DB_NAME")- config.Database.Password = os.Getenv("DOKU_DB_PASSWORD")- config.Database.Port = os.Getenv("DOKU_DB_PORT")- config.Database.User = os.Getenv("DOKU_DB_USER")- config.Database.MaxIdleConns = getIntFromEnv("DOKU_DB_MAX_IDLE_CONNS")- config.Database.MaxOpenConns = getIntFromEnv("DOKU_DB_MAX_OPEN_CONNS")- config.Database.RetentionPeriod = os.Getenv("DOKU_DB_RETENTION_PERIOD")- config.Pricing.URL = os.Getenv("DOKU_PRICING_JSON_URL")-- if config.Pricing.URL == "" {- config.Pricing.URL = "https://raw.githubusercontent.com/dokulabs/doku/main/assets/pricing.json" // default pricing URL- }- if config.Database.MaxIdleConns == 0 {- config.Database.MaxIdleConns = 10 // default max idle connections- }- if config.Database.MaxOpenConns == 0 {- config.Database.MaxOpenConns = 20 // default max open connections- }- if config.Database.RetentionPeriod == "" {- config.Database.RetentionPeriod = "6 MONTH" // default retention period- }-- missingVars := []string{}-- // Checking required environment variables and collecting names of missing ones- if config.Database.Host == "" {- missingVars = append(missingVars, "DOKU_DB_HOST")- }- if config.Database.Password == "" {- missingVars = append(missingVars, "DOKU_DB_PASSWORD")- }- if config.Database.Port == "" {- missingVars = append(missingVars, "DOKU_DB_PORT")- }- if config.Database.User == "" {- missingVars = append(missingVars, "DOKU_DB_USER")- }- if config.Database.Name == "" {- missingVars = append(missingVars, "DOKU_DB_NAME")- }-- // Returning an error listing all missing variables, if any- if len(missingVars) > 0 {- return nil, fmt.Errorf("missing required environment variables: %s", strings.Join(missingVars, ", "))- }-- return config, nil-}diff --git a/src/ingester/connections/connections.go b/src/ingester/connections/connections.godeleted file mode 100644index 72df32bd..00000000--- a/src/ingester/connections/connections.go+++ /dev/null@@ -1,83 +0,0 @@-package connections--import (- "net/http"- "regexp"- "strings"- "time"-)--type ConnectionConfig struct {- Platform string- MetricsUrl string- LogsUrl string- ApiKey string- MetricsUsername string- LogsUsername string-}--var (- Connections string // Connections contains the information on the platform in use.- httpClient *http.Client // httpClient is the HTTP client used to send data to the Observability Platform.- endpointTypeMapping = map[string]string{- "openai.chat.completions": "Chat",- "openai.completions": "Chat",- "azure.chat.completions": "Chat",- "azure.completions": "Chat",- "cohere.generate": "Chat",- "cohere.chat": "Chat",- "cohere.summarize": "Chat",- "anthropic.messages": "Chat",- "mistral.chat": "Chat",- "openai.embeddings": "Embeddings",- "azure.embeddings": "Embeddings",- "cohere.embed": "Embeddings",- "mistral.embeddings": "Embeddings",- "openai.images.create": "Image",- "azure.images.create": "Image",- "openai.images.create.variations": "Image",- "openai.audio.speech.create": "Audio",- "openai.fine_tuning": "FineTuning",- }-)--func Init() {- httpClient = &http.Client{Timeout: 5 * time.Second}-}--func normalizeString(s string) string {- // Remove backslashes- s = strings.ReplaceAll(s, `\`, "")-- // Replace double quotes with single quotes- s = strings.ReplaceAll(s, `"`, "'")-- // Normalize spacing around hyphens: no space before, one space after hyphens- s = strings.ReplaceAll(s, " - ", " -")- s = strings.ReplaceAll(s, " -", " -")- s = strings.ReplaceAll(s, "- ", " - ")-- // Collapse multiple spaces into a single space- re := regexp.MustCompile(`\s+`)- s = re.ReplaceAllString(s, " ")-- // Trim leading and trailing whitespace- s = strings.TrimSpace(s)-- return s-}--// SendToPlatform sends observability data to the appropriate platform.-func SendToPlatform(data map[string]interface{}, config ConnectionConfig) {- if config.Platform == "grafana" {- configureGrafanaCloudData(data, config)- } else if config.Platform == "newrelic" {- configureNewRelicData(data, config)- } else if config.Platform == "datadog" {- configureDataDogData(data, config)- } else if config.Platform == "signoz" {- configureSignozData(data, config)- } else if config.Platform == "dynatrace" {- configureDynatraceData(data, config)- }-}diff --git a/src/ingester/connections/datadog.go b/src/ingester/connections/datadog.godeleted file mode 100644index 44917211..00000000--- a/src/ingester/connections/datadog.go+++ /dev/null@@ -1,353 +0,0 @@-package connections--import (- "bytes"- "fmt"- "net/http"- "strings"- "time"-- "github.com/rs/zerolog/log"-)--func configureDataDogData(data map[string]interface{}, config ConnectionConfig) {- dataDogMetricsUrl := config.MetricsUrl- dataDogLogsUrl := config.LogsUrl- dataDogAPIKey := config.ApiKey-- currentTime := time.Now().Unix()- var platform string-- // Extract the platform from the endpoint string- endpointParts := strings.Split(data["endpoint"].(string), ".")- if len(endpointParts) > 0 {- platform = endpointParts[0] // The first part of the endpoint string is the platform.- } else {- platform = "Unknown" // If the endpoint string is not in the expected format, set the platform to "unknown".- }-- // Determine the type based on the endpoint by consulting the mapping.- call_type, found := endpointTypeMapping[data["endpoint"].(string)]- if !found {- call_type = "Unknown"- }-- if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["finishReason"] == nil {- data["finishReason"] = "null"- }- // Create individual metric strings- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.completion.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "finishReason:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["completionTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.prompt.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "finishReason:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["promptTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.total.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "finishReason:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["totalTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "finishReason:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.usage.cost",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "finishReason:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["usageCost"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }-- logEntries := []string{- fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:prompt,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:response,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, normalizeString(data["response"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDataDog(logs, dataDogAPIKey, dataDogLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "azure.embeddings" || data["endpoint"] == "mistral.embeddings" {- if data["endpoint"] == "openai.embeddings" {-- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.prompt.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["promptTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.total.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["totalTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.usage.cost",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["usageCost"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }-- logEntries := []string{- fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:prompt,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDataDog(logs, dataDogAPIKey, dataDogLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else {- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.prompt.tokens",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["promptTokens"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.usage.cost",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["usageCost"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }-- logEntries := []string{- fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:prompt,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDataDog(logs, dataDogAPIKey, dataDogLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- }- } else if data["endpoint"] == "openai.fine_tuning" {- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "imageSize:%v","imageQuality:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.usage.cost",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "imageSize:%v","imageQuality:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["usageCost"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }-- var logEntries []string- // Check the condition for the prompt- if data["endpoint"] != "openai.images.create.variations" {- var promptMessage string- if data["model"] == "dall-e-2" {- // Assuming data["prompt"] exists and is a string- promptMessage = normalizeString(data["prompt"].(string))- } else {- // Assuming data["revisedPrompt"] exists and is a string- promptMessage = normalizeString(data["revisedPrompt"].(string))- }-- // Build the prompt log- logEntries = append(logEntries, fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:prompt,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, promptMessage, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- )- }-- logEntries = append(logEntries, fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:image,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, data["image"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- )-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDataDog(logs, dataDogAPIKey, dataDogLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else if data["endpoint"] == "openai.audio.speech.create" {- metricStrings := []string{- fmt.Sprintf(`{- "metric": "doku.llm.request.duration",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "audioVoice:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["requestDuration"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type),- fmt.Sprintf(`{- "metric": "doku.llm.usage.cost",- "type": 0,- "points": [{ "timestamp": %d, "value": %f }],- "resources": [{ "name": "doku", "type": "host" }],- "tags": ["environment:%v", "endpoint:%v", "applicationName:%v", "source:%v", "model:%v", "audioVoice:%v", "platform:%v", "generation:%v"]- }`, currentTime, data["usageCost"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type),- }-- metrics := fmt.Sprintf(`{"series": [%s]}`, strings.Join(metricStrings, ","))- err := sendTelemetryDataDog(metrics, dataDogAPIKey, dataDogMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to DataDog")- }-- logEntries := []string{- fmt.Sprintf(`{- "ddsource": "doku",- "message": "%s",- "ddtags": "environment:%v,endpoint:%v,applicationName:%v,source:%v,model:%v,type:prompt,platform:%v,generation:%v",- "hostname": "doku",- "service": "%v"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["applicationName"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDataDog(logs, dataDogAPIKey, dataDogLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- }-}--func sendTelemetryDataDog(telemetryData, headerKey string, url string, requestType string) error {- // Create a new request using http- req, err := http.NewRequest(requestType, url, bytes.NewBuffer([]byte(telemetryData)))- if err != nil {- return fmt.Errorf("error creating request")- }-- // Add headers to the request- req.Header.Set("Accept", "application/json")- req.Header.Set("Content-Type", "application/json")- req.Header.Set("DD-API-KEY", headerKey)-- // Send the request via a client- resp, err := httpClient.Do(req)- if err != nil {- return fmt.Errorf("error sending request to %v", url)- } else if resp.StatusCode == 404 {- return fmt.Errorf("provided URL %v is not valid", url)- } else if resp.StatusCode == 403 {- return fmt.Errorf("provided credentials are not valid")- }-- defer resp.Body.Close()-- log.Info().Msgf("Successfully exported data to %v", url)- return nil-}diff --git a/src/ingester/connections/dynatrace.go b/src/ingester/connections/dynatrace.godeleted file mode 100644index b93d206a..00000000--- a/src/ingester/connections/dynatrace.go+++ /dev/null@@ -1,282 +0,0 @@-package connections--import (- "bytes"- "fmt"- "io"- "net/http"- "strings"-- "github.com/rs/zerolog/log"-)--func configureDynatraceData(data map[string]interface{}, config ConnectionConfig) {- dynatraceMetricsUrl := config.MetricsUrl- dynatraceLogsUrl := config.LogsUrl- dynatraceAPIKey := config.ApiKey-- var platform string- // Extract the platform from the endpoint string- endpointParts := strings.Split(data["endpoint"].(string), ".")- if len(endpointParts) > 0 {- platform = endpointParts[0] // The first part of the endpoint string is the platform.- } else {- platform = "Unknown" // If the endpoint string is not in the expected format, set the platform to "unknown".- }-- // Determine the type based on the endpoint by consulting the mapping.- call_type, found := endpointTypeMapping[data["endpoint"].(string)]- if !found {- call_type = "Unknown"- }-- if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["finishReason"] == nil {- data["finishReason"] = "null"- }-- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.total.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",finish_reason="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["totalTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.completion.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",finish_reason="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["completionTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.prompt.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",finish_reason="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["promptTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.usage.cost,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",finish_reason="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["usageCost"]) + "\n" +- fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",finish_reason="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["requestDuration"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }-- logEntries := []string{- fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "prompt",- "cost": %v,- "job": "doku"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "response",- "cost": %v,- "job": "doku"- }`, normalizeString(data["response"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDynatrace(logs, dynatraceAPIKey, dynatraceLogsUrl, "application/json", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "mistral.embeddings" || data["endpoint"] == "azure.embeddings" {- if data["endpoint"] == "openai.embeddings" {- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.total.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["totalTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.prompt.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["promptTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.usage.cost,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"]) + "\n" +- fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }-- logEntries := []string{- fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "prompt",- "cost": %v,- "job": "doku"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDynatrace(logs, dynatraceAPIKey, dynatraceLogsUrl, "application/json", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else {- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.prompt.tokens,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["promptTokens"]) + "\n" +- fmt.Sprintf(`doku.llm.usage.cost,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"]) + "\n" +- fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }-- logEntries := []string{- fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "prompt",- "cost": %v,- "job": "doku"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDynatrace(logs, dynatraceAPIKey, dynatraceLogsUrl, "application/json", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- }- } else if data["endpoint"] == "openai.fine_tuning" {- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"]) + "\n" +- fmt.Sprintf(`doku.llm.usage.cost,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }-- var logEntries []string- // Check the condition for the prompt- if data["endpoint"] != "openai.images.create.variations" {- var promptMessage string- if data["model"] == "dall-e-2" {- // Assuming data["prompt"] exists and is a string- promptMessage = normalizeString(data["prompt"].(string))- } else {- // Assuming data["revisedPrompt"] exists and is a string- promptMessage = normalizeString(data["revisedPrompt"].(string))- }-- // Build the prompt log- logEntries = append(logEntries, fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "prompt",- "cost": %v,- "job": "doku"- }`, promptMessage, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- )- }-- logEntries = append(logEntries, fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "image",- "cost": %v,- "job": "doku"- }`, data["image"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], call_type, platform, data["usageCost"]),- )-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDynatrace(logs, dynatraceAPIKey, dynatraceLogsUrl, "application/json", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- } else if data["endpoint"] == "openai.audio.speech.create" {- // Building the data string by concatenating sprintf calls for each metric- metrics := fmt.Sprintf(`doku.llm.request.duration,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"]) + "\n" +- fmt.Sprintf(`doku.llm.usage.cost,environment="%v",endpoint="%v",application="%v",source="%v",model="%v",platform="%v",generation="%v",job="doku" %v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"])-- err := sendTelemetryDynatrace(metrics, dynatraceAPIKey, dynatraceMetricsUrl, "text/plain", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to Dynatrace")- }-- logEntries := []string{- fmt.Sprintf(`{- "body": "%s",- "environment": "%v",- "endpoint": "%v",- "application": "%v",- "source": "%v",- "audioVoice": "%v",- "model": "%v",- "generation": "%v",- "platform": "%v",- "type": "prompt",- "cost": %v,- "job": "doku"- }`, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["audioVoice"], data["model"], call_type, platform, data["usageCost"]),- }-- logs := fmt.Sprintf("[%s]", strings.Join(logEntries, ","))- err = sendTelemetryDynatrace(logs, dynatraceAPIKey, dynatraceLogsUrl, "application/json", "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to DataDog")- }- }-}--func sendTelemetryDynatrace(telemetryData, apiKey string, url string, contentType string, requestType string) error {- // Create a new request using http- req, err := http.NewRequest(requestType, url, bytes.NewBuffer([]byte(telemetryData)))- if err != nil {- return fmt.Errorf("error creating request")- }-- // Add headers to the request- req.Header.Add("Authorization", "Api-Token "+apiKey)- req.Header.Add("Content-Type", contentType)-- // Send the request via a client- resp, err := httpClient.Do(req)- if err != nil {- return fmt.Errorf("error sending request to %v", url)- }-- defer resp.Body.Close()-- // Optionally, read the response body- responseBody, err := io.ReadAll(resp.Body)- if err != nil {- // Handle error- panic(err)- }-- // Printing the response body for demonstration purposes- println(string(responseBody))- return nil-}diff --git a/src/ingester/connections/grafana-cloud.go b/src/ingester/connections/grafana-cloud.godeleted file mode 100644index a89903a8..00000000--- a/src/ingester/connections/grafana-cloud.go+++ /dev/null@@ -1,192 +0,0 @@-package connections--import (- "bytes"- "fmt"- "net/http"- "strconv"- "strings"- "time"-- "github.com/rs/zerolog/log"-)--func configureGrafanaCloudData(data map[string]interface{}, config ConnectionConfig) {- grafanaPromUsername := config.MetricsUsername- grafanaLokiUsername := config.LogsUsername- grafanaAccessToken := config.ApiKey- grafanaPromUrl := config.MetricsUrl- grafanaLokiUrl := config.LogsUrl-- // The current time for the timestamp field.- currentTime := strconv.FormatInt(time.Now().UnixNano(), 10)- var platform string-- // Extract the platform from the endpoint string- endpointParts := strings.Split(data["endpoint"].(string), ".")- if len(endpointParts) > 0 {- platform = endpointParts[0] // The first part of the endpoint string is the platform.- } else {- platform = "Unknown" // If the endpoint string is not in the expected format, set the platform to "unknown".- }-- // Determine the type based on the endpoint by consulting the mapping.- call_type, found := endpointTypeMapping[data["endpoint"].(string)]- if !found {- call_type = "Unknown"- }-- if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["finishReason"] == nil {- data["finishReason"] = "null"- }- metrics := []string{- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,finishReason=%v,platform=%v,generation=%v completionTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["completionTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,finishReason=%v,platform=%v,generation=%v promptTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["promptTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,finishReason=%v,platform=%v,generation=%v totalTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["totalTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,finishReason=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["requestDuration"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,finishReason=%v,platform=%v,generation=%v usageCost=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type, data["usageCost"]),- }-- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }-- authHeader = fmt.Sprintf("Bearer %v:%v", grafanaLokiUsername, grafanaAccessToken)-- response_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"response\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, normalizeString(data["response"].(string))))- err = sendTelemetryGrafanaCloud(response_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }-- prompt_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, normalizeString(data["prompt"].(string))))- err = sendTelemetryGrafanaCloud(prompt_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- } else if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "mistral.embeddings" || data["endpoint"] == "azure.embeddings" {- if data["endpoint"] == "openai.embeddings" {- metrics := []string{- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v promptTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["promptTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v totalTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["totalTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v usageCost=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"]),- }- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }-- authHeader = fmt.Sprintf("Bearer %v:%v", grafanaLokiUsername, grafanaAccessToken)- prompt_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["prompt"]))- err = sendTelemetryGrafanaCloud(prompt_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- } else {- metrics := []string{- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v promptTokens=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["promptTokens"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v usageCost=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["usageCost"]),- }- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }-- authHeader = fmt.Sprintf("Bearer %v:%v", grafanaLokiUsername, grafanaAccessToken)- prompt_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["prompt"]))- err = sendTelemetryGrafanaCloud(prompt_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- }- } else if data["endpoint"] == "openai.fine_tuning" {- metrics := []string{- fmt.Sprintf(`doku_llm,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, data["requestDuration"]),- }- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- metrics := []string{- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,imageSize=%v,imageQuality=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type, data["requestDuration"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,imageSize=%v,imageQuality=%v,platform=%v,generation=%v usageCost=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type, data["usageCost"]),- }- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }-- authHeader = fmt.Sprintf("Bearer %v:%v", grafanaLokiUsername, grafanaAccessToken)- if data["endpoint"] != "openai.images.create.variations" {- prompt_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["revisedPrompt"]))- if data["model"] == "dall-e-2" {- prompt_log = []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["prompt"]))- }- err = sendTelemetryGrafanaCloud(prompt_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- }- image_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"image\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["image"]))- err = sendTelemetryGrafanaCloud(image_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- } else if data["endpoint"] == "openai.audio.speech.create" {- metrics := []string{- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,audioVoice=%v,platform=%v,generation=%v requestDuration=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type, data["requestDuration"]),- fmt.Sprintf(`doku_llm,job=doku,environment=%v,endpoint=%v,applicationName=%v,source=%v,model=%v,audioVoice=%v,platform=%v,generation=%v usageCost=%v`, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type, data["usageCost"]),- }- var metricsBody = []byte(strings.Join(metrics, "\n"))- authHeader := fmt.Sprintf("Bearer %v:%v", grafanaPromUsername, grafanaAccessToken)- err := sendTelemetryGrafanaCloud(metricsBody, authHeader, grafanaPromUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Prometheus")- }-- authHeader = fmt.Sprintf("Bearer %v:%v", grafanaLokiUsername, grafanaAccessToken)- prompt_log := []byte(fmt.Sprintf("{\"streams\": [{\"stream\": {\"environment\": \"%v\",\"endpoint\": \"%v\", \"applicationName\": \"%v\", \"source\": \"%v\", \"model\": \"%v\", \"platform\": \"%v\", \"generation\": \"%v\", \"type\": \"prompt\", \"job\": \"doku\" }, \"values\": [[\"%s\", \"%v\"]]}]}", data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type, currentTime, data["prompt"]))- err = sendTelemetryGrafanaCloud(prompt_log, authHeader, grafanaLokiUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending data to Grafana Cloud Loki")- }- }-}--func sendTelemetryGrafanaCloud(telemetryData []byte, authHeader string, url string, requestType string) error {- req, err := http.NewRequest(requestType, url, bytes.NewBuffer(telemetryData))- if err != nil {- return fmt.Errorf("error creating request")- }- req.Header.Set("Content-Type", "application/json")- req.Header.Set("Authorization", authHeader)-- resp, err := httpClient.Do(req)- if err != nil {- return fmt.Errorf("error sending request to %v", url)- } else if resp.StatusCode == 404 {- return fmt.Errorf("provided URL %v is not valid", url)- } else if resp.StatusCode == 401 {- return fmt.Errorf("provided credentials are not valid")- }-- defer resp.Body.Close()-- log.Info().Msgf("Successfully exported data to %v", url)- return nil-}diff --git a/src/ingester/connections/newrelic.go b/src/ingester/connections/newrelic.godeleted file mode 100644index 92790f34..00000000--- a/src/ingester/connections/newrelic.go+++ /dev/null@@ -1,464 +0,0 @@-package connections--import (- "bytes"- "fmt"- "net/http"- "strconv"- "strings"- "time"-- "github.com/rs/zerolog/log"-)--func configureNewRelicData(data map[string]interface{}, config ConnectionConfig) {- newRelicLicenseKey := config.ApiKey- newRelicMetricsUrl := config.MetricsUrl- newRelicLogsUrl := config.LogsUrl-- // The current time for the timestamp field.- currentTime := strconv.FormatInt(time.Now().Unix(), 10)- var platform string-- // Extract the platform from the endpoint string- endpointParts := strings.Split(data["endpoint"].(string), ".")- if len(endpointParts) > 0 {- platform = endpointParts[0] // The first part of the endpoint string is the platform.- } else {- platform = "Unknown" // If the endpoint string is not in the expected format, set the platform to "unknown".- }-- // Determine the type based on the endpoint by consulting the mapping.- call_type, found := endpointTypeMapping[data["endpoint"].(string)]- if !found {- call_type = "Unknown"- }-- if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["finishReason"] == nil {- data["finishReason"] = "null"- }-- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku.LLM.Completion.Tokens",- "type": "gauge",- "value": %f,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "finishReason": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["completionTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Prompt.Tokens",- "type": "gauge",- "value": %f,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "finishReason": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["promptTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Total.Tokens",- "type": "gauge",- "value": %f,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "finishReason": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["totalTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Request.Duration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "finishReason": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Usage.Cost",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "finishReason": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["usageCost"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["finishReason"], platform, call_type),- }-- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to New Relic")- }-- // Use the values from the provided log lines and adapt them to the desired format.- logs := []string{- fmt.Sprintf(`{- "timestamp": %s,- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "response",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, normalizeString(data["response"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type), // Assuming 'response' is present in data and is a string.-- fmt.Sprintf(`{- "timestamp": %s,- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "prompt",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type), // Assuming 'prompt' is present in data and is a string.- }-- // Combine the individual log entries into a full JSON payload- jsonData = fmt.Sprintf(`[{"logs": [%s]}]`, strings.Join(logs, ","))-- err = sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to New Relic")- }-- } else if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "mistral.embeddings" || data["endpoint"] == "azure.embeddings" {- if data["endpoint"] == "openai.embeddings" {- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku.LLM.Prompt.Tokens",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": { "environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["promptTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Total.Tokens",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["totalTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Request.Duration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": { "environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Usage.Cost",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": { "environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["usageCost"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to New Relic")- }-- // Build log entries with varying labels- logs := []string{- fmt.Sprintf(`{- "timestamp": %s,- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "prompt",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, normalizeString(data["prompt"].(string)), data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type), // Assuming 'prompt' is present in data and is a string.- }- // Combine the individual log entries into a full JSON payload- jsonData = fmt.Sprintf(`[{"logs": [%s]}]`, strings.Join(logs, ","))-- err = sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to New Relic")- }- } else {- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku.LLM.Prompt.Tokens",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["promptTokens"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Request.Duration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Usage.Cost",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["usageCost"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Merics to New Relic")- }-- logs := []string{- // Assuming 'prompt' exists and is a string in data- fmt.Sprintf(`{- "timestamp": "%s",- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "prompt",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`,- currentTime,- data["prompt"],- data["environment"],- data["endpoint"],- data["applicationName"],- data["sourceLanguage"],- data["model"],- platform,- call_type),- }-- // Combine the individual log entries into a full JSON payload- jsonData = fmt.Sprintf(`[{"logs": [%s]}]`, strings.Join(logs, ","))-- err = sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to New Relic")- }-- }- } else if data["endpoint"] == "openai.fine_tuning" {- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku.LLM.Request.Duration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to New Relic")- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku.LLM.Request.Duration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "imageSize": "%v",- "imageQuality": "%v",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type),- fmt.Sprintf(`{- "name": "doku.LLM.Usage.Cost",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "imageSize": "%v",- "imageQuality": "%v",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, data["usageCost"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["imageSize"], data["imageQuality"], platform, call_type),- }-- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to New Relic")- }-- var logs []string- // Check the condition for the prompt- if data["endpoint"] != "openai.images.create.variations" {- var promptMessage string- if data["model"] == "dall-e-2" {- // Assuming data["prompt"] exists and is a string- promptMessage = normalizeString(data["prompt"].(string))- } else {- // Assuming data["revisedPrompt"] exists and is a string- promptMessage = normalizeString(data["revisedPrompt"].(string))- }-- // Build the prompt log- logs = append(logs, fmt.Sprintf(`{- "timestamp": "%s",- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "prompt",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, promptMessage, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type))- }-- // Build the image log- logs = append(logs, fmt.Sprintf(`{- "timestamp": "%s",- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "image",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, data["image"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type))-- // Combine the individual log entries into a full JSON payload- jsonData = fmt.Sprintf(`[{"logs": [%s]}]`, strings.Join(logs, ","))-- err = sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to New Relic")- }-- } else if data["endpoint"] == "openai.audio.speech.create" {- jsonMetrics := []string{- fmt.Sprintf(`{- "name": "doku_llm.RequestDuration",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "audioVoice": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["requestDuration"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type),- fmt.Sprintf(`{- "name": "doku_llm.UsageCost",- "type": "gauge",- "value": %v,- "timestamp": %s,- "attributes": {"environment": "%v", "endpoint": "%v", "applicationName": "%v", "source": "%v", "model": "%v", "audioVoice": "%v", "platform": "%v", "generation": "%v", "job.name": "doku"}- }`, data["usageCost"], currentTime, data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], data["audioVoice"], platform, call_type),- }-- // Join the individual metric strings into a comma-separated string and enclose in a JSON array.- jsonData := fmt.Sprintf(`[{"metrics": [%s]}]`, strings.Join(jsonMetrics, ","))-- err := sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicMetricsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to New Relic")- }-- logs := []string{- // Assuming 'prompt' exists and is a string in data- fmt.Sprintf(`{- "timestamp": "%s",- "message": "%s",- "attributes": {- "environment": "%v",- "endpoint": "%v",- "applicationName": "%v",- "source": "%v",- "model": "%v",- "type": "prompt",- "platform": "%v",- "generation": "%v",- "job.name": "doku"- }- }`, currentTime, data["prompt"], data["environment"], data["endpoint"], data["applicationName"], data["sourceLanguage"], data["model"], platform, call_type),- }-- // Combine the individual log entries into a full JSON payload- jsonData = fmt.Sprintf(`[{"logs": [%s]}]`, strings.Join(logs, ","))-- err = sendTelemetryNewRelic(jsonData, newRelicLicenseKey, "Api-Key", newRelicLogsUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Logs to New Relic")- }- }-}--func sendTelemetryNewRelic(telemetryData, authHeader string, headerKey string, url string, requestType string) error {-- req, err := http.NewRequest(requestType, url, bytes.NewBufferString(telemetryData))- if err != nil {- return fmt.Errorf("error creating request")- }- req.Header.Set("Content-Type", "application/json")- req.Header.Set(headerKey, authHeader)-- resp, err := httpClient.Do(req)- if err != nil {- return fmt.Errorf("error sending request to %v", url)- } else if resp.StatusCode == 404 {- return fmt.Errorf("provided URL %v is not valid", url)- } else if resp.StatusCode == 403 {- return fmt.Errorf("provided credentials are not valid")- }-- defer resp.Body.Close()-- log.Info().Msgf("Successfully exported data to %v", url)- return nil-}diff --git a/src/ingester/connections/signoz.go b/src/ingester/connections/signoz.godeleted file mode 100644index ac88e489..00000000--- a/src/ingester/connections/signoz.go+++ /dev/null@@ -1,234 +0,0 @@-package connections--import (- "bytes"- "fmt"- "net/http"- "strings"-- "github.com/rs/zerolog/log"-)--func configureSignozData(data map[string]interface{}, config ConnectionConfig) {- signozUrl := config.LogsUrl- signozAPIKey := config.ApiKey-- var platform string-- // Extract the platform from the endpoint string- endpointParts := strings.Split(data["endpoint"].(string), ".")- if len(endpointParts) > 0 {- platform = endpointParts[0] // The first part of the endpoint string is the platform.- } else {- platform = "Unknown" // If the endpoint string is not in the expected format, set the platform to "unknown".- }-- // Determine the type based on the endpoint by consulting the mapping.- call_type, found := endpointTypeMapping[data["endpoint"].(string)]- if !found {- call_type = "Unknown"- }-- if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["finishReason"] == nil {- data["finishReason"] = "null"- }-- jsonBody := fmt.Sprintf(`[- {- "trace_id": "",- "span_id": "",- "severity_text": "INFO",- "severity_number": 0,- "attributes": {- "platform": "%v",- "generation": "%v",- "applicationName": "%v",- "sourceLanguage": "%v",- "endpoint": "%v",- "model": "%v",- "usageCost": %v,- "promptTokens": %v,- "completionTokens": %v,- "requestDuration": %v,- "totalTokens": %v,- "finishReason": "%v",- "response": "%v"- },- "resources": {- "job": "doku",- "environment": "%v"- },- "body": "%v"- }- ]`, platform, call_type, data["applicationName"], data["sourceLanguage"], data["endpoint"], data["model"], data["usageCost"], data["promptTokens"], data["completionTokens"], data["requestDuration"], data["totalTokens"], data["finishReason"], normalizeString(data["response"].(string)), data["environment"], normalizeString(data["prompt"].(string)))-- // Send the data to Signoz- err := sendTelemetrySignoz(jsonBody, signozAPIKey, signozUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to SigNoz")- }- } else if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "azure.embeddings" || data["endpoint"] == "mistral.embeddings" {- jsonBody := fmt.Sprintf(`[- {- "trace_id": "",- "span_id": "",- "severity_text": "INFO",- "severity_number": 0,- "attributes": {- "platform": "%v",- "generation": "%v",- "applicationName": "%v",- "sourceLanguage": "%v",- "endpoint": "%v",- "model": "%v",- "usageCost": %v,- "promptTokens": %v,- "requestDuration": %v,- "totalTokens": %v- },- "resources": {- "job": "doku",- "environment": "%v"- },- "body": "%v"- }- ]`, platform, call_type, data["applicationName"], data["sourceLanguage"], data["endpoint"], data["model"], data["usageCost"], data["promptTokens"], data["requestDuration"], data["totalTokens"], data["environment"], normalizeString(data["prompt"].(string)))-- // Send the data to Signoz- err := sendTelemetrySignoz(jsonBody, signozAPIKey, signozUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to SigNoz")- }- } else if data["endpoint"] == "openai.fine_tuning" {- jsonBody := fmt.Sprintf(`[- {- "trace_id": "",- "span_id": "",- "severity_text": "INFO",- "severity_number": 0,- "attributes": {- "platform": "%v",- "generation": "%v",- "applicationName": "%v",- "sourceLanguage": "%v",- "endpoint": "%v",- "model": "%v",- "requestDuration": %v,- "fineTuneJobStatus": "%v"- },- "resources": {- "job": "doku",- "environment": "%v"- },- "body": "%v"- }- ]`, platform, call_type, data["applicationName"], data["sourceLanguage"], data["endpoint"], data["model"], data["requestDuration"], data["finetuneJobStatus"], data["environment"], normalizeString(data["prompt"].(string)))-- // Send the data to Signoz- err := sendTelemetrySignoz(jsonBody, signozAPIKey, signozUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to SigNoz")- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- var promptMessage string- if data["model"] == "dall-e-2" {- // Assuming data["prompt"] exists and is a string- promptMessage = normalizeString(data["prompt"].(string))- } else {- // Assuming data["revisedPrompt"] exists and is a string- promptMessage = normalizeString(data["revisedPrompt"].(string))- }-- jsonBody := fmt.Sprintf(`[- {- "trace_id": "",- "span_id": "",- "severity_text": "INFO",- "severity_number": 0,- "attributes": {- "platform": "%v",- "generation": "%v",- "applicationName": "%v",- "sourceLanguage": "%v",- "endpoint": "%v",- "model": "%v",- "usageCost": %v,- "requestDuration": %v,- "imageSize": "%v",- "imageQuality": "%v",- "image": "%v"- },- "resources": {- "job": "doku",- "environment": "%v"- },- "body": "%v"- }- ]`, platform, call_type, data["applicationName"], data["sourceLanguage"], data["endpoint"], data["model"], data["usageCost"], data["requestDuration"], data["imageSize"], data["imageQuality"], data["image"], data["environment"], promptMessage)-- // Send the data to Signoz- err := sendTelemetrySignoz(jsonBody, signozAPIKey, signozUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to SigNoz")- }- } else if data["endpoint"] == "openai.audio.speech.create" {- jsonBody := fmt.Sprintf(`[- {- "trace_id": "",- "span_id": "",- "severity_text": "INFO",- "severity_number": 0,- "attributes": {- "platform": "%v",- "generation": "%v",- "applicationName": "%v",- "sourceLanguage": "%v",- "endpoint": "%v",- "model": "%v",- "usageCost": %v,- "requestDuration": %v,- "audioVoice": "%v"- },- "resources": {- "job": "doku",- "environment": "%v"- },- "body": "%v"- }- ]`, platform, call_type, data["applicationName"], data["sourceLanguage"], data["endpoint"], data["model"], data["usageCost"], data["requestDuration"], data["audioVoice"], data["environment"], normalizeString(data["prompt"].(string)))-- // Send the data to Signoz- err := sendTelemetrySignoz(jsonBody, signozAPIKey, signozUrl, "POST")- if err != nil {- log.Error().Err(err).Msgf("Error sending Metrics to SigNoz")- }- }-}--func sendTelemetrySignoz(telemetryData, apiKey string, url string, requestType string) error {- // Create a new request using http- req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(telemetryData)))- if err != nil {- return fmt.Errorf("error creating request")- }-- // Add headers to the request- req.Header.Add("Content-Type", "application/json")- req.Header.Add("signoz-access-token", apiKey)-- // Send the request via a client- resp, err := httpClient.Do(req)- if err != nil {- return fmt.Errorf("error sending request to %v", url)- } else if resp.StatusCode == 404 {- return fmt.Errorf("provided URL %v is not valid", url)- } else if resp.StatusCode == 403 {- return fmt.Errorf("provided credentials are not valid")- }-- defer resp.Body.Close()-- log.Info().Msgf("Successfully exported data to %v", url)- return nil-}diff --git a/src/ingester/cost/cost.go b/src/ingester/cost/cost.godeleted file mode 100644index 056e4018..00000000--- a/src/ingester/cost/cost.go+++ /dev/null@@ -1,230 +0,0 @@-package cost--import (- "encoding/json"- "fmt"- "io"- "net/http"- "os"- "regexp"- "strings"-)--var Pricing PricingModel-var modelRegexPatterns = map[string]*regexp.Regexp{}-var directModelLookup = map[string]string{}--// PricingModel is the pricing information for the different models and features.-type PricingModel struct {- Embeddings map[string]float64 `json:"embeddings"`- Images map[string]map[string]map[string]float64 `json:"images"`- Audio map[string]float64 `json:"audio"`- Chat map[string]struct {- PromptPrice float64 `json:"promptPrice"`- CompletionPrice float64 `json:"completionPrice"`- } `json:"chat"`-}--func compileModelRegexes(pricingModel PricingModel) {- // Compile regexes just in case they are needed for more nuanced matches- for modelName := range pricingModel.Embeddings {- pattern := regexp.QuoteMeta(modelName)- modelRegexPatterns["embeddings:"+modelName] = regexp.MustCompile(pattern)- }-- // Images- for modelName := range pricingModel.Images {- pattern := regexp.QuoteMeta(modelName)- modelRegexPatterns["images:"+modelName] = regexp.MustCompile(pattern)- }-- // Audio- for modelName := range pricingModel.Audio {- pattern := regexp.QuoteMeta(modelName)- modelRegexPatterns["audio:"+modelName] = regexp.MustCompile(pattern)- }-- // Chat- for modelName := range pricingModel.Chat {- pattern := regexp.QuoteMeta(modelName)- modelRegexPatterns["chat:"+modelName] = regexp.MustCompile(pattern)- }-}--func buildDirectLookupTable(pricingModel PricingModel) {- // Direct mappings for known models- for modelName := range pricingModel.Embeddings {- directModelLookup[modelName] = modelName- }- for modelName := range pricingModel.Chat {- directModelLookup[modelName] = modelName- }- for modelName := range pricingModel.Audio {- directModelLookup[modelName] = modelName- }- for modelName := range pricingModel.Images {- directModelLookup[modelName] = modelName- }-}--// validatePricingData validates the pricing data for the different models and features.-func validatePricingData(pricingModel PricingModel) error {- // Example validation for Embeddings pricing- if len(pricingModel.Embeddings) == 0 {- return fmt.Errorf("Embeddings pricing data is not defined")- }-- // Example validation for Audio pricing- if len(pricingModel.Audio) == 0 {- return fmt.Errorf("Audio pricing data is not defined")- }-- // Validate the Images pricing, which has nested maps- for model, qualityMap := range pricingModel.Images {- if len(qualityMap) == 0 {- return fmt.Errorf("image pricing data for model '%s' is not defined in the JSON File", model)- }- for quality, sizeMap := range qualityMap {- if len(sizeMap) == 0 {- return fmt.Errorf("image pricing data for model '%s', quality '%s' is not defined in the JSON File", model, quality)- }- }- }-- // Validate the Chat pricing- for model, chatPricing := range pricingModel.Chat {- if chatPricing.PromptPrice == 0 {- return fmt.Errorf("Prompt Tokens pricing data for model '%s' is not defined in the JSON File", model)- } else if chatPricing.CompletionPrice == 0 {- return fmt.Errorf("Completion Tokens pricing data for model '%s' is not defined in the JSON File", model)- }- }-- return nil-}--// fetchJSONFromURL is a new function for fetching JSON content from a URL.-func fetchJSONFromURL(url string) ([]byte, error) {- maxRetries := 5- var resp *http.Response- var err error- for i := 0; i < maxRetries; i++ {- resp, err = http.Get(url)- if err == nil {- break- }- }-- if err != nil {- return nil, fmt.Errorf("Failed to make request to URL %s", url)- }- defer resp.Body.Close()-- if resp.StatusCode != http.StatusOK {- return nil, fmt.Errorf("Failed to fetch JSON content from URL %s", url)- }-- return io.ReadAll(resp.Body)-}--// fetchJSONFromFile is a new function for fetching JSON content from a URL.-func fetchJSONFromFile(path string) ([]byte, error) {- content, err := os.ReadFile(path)- if err != nil {- return nil, fmt.Errorf("Failed to fetch JSON content from file '%s'", path)- }-- return content, nil-}--// LoadPricing loads the pricing information from the given file.-func LoadPricing(path, url string) error {- var content []byte- var err error-- switch {- case path != "":- content, err = fetchJSONFromFile(path)- case url != "":- content, err = fetchJSONFromURL(url)- }- if err != nil {- return err- }-- if err = json.Unmarshal(content, &Pricing); err != nil {- return fmt.Errorf("Failed to unmarshal costing JSON: %w", err)- }-- if err = validatePricingData(Pricing); err != nil {- return err- }-- compileModelRegexes(Pricing)- buildDirectLookupTable(Pricing)-- return nil-}--func findBaseModelFromPattern(modelName string) string {- // First, check the direct lookup table- if baseModel, found := directModelLookup[modelName]; found {- return baseModel- }- // Fallback to regex pattern matching if not found- for baseModel, pattern := range modelRegexPatterns {- if pattern.MatchString(modelName) {- return strings.SplitN(baseModel, ":", 2)[1]- }- }- return modelName-}--// calculateEmbeddingsCost calculates the cost for embeddings based on the model and prompt tokens.-func CalculateEmbeddingsCost(promptTokens float64, model string) (float64, error) {- baseModel := findBaseModelFromPattern(model)- price, ok := Pricing.Embeddings[baseModel]- if !ok {- return 0, nil- }- return (promptTokens / 1000) * price, nil-}--// calculateImageCost calculates the cost for images based on the model, image size, and quality.-func CalculateImageCost(model, imageSize, quality string) (float64, error) {- baseModel := findBaseModelFromPattern(model)- models, ok := Pricing.Images[baseModel]- if !ok {- return 0, nil- }- qualities, ok := models[quality]- if !ok {- return 0, nil- }- price, ok := qualities[imageSize]- if !ok {- return 0, nil- }-- return price, nil-}--// calculateChatCost calculates the cost for chat based on the model, prompt tokens, and completion tokens.-func CalculateChatCost(promptTokens, completionTokens float64, model string) (float64, error) {- baseModel := findBaseModelFromPattern(model)- chatModel, ok := Pricing.Chat[baseModel]- if !ok {- return 0, nil- }- return ((promptTokens / 1000) * chatModel.PromptPrice) + ((completionTokens / 1000) * chatModel.CompletionPrice), nil-}--// CalculateAudioCost calculates the cost for Audio based on the model, and prompt.-func CalculateAudioCost(prompt string, model string) (float64, error) {- baseModel := findBaseModelFromPattern(model)- price, ok := Pricing.Audio[baseModel]- if !ok {- return 0, nil- }- return ((float64(len(prompt)) / 1000) * price), nil-}diff --git a/src/ingester/db/db.go b/src/ingester/db/db.godeleted file mode 100644index d763c9fa..00000000--- a/src/ingester/db/db.go+++ /dev/null@@ -1,598 +0,0 @@-package db--import (- "context"- "crypto/rand"- "database/sql"- "encoding/hex"- "fmt"- "ingester/config"- "ingester/connections"- "ingester/cost"- "net/http"- "sync"- "time"-- "github.com/ClickHouse/clickhouse-go/v2"- _ "github.com/ClickHouse/clickhouse-go/v2/lib/driver"- "github.com/pkoukk/tiktoken-go"- "github.com/rs/zerolog/log"-)--var (- connectionCache sync.Map // connectionCache stores the lookup of connection details- ApiKeyCache = sync.Map{} // ApiKeyCache stores the lookup of API keys and organization IDs.- CacheEntryDuration = time.Minute * 10 // CacheEntryDuration defines how long an item should stay in the cache before being re-validated.- db clickhouse.Conn // db holds the database connection- ctx = context.Background() // ctx is the context for the database connection- doku_llm_data_table = "DOKU_LLM_DATA" // doku_llm_data_table holds the name of the data table- doku_apikeys_table = "DOKU_APIKEYS" // doku_apikeys_table holds the name of the API keys table- doku_connections_table = "DOKU_CONNECTIONS" // doku_connections_table holds the name of the connections table- // validFields represent the fields that are expected in the incoming data.- validFields = []string{- "name",- "llmReqId",- "environment",- "endpoint",- "sourceLanguage",- "applicationName",- "completionTokens",- "promptTokens",- "totalTokens",- "finishReason",- "requestDuration",- "usageCost",- "model",- "prompt",- "response",- "imageSize",- "revisedPrompt",- "image",- "audioVoice",- "finetuneJobStatus",- }-)--type ConnectionRequest struct {- Platform string `json:"platform"`- MetricsUsername string `json:"metricsUsername,omitempty"`- LogsUserName string `json:"logsUserName,omitempty"`- ApiKey string `json:"apiKey"`- MetricsURL string `json:"metricsURL,omitempty"`- LogsURL string `json:"logsURL,omitempty"`-}--type connectionCacheEntry struct {- Config *connections.ConnectionConfig- Timestamp time.Time-}--// PingDB checks if the database is responsive.-func PingDB() error {- if err := db.Ping(ctx); err != nil {- return err- }- return nil-}--// EvictExpiredEntries goes through the cache and evicts expired entries.-func EvictExpiredEntries() {- now := time.Now()- connectionCache.Range(func(key, value interface{}) bool {- if entry, ok := value.(connectionCacheEntry); ok {- if now.Sub(entry.Timestamp) >= CacheEntryDuration {- connectionCache.Delete(key)- }- }- return true- })-}--// GenerateSecureRandomKey should generate a secure random string to be used as an API key.-func generateSecureRandomKey() (string, error) {- randomPartLength := 40 / 2 // Each byte becomes two hex characters, so we need half as many bytes.-- randomBytes := make([]byte, randomPartLength)- _, err := rand.Read(randomBytes)- if err != nil {- log.Error().Err(err).Msg("error generating random bytes")- // In the case of an error, return it as we cannot generate a key.- return "", err- }-- // Encode the random bytes as a hex string and prefix with 'dk'.- randomHexString := hex.EncodeToString(randomBytes)- apiKey := "dk" + randomHexString-- return apiKey, nil-}--// getCreateConnectionsTableSQL returns the SQL query to create the API keys table.-func getCreateConnectionsTableSQL(tableName string) string {- return fmt.Sprintf(`- CREATE TABLE IF NOT EXISTS %s (- id UUID DEFAULT generateUUIDv4(),- platform String NOT NULL,- metricsUrl String NOT NULL,- logsUrl String NOT NULL,- apiKey String NOT NULL,- metricsUsername String NOT NULL,- logsUsername String NOT NULL,- created_at DateTime DEFAULT now()- ) ENGINE = MergeTree()- ORDER BY id;`, tableName)-}--// getCreateAPIKeysTableSQL returns the SQL query to create the API keys table.-func getCreateAPIKeysTableSQL(tableName string) string {- return fmt.Sprintf(`- CREATE TABLE IF NOT EXISTS %s (- id UUID DEFAULT generateUUIDv4(), // Use ClickHouse's function to generate UUIDs- api_key String NOT NULL, // VARCHAR is equivalent to String in ClickHouse- name String NOT NULL,- created_at DateTime DEFAULT now()- ) ENGINE = MergeTree() // Specify the table engine, MergeTree engines are common in ClickHouse- ORDER BY (id, api_key);`, tableName) // Define the primary key as part of the engine's ORDER BY-}--// getCreateDataTableSQL returns the SQL query to create the data table in ClickHouse.-func getCreateDataTableSQL(tableName string, retentionPeriod string) string {- return fmt.Sprintf(`- CREATE TABLE IF NOT EXISTS %s (- time DateTime NOT NULL,- id UUID DEFAULT generateUUIDv4(),- llmReqId String,- environment String NOT NULL,- endpoint String NOT NULL,- sourceLanguage String NOT NULL,- applicationName String NOT NULL,- completionTokens Int32,- promptTokens Int32,- totalTokens Int32,- finishReason String,- requestDuration Float64,- usageCost Float64,- model String,- prompt String,- response String,- imageSize String,- revisedPrompt String,- image String,- audioVoice String,- finetuneJobStatus String,- feedback Int32- ) ENGINE = MergeTree()- ORDER BY (time, id)- TTL time + INTERVAL + %s DELETE; `, tableName, retentionPeriod)-}--func tableExists(tableName string, databaseName string) (bool, error) {- query := `SELECT count()- FROM system.tables- WHERE database = ? AND name = ?`-- var count uint64- if err := db.QueryRow(ctx, query, databaseName, tableName).Scan(&count); err != nil {- return false, err- }- return count > 0, nil-}--// createTable attempts to create a table in ClickHouse if it doesn't already exist.-func createTable(tableName string, cfg config.Configuration) error {- var createTableSQL string-- if tableName == doku_apikeys_table {- createTableSQL = getCreateAPIKeysTableSQL(tableName)- } else if tableName == doku_llm_data_table {- createTableSQL = getCreateDataTableSQL(tableName, cfg.Database.RetentionPeriod)- } else if tableName == doku_connections_table {- createTableSQL = getCreateConnectionsTableSQL(tableName)- }-- exists, err := tableExists(tableName, cfg.Database.Name)- if err != nil {- return fmt.Errorf("error checking table '%s' existence: %w", tableName, err)- }- if !exists {- if err = db.Exec(ctx, createTableSQL); err != nil {- return fmt.Errorf("error creating table '%s': %w", tableName, err)- }- if tableName == doku_apikeys_table {- newAPIKey, _ := generateSecureRandomKey()- // Insert the new API key into the database- insertQuery := fmt.Sprintf("INSERT INTO %s (api_key, name) VALUES ($1, $2)", doku_apikeys_table)- err = db.Exec(ctx, insertQuery, newAPIKey, "doku-client-internal")- if err != nil {- log.Error().Err(err).Msg("Error inserting the new API key in the database")- return err- }- }- log.Printf("table '%s' created in the database", tableName)- return nil- }- log.Info().Msgf("table '%s' exists in the database", tableName)- return nil-}--// initializeDB initializes connection to the database.-func initializeDB(cfg config.Configuration) error {- var err error- addr := fmt.Sprintf("%s:%s", cfg.Database.Host, cfg.Database.Port)- for attempt := 1; attempt <= 5; attempt++ {- db, _ = clickhouse.Open(&clickhouse.Options{- Addr: []string{addr},- Auth: clickhouse.Auth{- Database: cfg.Database.Name,- Username: cfg.Database.User,- Password: cfg.Database.Password,- },- MaxOpenConns: cfg.Database.MaxOpenConns,- MaxIdleConns: cfg.Database.MaxIdleConns,- })-- // Ping the database to check if it's connected.- if err = PingDB(); err != nil {- log.Warn().Msgf("failed to connect to the database on attempt %d, retrying in %s", attempt, 15*time.Second)- if attempt < 5 {- db.Close()- time.Sleep(15 * time.Second)- continue- }- return err- }- }- return nil-}--func getTokens(text, model string) int {- tkm, err := tiktoken.EncodingForModel(model)- if err != nil {- tkm, _ = tiktoken.GetEncoding("cl100k_base")- }- token := tkm.Encode(text, nil, nil)- return len(token)-}--// insertDataToDB inserts data into the database.-func insertDataToDB(data map[string]interface{}) (string, int) {- // Calculate usage cost based on the endpoint type- if data["endpoint"] == "openai.embeddings" || data["endpoint"] == "cohere.embed" || data["endpoint"] == "azure.embeddings" || data["endpoint"] == "mistral.embeddings" {- data["usageCost"], _ = cost.CalculateEmbeddingsCost(data["promptTokens"].(float64), data["model"].(string))- } else if data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "cohere.chat" || data["endpoint"] == "cohere.summarize" || data["endpoint"] == "cohere.generate" || data["endpoint"] == "anthropic.messages" || data["endpoint"] == "mistral.chat" || data["endpoint"] == "azure.chat.completions" || data["endpoint"] == "azure.completions" {- if data["completionTokens"] != nil && data["promptTokens"] != nil {- data["usageCost"], _ = cost.CalculateChatCost(data["promptTokens"].(float64), data["completionTokens"].(float64), data["model"].(string))- } else if (data["endpoint"] == "openai.chat.completions" || data["endpoint"] == "openai.completions" || data["endpoint"] == "azure.completions" || data["endpoint"] == "azure.chat.completions") && data["prompt"] != nil && data["response"] != nil {- data["promptTokens"] = getTokens(data["prompt"].(string), data["model"].(string))- data["completionTokens"] = getTokens(data["response"].(string), data["model"].(string))- data["totalTokens"] = data["promptTokens"].(int) + data["completionTokens"].(int)- data["usageCost"], _ = cost.CalculateChatCost(float64(data["promptTokens"].(int)), float64(data["completionTokens"].(int)), data["model"].(string))- }- } else if data["endpoint"] == "openai.images.create" || data["endpoint"] == "openai.images.create.variations" || data["endpoint"] == "azure.images.create" {- data["usageCost"], _ = cost.CalculateImageCost(data["model"].(string), data["imageSize"].(string), data["imageQuality"].(string))- } else if data["endpoint"] == "openai.audio.speech.create" {- data["usageCost"], _ = cost.CalculateAudioCost(data["prompt"].(string), data["model"].(string))- }-- // Fill missing fields with nil- for _, field := range validFields {- if _, exists := data[field]; !exists {- data[field] = nil- }- }-- // Construct query with placeholders- query := fmt.Sprintf("INSERT INTO %s (time, llmReqId, environment, endpoint, sourceLanguage, applicationName, completionTokens, promptTokens, totalTokens, finishReason, requestDuration, usageCost, model, prompt, response, imageSize, revisedPrompt, image, audioVoice, finetuneJobStatus) VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", doku_llm_data_table)-- // Create a slice for parameters in the correct order- params := []interface{}{- data["llmReqId"],- data["environment"],- data["endpoint"],- data["sourceLanguage"],- data["applicationName"],- data["completionTokens"],- data["promptTokens"],- data["totalTokens"],- data["finishReason"],- data["requestDuration"],- data["usageCost"],- data["model"],- data["prompt"],- data["response"],- data["imageSize"],- data["revisedPrompt"],- data["image"],- data["audioVoice"],- data["finetuneJobStatus"],- }-- // Execute the SQL query- err := db.Exec(ctx, query, params...)- if err != nil {- log.Error().Err(err).Msg("error Inserting data into the database")- return "Internal Server Error", http.StatusInternalServerError- }-- go func() {- connDetails, err := checkConnections()- if err != nil {- log.Error().Err(err).Msg("Error checking for 'Connections' in the database")- }-- if connDetails != nil {- connections.SendToPlatform(data, *connDetails)- } else {- log.Info().Msg("No 'Connections' details found for export. skipping data export")- }- }()-- return "Data insertion completed", http.StatusCreated-}--// Init initializes the database connection and creates the required tables.-func Init(cfg config.Configuration) error {- err := initializeDB(cfg)- if err != nil {- return err- }-- // Create the DATA and API keys table if it doesn't exist.- log.Info().Msgf("creating '%s', '%s' and '%s' tables in the database if they don't exist", doku_connections_table, doku_apikeys_table, doku_llm_data_table)-- err = createTable(doku_connections_table, cfg)- if err != nil {- return err- }-- err = createTable(doku_apikeys_table, cfg)- if err != nil {- return err- }-- err = createTable(doku_llm_data_table, cfg)- if err != nil {- return err- }- return nil-}--func checkConnections() (*connections.ConnectionConfig, error) {- // Attempt to retrieve the connections config from cache first- if value, ok := connectionCache.Load("connectionConfig"); ok {- if entry, ok := value.(connectionCacheEntry); ok {- // Check if the cache entry is still valid- if time.Since(entry.Timestamp) < CacheEntryDuration {- return entry.Config, nil- }- }- }-- // If not in cache or cache is expired, query the database- query := fmt.Sprintf("SELECT platform, metricsUrl, logsUrl, apiKey, metricsUsername, logsUsername FROM %s;", doku_connections_table)- var connDetails connections.ConnectionConfig- // Ensure you have a valid database connection 'db' to ClickHouse, and it might need a context passed if supported- row := db.QueryRow(ctx, query) // Assuming you have a context 'ctx' available- err := row.Scan(&connDetails.Platform, &connDetails.MetricsUrl, &connDetails.LogsUrl,- &connDetails.ApiKey, &connDetails.MetricsUsername, &connDetails.LogsUsername)- if err != nil {- if err == sql.ErrNoRows {- return nil, nil- }- return nil, err- }-- // Cache the newly retrieved ConnectionConfig- connectionCache.Store("connectionConfig", connectionCacheEntry{Config: &connDetails, Timestamp: time.Now()})-- return &connDetails, nil-}--// PerformDatabaseInsertion performs the database insertion synchronously.-func PerformDatabaseInsertion(data map[string]interface{}) (string, int) {- // Call insertDataToDB directly instead of starting a new goroutine.- responseMessage, statusCode := insertDataToDB(data)-- // The operation is now synchronous. Once insertDataToDB returns, the result is ready to use.- return responseMessage, statusCode-}--func CheckAPIKey(apiKey string) (string, error) {- var name string-- // Adjust the placeholder for ClickHouse- query := fmt.Sprintf("SELECT name FROM %s WHERE api_key = ?", doku_apikeys_table)- err := db.QueryRow(ctx, query, apiKey).Scan(&name)- if err != nil {- if err == sql.ErrNoRows {- return "", err- }- return "", err- }- return name, nil-}--func GenerateAPIKey(existingAPIKey, name string) (string, error) {- count := uint64(0)-- countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s WHERE name != 'doku-client-internal'", doku_apikeys_table)- err := db.QueryRow(ctx, countQuery).Scan(&count)- if err != nil {- log.Error().Err(err).Msg("error checking API key table")- return "", fmt.Errorf("failed to check API key table: %v", err)- }-- // Only perform the check if the count is greater than zero- if count > 0 {- // Attempt to retrieve any existing key for the given name.- _, err = GetAPIKeyForName(existingAPIKey, name)- if err == nil {- log.Warn().Msgf("error creating new API Key as a key with the name '%s' already exists", name)- return "", fmt.Errorf("KEYEXISTS")- } else if err.Error() == "AUTHFAILED" {- return "", err- }- }-- newAPIKey, _ := generateSecureRandomKey()-- // Properly use placeholders for the query parameters, adjusted for ClickHouse- insertQuery := fmt.Sprintf("INSERT INTO %s (api_key, name) VALUES (?, ?)", doku_apikeys_table)- if err := db.Exec(ctx, insertQuery, newAPIKey, name); err != nil {- log.Error().Err(err).Msg("error inserting the new API key in the database")- return "", err- }- log.Info().Msgf("API Key with the name '%s' created successfully", name)- return newAPIKey, nil-}--func GetAPIKeyForName(existingAPIKey, name string) (string, error) {- // Authenticate the provided API key before proceeding- _, err := CheckAPIKey(existingAPIKey)- if err != nil {- log.Warn().Msg("Authorization Failed for an API Key")- return "", fmt.Errorf("AUTHFAILED")- }- // Retrieve the API key for the given name- var apiKey string- // Adjust the query to use ? as a placeholder- query := fmt.Sprintf("SELECT api_key FROM %s WHERE name = ?", doku_apikeys_table)- err = db.QueryRow(ctx, query, name).Scan(&apiKey)- if err != nil {- if err == sql.ErrNoRows {- log.Warn().Msgf("API Key with the name '%s' currently not found in the database", name)- return "", fmt.Errorf("NOTFOUND")- }- log.Warn().Err(err).Msgf("error retrieving API key for the name '%s'", name)- return "", err- }-- return apiKey, nil-}--func DeleteAPIKey(existingAPIKey, name string) error {- // Authenticate the provided API key before proceeding and check if the API key exists- apiKey, err := GetAPIKeyForName(existingAPIKey, name)- if err != nil {- // If auth failed or API key was not found, return the error directly- return err- }-- // Delete the API key from the database- log.Info().Msgf("deleting API Key with the name '%s' from the database", name)- // Adjust the query to use ? as the placeholder for ClickHouse- query := fmt.Sprintf("DELETE FROM %s WHERE api_key = ?", doku_apikeys_table)- if err = db.Exec(ctx, query, apiKey); err != nil {- log.Error().Err(err).Msg("error deleting API key")- return err- }-- // Assuming ApiKeyCache is a custom caching mechanism you've implemented- ApiKeyCache.Delete(apiKey)- log.Info().Msgf("API Key with the name '%s' deleted successfully", name)- return nil-}--func GenerateConnection(existingAPIKey string, config ConnectionRequest) error {- // Authenticate the provided API key before proceeding- _, err := CheckAPIKey(existingAPIKey)- if err != nil {- log.Warn().Msg("Authorization Failed for an API Key")- return fmt.Errorf("AUTHFAILED")- }-- // Delete all existing rows in the connections table- deleteRows := fmt.Sprintf("DELETE FROM %s WHERE 1=1", doku_connections_table)- if err = db.Exec(ctx, deleteRows); err != nil {- log.Error().Err(err).Msg("error deleting the existing Connections config in the database")- return err- }-- // Insert the new connection configuration into the table- // Note: ClickHouse uses ? as placeholders- insertQuery := fmt.Sprintf("INSERT INTO %s (platform, metricsUrl, logsUrl, apiKey, metricsUsername, logsUsername) VALUES (?, ?, ?, ?, ?, ?)", doku_connections_table)- if err = db.Exec(ctx, insertQuery, config.Platform, config.MetricsURL, config.LogsURL, config.ApiKey, config.MetricsUsername, config.LogsUserName); err != nil {- log.Error().Err(err).Msg("error inserting the new Connections config in the database")- return err- }- // Assuming connectionCache is a custom mechanism for caching the connection configuration- connectionCache.Delete("connectionConfig")- log.Info().Msgf("New Connection config created successfully")- return nil-}--// / DeleteConnection deletes the existing connection configuration from the database.-func DeleteConnection(existingAPIKey string) error {- // Authenticate the provided API key before proceeding- _, err := CheckAPIKey(existingAPIKey)- if err != nil {- log.Warn().Msg("Authorization Failed for an API Key")- return fmt.Errorf("AUTHFAILED")- }-- var count uint64- countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s", doku_connections_table)- err = db.QueryRow(ctx, countQuery).Scan(&count)- if err != nil {- log.Error().Err(err).Msg("error checking Connections Table")- return fmt.Errorf("failed to check Connections table: %v", err)- }- if count >= 1 {- deleteRows := fmt.Sprintf("DELETE FROM %s WHERE 1=1", doku_connections_table)- err = db.Exec(ctx, deleteRows)- if err != nil {- log.Error().Err(err).Msg("error deleting the existing Connections config in the database")- return err- }- // Assuming connectionCache is a mechanism you've implemented for caching- connectionCache.Delete("connectionConfig")- log.Info().Msg("connection config deleted successfully")- } else {- return fmt.Errorf("NOTFOUND")- }-- return nil-}--// / GetConnection gets the existing connection configuration from the database.-func GetConnection(existingAPIKey string) (map[string]interface{}, error) {- // Authenticate the provided API key before proceeding- _, err := CheckAPIKey(existingAPIKey)- if err != nil {- log.Warn().Msg("Authorization Failed for an API Key")- return nil, fmt.Errorf("AUTHFAILED")- }-- connectionDetails := map[string]interface{}{}-- // Prepare the ClickHouse SQL query.- query := fmt.Sprintf(`SELECT platform, metricsUrl, logsUrl, apiKey, metricsUsername, logsUsername, created_at FROM %s ORDER BY id LIMIT 1`, doku_connections_table)-- // QueryRow executes the query and returns at most one row.- row := db.QueryRow(ctx, query)-- var platform, metricsUrl, logsUrl, apiKey, metricsUsername, logsUsername string- var createdAt time.Time-- // Scan the results into variables.- err = row.Scan(&platform, &metricsUrl, &logsUrl, &apiKey, &metricsUsername, &logsUsername, &createdAt)- if err != nil {- if err == sql.ErrNoRows {- log.Info().Msg("No configuration found in the database.")- return nil, fmt.Errorf("NOTFOUND")- }- log.Error().Err(err).Msg("Failed to get the connection configuration")- return nil, err- }-- // Populate the results map.- connectionDetails["platform"] = platform- connectionDetails["metricsUrl"] = metricsUrl- connectionDetails["logsUrl"] = logsUrl- connectionDetails["apiKey"] = apiKey- connectionDetails["metricsUsername"] = metricsUsername- connectionDetails["logsUsername"] = logsUsername- connectionDetails["created_at"] = createdAt-- return connectionDetails, nil-}diff --git a/src/ingester/go.mod b/src/ingester/go.moddeleted file mode 100644index 3557ad9b..00000000--- a/src/ingester/go.mod+++ /dev/null@@ -1,32 +0,0 @@-module ingester--go 1.22.1--require (- github.com/ClickHouse/clickhouse-go/v2 v2.23.0- github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be- github.com/gorilla/mux v1.8.1- github.com/pkoukk/tiktoken-go v0.1.6- github.com/rs/zerolog v1.32.0-)--require (- github.com/ClickHouse/ch-go v0.61.5 // indirect- github.com/andybalholm/brotli v1.1.0 // indirect- github.com/dlclark/regexp2 v1.10.0 // indirect- github.com/go-faster/city v1.0.1 // indirect- github.com/go-faster/errors v0.7.1 // indirect- github.com/google/uuid v1.6.0 // indirect- github.com/klauspost/compress v1.17.7 // indirect- github.com/mattn/go-colorable v0.1.13 // indirect- github.com/mattn/go-isatty v0.0.19 // indirect- github.com/paulmach/orb v0.11.1 // indirect- github.com/pierrec/lz4/v4 v4.1.21 // indirect- github.com/pkg/errors v0.9.1 // indirect- github.com/segmentio/asm v1.2.0 // indirect- github.com/shopspring/decimal v1.3.1 // indirect- go.opentelemetry.io/otel v1.24.0 // indirect- go.opentelemetry.io/otel/trace v1.24.0 // indirect- golang.org/x/sys v0.18.0 // indirect- gopkg.in/yaml.v3 v3.0.1 // indirect-)diff --git a/src/ingester/go.sum b/src/ingester/go.sumdeleted file mode 100644index bcbbf1bd..00000000--- a/src/ingester/go.sum+++ /dev/null@@ -1,131 +0,0 @@-github.com/ClickHouse/ch-go v0.61.5 h1:zwR8QbYI0tsMiEcze/uIMK+Tz1D3XZXLdNrlaOpeEI4=-github.com/ClickHouse/ch-go v0.61.5/go.mod h1:s1LJW/F/LcFs5HJnuogFMta50kKDO0lf9zzfrbl0RQg=-github.com/ClickHouse/clickhouse-go/v2 v2.23.0 h1:srmRrkS0BR8gEut87u8jpcZ7geOob6nGj9ifrb+aKmg=-github.com/ClickHouse/clickhouse-go/v2 v2.23.0/go.mod h1:tBhdF3f3RdP7sS59+oBAtTyhWpy0024ZxDMhgxra0QE=-github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=-github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=-github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be h1:J5BL2kskAlV9ckgEsNQXscjIaLiOYiZ75d4e94E6dcQ=-github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w=-github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=-github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0=-github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=-github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw=-github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw=-github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg=-github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo=-github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=-github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=-github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=-github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=-github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=-github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=-github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=-github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=-github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=-github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=-github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=-github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=-github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=-github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=-github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=-github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=-github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=-github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=-github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=-github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=-github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=-github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=-github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=-github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=-github.com/paulmach/orb v0.11.1 h1:3koVegMC4X/WeiXYz9iswopaTwMem53NzTJuTF20JzU=-github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU=-github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=-github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=-github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=-github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=-github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=-github.com/pkoukk/tiktoken-go v0.1.6 h1:JF0TlJzhTbrI30wCvFuiw6FzP2+/bR+FIxUdgEAcUsw=-github.com/pkoukk/tiktoken-go v0.1.6/go.mod h1:9NiV+i9mJKGj1rYOT+njbv+ZwA/zJxYdewGl6qVatpg=-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=-github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=-github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=-github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=-github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=-github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=-github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=-github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=-github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=-github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=-github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=-github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=-github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=-github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=-github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=-github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=-github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=-github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=-github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=-github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=-go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=-go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=-go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=-go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=-go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=-golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=-golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=-golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=-golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=-golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=-golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=-golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=-golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=-golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=-golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=-golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=-golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=-golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=-golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=-google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=-google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=diff --git a/src/ingester/main.go b/src/ingester/main.godeleted file mode 100644index 5977deba..00000000--- a/src/ingester/main.go+++ /dev/null@@ -1,107 +0,0 @@-package main--import (- "context"- "net/http"- "os"- "os/signal"- "syscall"- "time"-- "ingester/api"- "ingester/auth"- "ingester/config"- "ingester/connections"- "ingester/cost"- "ingester/db"-- "github.com/common-nighthawk/go-figure"- "github.com/gorilla/mux"- "github.com/rs/zerolog"- "github.com/rs/zerolog/log"-)--func waitForShutdown(server *http.Server) {- quit := make(chan os.Signal, 1)- signal.Notify(quit, os.Interrupt, syscall.SIGTERM)-- // Wait for an interrupt- sig := <-quit- log.Info().Msgf("caught sig: %+v", sig)- log.Info().Msg("starting to shutdown server")-- // Initialize the context with a timeout to ensure the app can make a graceful exit- // or abort if it takes too long- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)- defer cancel()-- if err := server.Shutdown(ctx); err != nil {- log.Error().Err(err).Msg("server shutdown failed")- } else {- log.Info().Msg("server gracefully shutdown")- }-}--// main is the entrypoint for the Doku Ingester service. It sets up logging,-// initializes the database and observability platforms, starts the HTTP server,-// and handles graceful shutdown.-func main() {- figure.NewColorFigure("DOKU Ingester", "", "yellow", true).Print()- // Configure global settings for the zerolog logger- zerolog.TimeFieldFormat = zerolog.TimeFormatUnix- log.Info().Msg("starting Doku Ingester")-- // Load the configuration from the environment variables- cfg, err := config.LoadConfigFromEnv()- if err != nil {- log.Fatal().Err(err).Msg("Failed to load configuration from environment")- }-- // Initialize the pricing information from the URL- log.Info().Msgf("initializing LLM Pricing Information from URL '%s'", cfg.Pricing.URL)- err = cost.LoadPricing("", cfg.Pricing.URL)- if err != nil {- log.Fatal().Err(err).Msg("failed to load LLM pricing information")- }-- // Initialize the http client for the observability platforms- connections.Init()-- log.Info().Msg("successfully initialized LLM pricing information")-- // Initialize the backend database connection with loaded configuration- log.Info().Msg("initializing connection to the backend database")- err = db.Init(*cfg)- if err != nil {- log.Fatal().Msgf("%v", err)- }- log.Info().Msg("successfully initialized connection to the backend database")-- // Cache eviction setup for the API Keys and Connections- auth.InitializeCacheEviction()- // Initialize the HTTP server routing- r := mux.NewRouter()- r.HandleFunc("/api/push", api.DataHandler).Methods("POST")- r.HandleFunc("/api/keys", api.APIKeyHandler).Methods("GET", "POST", "DELETE")- r.HandleFunc("/", api.BaseEndpoint).Methods("GET")- r.HandleFunc("/api/connections", api.ConnectionsHandler).Methods("POST", "DELETE", "GET")-- // Define and start the HTTP server- server := &http.Server{- Addr: ":9044",- Handler: r,- ReadTimeout: 10 * time.Second,- WriteTimeout: 10 * time.Second,- IdleTimeout: 30 * time.Second,- }-- // Starts the HTTP server in a goroutine and logs any error upon starting.- go func() {- log.Info().Msg("server listening on port :9044")- if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {- log.Fatal().Err(err).Msg("could not listen on port :9044")- }- }()-- waitForShutdown(server)-}