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.mdSetup
Install packages
pip install respan-ai opentelemetry-instrumentation-marqo marqoSet environment variables
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"RESPAN_API_KEY is used to export traces to Respan.
Initialize and run
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
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | None | Falls back to RESPAN_API_KEY env var. |
base_url | str | None | None | Falls back to RESPAN_BASE_URL env var. |
instrumentations | list | [] | Plugin instrumentations to activate (e.g. MarqoInstrumentor()). |
customer_identifier | str | None | None | Default customer identifier for all spans. |
metadata | dict | None | None | Default metadata attached to all spans. |
environment | str | None | None | Environment tag (e.g. "production"). |
Attributes
In Respan()
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
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)| Attribute | Type | Description |
|---|---|---|
customer_identifier | str | Identifies the end user in Respan analytics. |
thread_identifier | str | Groups related messages into a conversation. |
metadata | dict | Custom key-value pairs. Merged with default metadata. |