Skip to Content
Launching the open-source gateway

Marqo (tracing)

Marqo  is an end-to-end tensor search engine that combines vector search with traditional keyword search. It handles embedding generation, storage, and retrieval in a single platform, supporting text, images, and multimodal search. Respan gives you full observability over every index operation, search query, and embedding step.

Set up Respan

Create an account at platform.respan.ai  and grab an API key .

Paste this into your coding agent:

Help me set up Respan tracing with the Marqo integration. Follow https://www.respan.ai/docs/integrations/marqo.md

Setup

Install packages

Terminal
pip install respan-ai opentelemetry-instrumentation-marqo marqo

Set environment variables

Terminal
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

RESPAN_API_KEY is used to export traces to Respan.

Initialize and run

Python
import marqo from respan import Respan from opentelemetry.instrumentation.marqo import MarqoInstrumentor respan = Respan(instrumentations=[MarqoInstrumentor()]) client = marqo.Client(url="http://localhost:8882") client.create_index("documents", model="hf/e5-base-v2") client.index("documents").add_documents( [ {"title": "AI Observability", "description": "Respan provides tracing for AI applications."}, {"title": "Tensor Search", "description": "Marqo combines vector and keyword search."}, {"title": "Embeddings", "description": "Embeddings capture semantic meaning as vectors."}, ], tensor_fields=["title", "description"], ) results = client.index("documents").search("How does AI tracing work?") for hit in results["hits"]: print(f"{hit['title']} (score: {hit['_score']:.4f})")

View your trace

Open the Traces page  to see your Marqo operation spans with index operations, queries, and embeddings.

Configuration

ParameterTypeDefaultDescription
api_keystr | NoneNoneFalls back to RESPAN_API_KEY env var.
base_urlstr | NoneNoneFalls back to RESPAN_BASE_URL env var.
instrumentationslist[]Plugin instrumentations to activate (e.g. MarqoInstrumentor()).
customer_identifierstr | NoneNoneDefault customer identifier for all spans.
metadatadict | NoneNoneDefault metadata attached to all spans.
environmentstr | NoneNoneEnvironment tag (e.g. "production").

Attributes

In Respan()

Python
from respan import Respan from opentelemetry.instrumentation.marqo import MarqoInstrumentor respan = Respan( instrumentations=[MarqoInstrumentor()], customer_identifier="user_123", metadata={"service": "search-api", "version": "1.0.0"}, )

With propagate_attributes

Python
from respan import Respan, propagate_attributes from opentelemetry.instrumentation.marqo import MarqoInstrumentor respan = Respan(instrumentations=[MarqoInstrumentor()]) def search(user_id: str, query: str): with propagate_attributes( customer_identifier=user_id, thread_identifier="conv_abc_123", metadata={"plan": "pro"}, ): return client.index("documents").search(query)
AttributeTypeDescription
customer_identifierstrIdentifies the end user in Respan analytics.
thread_identifierstrGroups related messages into a conversation.
metadatadictCustom key-value pairs. Merged with default metadata.