docs: add Kubernetes Arize AX tracing guide - #988
Conversation
Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
Deploying agentproxy with
|
| Latest commit: |
ac75720
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://354cf635.agentproxy.pages.dev |
| Branch Preview URL: | https://arize-ax-kubernetes-tracing.agentproxy.pages.dev |
Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
| - name: span.name | ||
| expression: '"openai.chat"' |
There was a problem hiding this comment.
OTel semconv recommends our default format, which is {method} {path_match}. This would also overwrite other providers, so I'd remove it.
There was a problem hiding this comment.
Removed the hardcoded span name from both examples so the semantic convention default is kept across providers.
| - name: openinference.span.kind | ||
| expression: '"LLM"' |
There was a problem hiding this comment.
There can be other kinds as well.
There was a problem hiding this comment.
Removed the hardcoded OpenInference span kind. Arize AX now maps the operation emitted in the native gen_ai attributes.
| - name: llm.system | ||
| expression: llm.provider | ||
| - name: llm.model_name | ||
| expression: coalesce(llm.responseModel, llm.requestModel) | ||
| - name: llm.input_messages | ||
| expression: 'flattenRecursive(llm.prompt.map(c, {"message": c}))' | ||
| - name: llm.output_messages | ||
| expression: 'flattenRecursive(llm.completion.map(c, {"role": "assistant", "content": c}))' | ||
| - name: llm.token_count.prompt | ||
| expression: llm.inputTokens | ||
| - name: llm.token_count.completion | ||
| expression: llm.outputTokens | ||
| - name: llm.token_count.total | ||
| expression: llm.totalTokens |
There was a problem hiding this comment.
IIRC we already emit these by default.
There was a problem hiding this comment.
Confirmed. Removed the duplicate provider, model, and token aliases and documented that Arize AX natively maps the gen_ai attributes emitted by agentgateway.
| - name: llm.input_messages | ||
| expression: 'flattenRecursive(llm.prompt.map(c, {"message": c}))' | ||
| - name: llm.output_messages | ||
| expression: 'flattenRecursive(llm.completion.map(c, {"role": "assistant", "content": c}))' |
There was a problem hiding this comment.
Can we call it out that this will ship PII into a vendor SaaS? I'd remove them from the default example and just document how to set it to avoid accidents.
There was a problem hiding this comment.
Removed prompt and response content from the default examples. Added an explicit opt-in section with a warning about PII, credentials, and other sensitive data being sent to a third-party SaaS platform.
Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
…racing Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
| kind: Secret | ||
| metadata: | ||
| name: arize-credentials | ||
| namespace: agentgateway-system |
There was a problem hiding this comment.
| namespace: agentgateway-system | |
| namespace: {{< reuse "agw-docs/snippets/namespace.md" >}} |
| Choose either OTLP/HTTP or OTLP/gRPC. Each option creates the following resources. | ||
|
|
||
| - An `AgentgatewayBackend` that connects to Arize AX over TLS and reads the authentication headers from the `arize-credentials` Secret. | ||
| - An `AgentgatewayPolicy` that exports sampled LLM traces from the `agentgateway-proxy` Gateway. |
There was a problem hiding this comment.
| - An `AgentgatewayPolicy` that exports sampled LLM traces from the `agentgateway-proxy` Gateway. | |
| - An `{{< reuse "agw-docs/snippets/policy.md" >}}` that exports sampled LLM traces from the `agentgateway-proxy` Gateway. |
| key: space-id | ||
| --- | ||
| apiVersion: agentgateway.dev/v1alpha1 | ||
| kind: AgentgatewayPolicy |
There was a problem hiding this comment.
| kind: AgentgatewayPolicy | |
| kind: {{< reuse "agw-docs/snippets/policy.md" >}} |
| name: arize-credentials | ||
| key: space-id | ||
| --- | ||
| apiVersion: agentgateway.dev/v1alpha1 |
There was a problem hiding this comment.
| apiVersion: agentgateway.dev/v1alpha1 | |
| apiVersion: {{< reuse "agw-docs/snippets/api-version.md" >}} |
| kind: AgentgatewayBackend | ||
| metadata: | ||
| name: arize-otlp | ||
| namespace: agentgateway-system |
There was a problem hiding this comment.
| namespace: agentgateway-system | |
| namespace: {{< reuse "agw-docs/snippets/namespace.md" >}} |
| | EU | `otlp.eu-west-1a.arize.com` | | ||
| | Canada | `otlp.ca-central-1a.arize.com` | | ||
|
|
||
| The following examples use the US collector. Replace `spec.static.host` with the collector host for your region. |
There was a problem hiding this comment.
save this in an env also
| namespace: agentgateway-system | ||
| spec: | ||
| static: | ||
| host: otlp.arize.com |
There was a problem hiding this comment.
| host: otlp.arize.com | |
| host: ${ARIZE_HOST} |
| kind: AgentgatewayPolicy | ||
| metadata: | ||
| name: arize-tracing | ||
| namespace: agentgateway-system |
There was a problem hiding this comment.
| namespace: agentgateway-system | |
| namespace: {{< reuse "agw-docs/snippets/namespace.md" >}} |
| kind: AgentgatewayBackend | ||
| metadata: | ||
| name: arize-otlp | ||
| namespace: agentgateway-system |
There was a problem hiding this comment.
| namespace: agentgateway-system | |
| namespace: {{< reuse "agw-docs/snippets/namespace.md" >}} |
| kind: AgentgatewayPolicy | ||
| metadata: | ||
| name: arize-tracing | ||
| namespace: agentgateway-system |
There was a problem hiding this comment.
| namespace: agentgateway-system | |
| namespace: {{< reuse "agw-docs/snippets/namespace.md" >}} |
| key: space-id | ||
| --- | ||
| apiVersion: agentgateway.dev/v1alpha1 | ||
| kind: AgentgatewayPolicy |
There was a problem hiding this comment.
| kind: AgentgatewayPolicy | |
| kind: {{< reuse "agw-docs/snippets/policy.md" >}} |
| name: arize-credentials | ||
| key: space-id | ||
| --- | ||
| apiVersion: agentgateway.dev/v1alpha1 |
There was a problem hiding this comment.
| apiVersion: agentgateway.dev/v1alpha1 | |
| apiVersion: {{< reuse "agw-docs/snippets/api-version.md" >}} |
|
|
||
| ## Optional: Export LLM inputs and outputs | ||
|
|
||
| The default configuration does not export prompt or response content. To display structured input and output messages in Arize AX, add the following attributes to the `AgentgatewayPolicy` for your selected transport. |
There was a problem hiding this comment.
| The default configuration does not export prompt or response content. To display structured input and output messages in Arize AX, add the following attributes to the `AgentgatewayPolicy` for your selected transport. | |
| The default configuration does not export prompt or response content. To display structured input and output messages in Arize AX, add the following attributes to the `{{< reuse "agw-docs/snippets/policy.md" >}}` for your selected transport. |
|
|
||
| The default configuration does not export prompt or response content. To display structured input and output messages in Arize AX, add the following attributes to the `AgentgatewayPolicy` for your selected transport. | ||
|
|
||
| {{< callout type="warning" >}} |
There was a problem hiding this comment.
| {{< callout type="warning" >}} |
| The default configuration does not export prompt or response content. To display structured input and output messages in Arize AX, add the following attributes to the `AgentgatewayPolicy` for your selected transport. | ||
|
|
||
| {{< callout type="warning" >}} | ||
| LLM prompts and responses can contain personally identifiable information (PII), credentials, or other sensitive data. Enabling these attributes sends that content to a third-party SaaS platform. Review your organization's data-handling requirements and configure appropriate guardrails or redaction before enabling them. |
There was a problem hiding this comment.
| LLM prompts and responses can contain personally identifiable information (PII), credentials, or other sensitive data. Enabling these attributes sends that content to a third-party SaaS platform. Review your organization's data-handling requirements and configure appropriate guardrails or redaction before enabling them. | |
| > [!IMPORTANT] | |
| > LLM prompts and responses can contain personally identifiable information (PII), credentials, or other sensitive data. Enabling these attributes sends that content to a third-party SaaS platform. Review your organization's data-handling requirements and configure appropriate guardrails or redaction before enabling them. |
|
|
||
| {{< callout type="warning" >}} | ||
| LLM prompts and responses can contain personally identifiable information (PII), credentials, or other sensitive data. Enabling these attributes sends that content to a third-party SaaS platform. Review your organization's data-handling requirements and configure appropriate guardrails or redaction before enabling them. | ||
| {{< /callout >}} |
There was a problem hiding this comment.
| {{< /callout >}} |
|
|
||
| Agentgateway supports custom OpenTelemetry resource attributes through `spec.frontend.tracing.resources`. Resource attributes are added to every exported span and can help you filter and group traces in Arize AX. | ||
|
|
||
| In Kubernetes mode, agentgateway automatically sets `service.name`, `service.version`, `service.instance.id`, and `service.namespace`. The main configuration explicitly sets `deployment.environment.name`. You can add application-specific attributes such as `model_id` or `model_version` to the `resources` list in the `AgentgatewayPolicy` for your selected transport. |
There was a problem hiding this comment.
what is the main configuration?
|
|
||
| Agentgateway supports custom OpenTelemetry resource attributes through `spec.frontend.tracing.resources`. Resource attributes are added to every exported span and can help you filter and group traces in Arize AX. | ||
|
|
||
| In Kubernetes mode, agentgateway automatically sets `service.name`, `service.version`, `service.instance.id`, and `service.namespace`. The main configuration explicitly sets `deployment.environment.name`. You can add application-specific attributes such as `model_id` or `model_version` to the `resources` list in the `AgentgatewayPolicy` for your selected transport. |
There was a problem hiding this comment.
| In Kubernetes mode, agentgateway automatically sets `service.name`, `service.version`, `service.instance.id`, and `service.namespace`. The main configuration explicitly sets `deployment.environment.name`. You can add application-specific attributes such as `model_id` or `model_version` to the `resources` list in the `AgentgatewayPolicy` for your selected transport. | |
| In Kubernetes mode, agentgateway automatically sets `service.name`, `service.version`, `service.instance.id`, and `service.namespace`. The main configuration explicitly sets `deployment.environment.name`. You can add application-specific attributes such as `model_id` or `model_version` to the `resources` list in the `{{< reuse "agw-docs/snippets/policy.md" >}}` for your selected transport. |
| 1. Verify that Kubernetes accepted the backend and attached the policy to the Gateway. | ||
| ```sh | ||
| kubectl get agentgatewaybackend arize-otlp -n agentgateway-system | ||
| kubectl get agentgatewaypolicy arize-tracing -n agentgateway-system |
There was a problem hiding this comment.
| kubectl get agentgatewaypolicy arize-tracing -n agentgateway-system | |
| kubectl get {{< reuse "agw-docs/snippets/policy.md" >}} arize-tracing -n {{< reuse "agw-docs/snippets/namespace.md" >}} |
|
|
||
| 1. Verify that Kubernetes accepted the backend and attached the policy to the Gateway. | ||
| ```sh | ||
| kubectl get agentgatewaybackend arize-otlp -n agentgateway-system |
There was a problem hiding this comment.
| kubectl get agentgatewaybackend arize-otlp -n agentgateway-system | |
| kubectl get agentgatewaybackend arize-otlp -n {{< reuse "agw-docs/snippets/namespace.md" >}} |
|
|
||
| 2. If you run a local cluster such as Kind, port-forward the agentgateway proxy. | ||
| ```sh | ||
| kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80 |
There was a problem hiding this comment.
| kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80 | |
| kubectl port-forward deployment/agentgateway-proxy -n {{< reuse "agw-docs/snippets/policy.md" >}} 8080:80 |
| ``` | ||
| 4. Find the request in the agentgateway proxy logs and copy its `trace.id` value. | ||
| ```sh | ||
| kubectl logs deployment/agentgateway-proxy -n agentgateway-system \ |
There was a problem hiding this comment.
| kubectl logs deployment/agentgateway-proxy -n agentgateway-system \ | |
| kubectl logs deployment/agentgateway-proxy -n {{< reuse "agw-docs/snippets/policy.md" >}} \ |
| kubectl logs deployment/agentgateway-proxy -n agentgateway-system \ | ||
| | grep 'protocol=llm' \ | ||
| | tail -1 | ||
| ``` |
There was a problem hiding this comment.
can we provide a sample log entry?
| ```sh | ||
| kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80 | ||
| ``` | ||
| 3. In a separate terminal, send an LLM request through agentgateway. The following example assumes that the proxy is available on local port `8080` and has an OpenAI-compatible provider and the `gpt-3.5-turbo` model configured. |
There was a problem hiding this comment.
we typically have Cloud Provider examples and local test examples in verification steps. https://docs.solo.io/agentgateway/kubernetes/latest/quickstart/non-agentic-http/#step-3-send-a-request-to-the-httpbin-app. I think just the curl command is enough as the before you begin section assumes you have the gateway up and running
| ## Before you begin | ||
|
|
||
| 1. [Install agentgateway]({{< link-hextra path="/quickstart/install/" >}}) in your Kubernetes cluster. | ||
| 2. [Set up an agentgateway proxy]({{< link-hextra path="/setup/gateway/" >}}). |
There was a problem hiding this comment.
-
Get the external address of the gateway and save it in an environment variable.
{{< tabs >}}
{{% tab name="Cloud Provider LoadBalancer" %}}
{{< reuse "agw-docs/snippets/kind-loadbalancer-tip.md" >}}export INGRESS_GW_ADDRESS=$(kubectl get svc -n {{< reuse "agw-docs/snippets/namespace.md" >}} agentgateway-proxy -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}") echo $INGRESS_GW_ADDRESS
{{% /tab %}}
{{% tab name="Port-forward for local testing" %}}kubectl port-forward deployment/agentgateway-proxy -n {{< reuse "agw-docs/snippets/namespace.md" >}} 8080:80{{% /tab %}}
{{< /tabs >}}
| | grep 'protocol=llm' \ | ||
| | tail -1 | ||
| ``` | ||
| 5. In Arize AX, open **Tracing Projects**, select the project from `openinference.project.name`, and search for the trace ID. Trace export is batched, so allow several seconds for the trace to appear. |
There was a problem hiding this comment.
| 5. In Arize AX, open **Tracing Projects**, select the project from `openinference.project.name`, and search for the trace ID. Trace export is batched, so allow several seconds for the trace to appear. | |
| 5. In Arize AX, open **Tracing Projects**, select the project that you defined in the `openinference.project.name` field, and search for the trace ID. Trace export is batched, so allow several seconds for the trace to appear. |
| - Set `randomSampling: "true"` while testing so that agentgateway starts a trace for every request. | ||
| - Check the proxy logs for OpenTelemetry exporter errors. | ||
| ```sh | ||
| kubectl logs deployment/agentgateway-proxy -n agentgateway-system \ |
There was a problem hiding this comment.
| kubectl logs deployment/agentgateway-proxy -n agentgateway-system \ | |
| kubectl logs deployment/agentgateway-proxy -n {{< reuse "agw-docs/snippets/namespace.md" >}} \ |
| @@ -0,0 +1,298 @@ | |||
| --- | |||
| title: Arize AX | |||
There was a problem hiding this comment.
can you move the content under assets/agw-docs/pages and then reference it from here and the page in main with a reuse shortcode?
Company
Not applicable; this pull request updates documentation.
Contribution summary
Checklist
Logo file
Listing
Preview
Both transport configurations were verified end to end on Kind with
agentgateway 1.5.0, and the full Hugo build completed successfully.