Skip to content

Metrics

Shield360 offers automatic instrumentation with OpenTelemetry for various LLM providers, frameworks, and VectorDBs, enabling you to gain valuable insights into the behavior and performance of your AI applications through metrics.

You have the option to disable the collection of metrics if needed. By default, metrics collection is enabled.

Example:

# Disable metrics collection
shield360.init(disable_metrics=True)

You have the flexibility to integrate your existing OpenTelemetry (OTel) Metrics instance configuration with Shield360. If you already have an OTel Metrics instance instantiated in your application, you can pass it directly to shield360.init(meter=meter). This integration ensures that Shield360 utilizes your custom OTel metrics instance settings, allowing for a unified metrics setup across your application.

Example:

# Instantiate an OpenTelemetry Metrics meter
meter = ...
# Pass the meter to Shield360
shield360.init(meter=meter)

The OTEL_RESOURCE_ATTRIBUTES environment variable allows you to provide additional OpenTelemetry resource attributes when starting your application with Shield360. Shield360 already includes some default resource attributes:

  • telemetry.sdk.name: shield360
  • 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 Shield360 attributes, providing additional context to your telemetry data. Simply format your attributes as key1=value1,key2=value2.

For example:

Terminal window
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"