Attach string labels to traces for categorization and filtering via the AgentMark SDK
Tags let you attach string labels to your AgentMark traces via the SDK. Use tags to categorize traces by environment, team, feature, experiment, or any other dimension, then filter by those tags in the AgentMark dashboard.
You can combine tags with metadata on the same trace. Tags are for categorical labels (environment, team), while metadata is for unique identifiers and configuration values (user IDs, request IDs).
If you are building a custom integration or using OpenTelemetry directly, you can set tags via the agentmark.tags span attribute. The AgentMark gateway accepts tags as a JSON array string or a comma-separated string:
import api from "@opentelemetry/api";const tracer = api.trace.getTracer("agentmark");tracer.startActiveSpan("my-operation", (span) => { // JSON array string span.setAttribute("agentmark.tags", JSON.stringify(["production", "v2"])); // Or comma-separated string span.setAttribute("agentmark.tags", "production,v2"); // Your logic here span.end();});
The trace() function’s tags option is the recommended approach for most applications. Use the OpenTelemetry attribute approach only when you need direct control over span attributes, such as in custom instrumentation or non-SDK integrations.
Tags appear as a column in the trace list and as chips in the trace detail view. You can filter traces by tag to quickly find traces in a specific environment, from a specific team, or part of a specific experiment.For details on filtering and the available operators, see the Tags platform documentation.
Tags work best with a bounded set of known values. If a dimension has hundreds or thousands of unique values (like user IDs or request IDs), use metadata instead.