LogoLogo
HomeBlogGitHub
latest
latest
  • New DOCS
  • What is Evidently?
  • Get Started
    • Evidently Cloud
      • Quickstart - LLM tracing
      • Quickstart - LLM evaluations
      • Quickstart - Data and ML checks
      • Quickstart - No-code evaluations
    • Evidently OSS
      • OSS Quickstart - LLM evals
      • OSS Quickstart - Data and ML monitoring
  • Presets
    • All Presets
    • Data Drift
    • Data Quality
    • Target Drift
    • Regression Performance
    • Classification Performance
    • NoTargetPerformance
    • Text Evals
    • Recommender System
  • Tutorials and Examples
    • All Tutorials
    • Tutorial - Tracing
    • Tutorial - Reports and Tests
    • Tutorial - Data & ML Monitoring
    • Tutorial - LLM Evaluation
    • Self-host ML Monitoring
    • LLM as a judge
    • LLM Regression Testing
  • Setup
    • Installation
    • Evidently Cloud
    • Self-hosting
  • User Guide
    • 📂Projects
      • Projects overview
      • Manage Projects
    • 📶Tracing
      • Tracing overview
      • Set up tracing
    • 🔢Input data
      • Input data overview
      • Column mapping
      • Data for Classification
      • Data for Recommendations
      • Load data to pandas
    • 🚦Tests and Reports
      • Reports and Tests Overview
      • Get a Report
      • Run a Test Suite
      • Evaluate Text Data
      • Output formats
      • Generate multiple Tests or Metrics
      • Run Evidently on Spark
    • 📊Evaluations
      • Evaluations overview
      • Generate snapshots
      • Run no code evals
    • 🔎Monitoring
      • Monitoring overview
      • Batch monitoring
      • Collector service
      • Scheduled evaluations
      • Send alerts
    • 📈Dashboard
      • Dashboard overview
      • Pre-built Tabs
      • Panel types
      • Adding Panels
    • 📚Datasets
      • Datasets overview
      • Work with Datasets
    • 🛠️Customization
      • Data drift parameters
      • Embeddings drift parameters
      • Feature importance in data drift
      • Text evals with LLM-as-judge
      • Text evals with HuggingFace
      • Add a custom text descriptor
      • Add a custom drift method
      • Add a custom Metric or Test
      • Customize JSON output
      • Show raw data in Reports
      • Add text comments to Reports
      • Change color schema
    • How-to guides
  • Reference
    • All tests
    • All metrics
      • Ranking metrics
    • Data drift algorithm
    • API Reference
      • evidently.calculations
        • evidently.calculations.stattests
      • evidently.metrics
        • evidently.metrics.classification_performance
        • evidently.metrics.data_drift
        • evidently.metrics.data_integrity
        • evidently.metrics.data_quality
        • evidently.metrics.regression_performance
      • evidently.metric_preset
      • evidently.options
      • evidently.pipeline
      • evidently.renderers
      • evidently.report
      • evidently.suite
      • evidently.test_preset
      • evidently.test_suite
      • evidently.tests
      • evidently.utils
  • Integrations
    • Integrations
      • Evidently integrations
      • Notebook environments
      • Evidently and Airflow
      • Evidently and MLflow
      • Evidently and DVCLive
      • Evidently and Metaflow
  • SUPPORT
    • Migration
    • Contact
    • F.A.Q.
    • Telemetry
    • Changelog
  • GitHub Page
  • Website
Powered by GitBook
On this page
  • Installation and Imports
  • Initialize tracing
  • Tracing parameters
  • Tracing a function
  1. User Guide
  2. Tracing

Set up tracing

Set up LLM tracing with tracely.

PreviousTracing overviewNextInput data

Last updated 2 months ago

You are looking at the old Evidently documentation: this API is available with versions 0.6.7 or lower. Check the newer version .

For an end-to-end example, check the .

Installation and Imports

Install the tracely package from PyPi.

!pip install tracely 

Imports:

from tracely import init_tracing
from tracely import trace_event

Initialize tracing

Use init_tracing to enable tracely tracing. Example:

init_tracing(
   address="https://app.evidently.cloud/",
   api_key=”YOUR_EVIDENTLY_TOKEN”,
   project_id="YOUR_PROJECT_ID",
   export_name="YOUR_TRACING_DATASET_NAME",
   )

Tracing parameters

Parameter

Description

address: Optional[str]

The URL of the collector service where tracing data will be sent. For Evidently Cloud, set https://app.evidently.cloud/. Required: No, Default: None

exporter_type: Optional[str]

Specifies the type of exporter to use for tracing. Options are grpc for gRPC protocol or http for HTTP protocol. Required: No, Default: None

api_key: Optional[str]

The authorization API key for Evidently Cloud tracing. This key authenticates your requests and is necessary for sending data to Evidently Cloud. Required: No, Default: None

project_id: str

The ID of your Project in Evidently Cloud. Required: Yes, Default: None

export_name: Optional[str]

A string name assigned to the exported tracing data. All data with the same export_name will be grouped into a single dataset. Required: No, Default: None

as_global: bool = True

Indicates whether to register the tracing provider globally for OpenTelemetry (opentelemetry.trace.TracerProvider) or use it locally within a scope. Default: True

Tracing a function

To trace a function call use trace_event() decorator.

Example 1. To log all arguments of the function:

@trace_event()

Example 2. To log only input arguments of the function:

@trace_event(track_args=[])

Example 3. To log only "arg1" and "arg2":

@trace_event(track_args=["arg1", "arg2"])

Parameter

Description

span_name: Optional[str]

The name of the span to track. This is how the event will be labeled in the trace. By giving it a name, you can identify and analyze this particular step within your tracing data. Required: No, Default: None

track_args: Optional[List[str]]

A list of arguments to capture during tracing. If set to None, it captures all arguments by default. If set to [], it captures no arguments. Required: No, Default: None

ignore_args: Optional[List[str]]

A list of arguments to ignore from tracking. For instance, if a function has sensitive information that you don’t want to log, you can list those arguments here. If set to None, no arguments are ignored. Required: No, Default: None

track_output: Optional[bool]

Indicates whether to track the output of the function call. If set to True, the trace will include the function’s output, allowing you to see not just what was passed in but also what was returned. Required: No, Default: True

See the for an end-to-end example.

📶
here
Tracing Quickstart
Tracing Quickstart