Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Feat]: Update Documentation for custom resource attributes (#446)

Patcheree36eaca0055
diff --git a/docs/latest/features/metrics.mdx b/docs/latest/features/metrics.mdx
index d881cedd..34760022 100644
--- a/docs/latest/features/metrics.mdx
+++ b/docs/latest/features/metrics.mdx
@@ -42,6 +42,22 @@ meter = ...
openlit.init(meter=meter)
```
+## Add custom resource attributes
+
+The [`OTEL_RESOURCE_ATTRIBUTES`](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_resource_attributes) environment variable allows you to provide additional OpenTelemetry resource attributes when starting your application with OpenLIT. OpenLIT already includes some default resource attributes:
+
+- `telemetry.sdk.name: openlit`
+- `service.name: YOUR_SERVICE_NAME`
+- `deployment.environment: YOUR_ENVIRONMENT_NAME`
+
+You can enhance these default resource attributes by adding your own using the `OTEL_RESOURCE_ATTRIBUTES` variable. Your custom attributes will be added on top of the existing OpenLIT attributes, providing additional context to your telemetry data. Simply format your attributes as `key1=value1,key2=value2`.
+
+For example:
+
+```shell
+export OTEL_RESOURCE_ATTRIBUTES="service.instance.id=YOUR_SERVICE_ID,k8s.pod.name=K8S_POD_NAME,k8s.namespace.name=K8S_NAMESPACE,k8s.node.name=K8S_NODE_NAME"
+```
+
## Semantic Convention
This section outlines the OpenTelemetry metrics collected by **OpenLIT** from applications using LLMs and Vector Databases. These metrics offer a straightforward overview of application performance and resource usage. They serve as a supplement to the detailed data captured through [tracing](./tracing), aiding in the easy creation of dashboards for quick monitoring of system usage and performance.
diff --git a/docs/latest/features/tracing.mdx b/docs/latest/features/tracing.mdx
index 33611e2a..25f0046d 100644
--- a/docs/latest/features/tracing.mdx
+++ b/docs/latest/features/tracing.mdx
@@ -32,6 +32,22 @@ tracer = ...
openlit.init(tracer=tracer)
```
+## Add custom resource attributes
+
+The [`OTEL_RESOURCE_ATTRIBUTES`](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_resource_attributes) environment variable allows you to provide additional OpenTelemetry resource attributes when starting your application with OpenLIT. OpenLIT already includes some default resource attributes:
+
+- `telemetry.sdk.name: openlit`
+- `service.name: YOUR_SERVICE_NAME`
+- `deployment.environment: YOUR_ENVIRONMENT_NAME`
+
+You can enhance these default resource attributes by adding your own using the `OTEL_RESOURCE_ATTRIBUTES` variable. Your custom attributes will be added on top of the existing OpenLIT attributes, providing additional context to your telemetry data. Simply format your attributes as `key1=value1,key2=value2`.
+
+For example:
+
+```shell
+export OTEL_RESOURCE_ATTRIBUTES="service.instance.id=YOUR_SERVICE_ID,k8s.pod.name=K8S_POD_NAME,k8s.namespace.name=K8S_NAMESPACE,k8s.node.name=K8S_NODE_NAME"
+```
+
## Disable Tracing of Content
By default, OpenLIT adds the prompts and completions to Trace span attributes.
@@ -69,7 +85,6 @@ openlit.init(disabled_instrumentors=["anthropic", "langchain"])
Using `openlit.trace`, you get access to manually create traces, allowing you to record every process within a single function.
```python python
-
@openlit.trace
def generate_one_liner():
completion = client.chat.completions.create(
diff --git a/docs/latest/integrations/anthropic.mdx b/docs/latest/integrations/anthropic.mdx
index 37dea683..a0f8ebe4 100644
--- a/docs/latest/integrations/anthropic.mdx
+++ b/docs/latest/integrations/anthropic.mdx
@@ -23,12 +23,12 @@ The integration is compatible with
<Tabs>
<Tab title="Python">
```shell
- pip install openlit
+ pip install openlit
```
</Tab>
<Tab title="Typescript">
```shell
- npm install openlit
+ npm install openlit
```
</Tab>
</Tabs>
@@ -42,23 +42,21 @@ The integration is compatible with
<Tabs>
<Tab title="Python">
- ```python
- import openlit
+ ```python
+ import openlit
- openlit.init(
- otlp_endpoint="YOUR_OTEL_ENDPOINT",
- )
- ```
+ openlit.init(otlp_endpoint="YOUR_OTEL_ENDPOINT")
+ ```
</Tab>
<Tab title="Typescript">
<Warning>Typescript sdk for anthropic doesn't support metrics tracking for now!</Warning>
- ```typescript
- import openlit from "openlit"
+ ```typescript
+ import openlit from "openlit"
- openlit.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })
- ```
+ openlit.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })
+ ```
</Tab>
</Tabs>
@@ -71,19 +69,19 @@ The integration is compatible with
<Tabs>
<Tab title="Python">
- ```python
- import openlit
+ ```python
+ import openlit
- openlit.init()
- ```
+ openlit.init()
+ ```
</Tab>
<Tab title="Typescript">
- ```typescript
- import openlit from "openlit"
+ ```typescript
+ import openlit from "openlit"
- openlit.init()
- ```
+ openlit.init()
+ ```
</Tab>
</Tabs>
diff --git a/docs/latest/integrations/openai.mdx b/docs/latest/integrations/openai.mdx
index cfd14f94..0d4282a7 100644
--- a/docs/latest/integrations/openai.mdx
+++ b/docs/latest/integrations/openai.mdx
@@ -23,12 +23,12 @@ The integration is compatible with
<Tabs>
<Tab title="Python">
```shell
- pip install openlit
+ pip install openlit
```
</Tab>
<Tab title="Typescript">
```shell
- npm install openlit
+ npm install openlit
```
</Tab>
</Tabs>
@@ -41,23 +41,21 @@ The integration is compatible with
Add the following two lines to your application code:
<Tabs>
<Tab title="Python">
- ```python
- import openlit
+ ```python
+ import openlit
- openlit.init(
- otlp_endpoint="YOUR_OTEL_ENDPOINT",
- )
- ```
+ openlit.init(otlp_endpoint="YOUR_OTEL_ENDPOINT")
+ ```
</Tab>
<Tab title="Typescript">
<Warning>Typescript sdk for openai doesn't support metrics tracking for now!</Warning>
- ```typescript
- import openlit from "openlit"
+ ```typescript
+ import openlit from "openlit"
- openlit.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })
- ```
+ openlit.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })
+ ```
</Tab>
</Tabs>
@@ -72,19 +70,19 @@ The integration is compatible with
<Tabs>
<Tab title="Python">
- ```python
- import openlit
+ ```python
+ import openlit
- openlit.init()
- ```
+ openlit.init()
+ ```
</Tab>
<Tab title="Typescript">
- ```typescript
- import openlit from "openlit"
+ ```typescript
+ import openlit from "openlit"
- openlit.init()
- ```
+ openlit.init()
+ ```
</Tab>
</Tabs>
diff --git a/docs/latest/quickstart.mdx b/docs/latest/quickstart.mdx
index a161fda3..65c835db 100644
--- a/docs/latest/quickstart.mdx
+++ b/docs/latest/quickstart.mdx
@@ -43,12 +43,12 @@ flowchart TB;
<Tabs>
<Tab title="Python">
```shell
- pip install openlit
+ pip install openlit
```
</Tab>
<Tab title="Typescript">
```shell
- npm install openlit
+ npm install openlit
```
</Tab>
</Tabs>