Sometimes, you may want to dynamically disable tracing for a particular span. For example, some of your customers need more privacy than others, and you only want to collect metadata for some of them.

To achieve this, we offer a wrapper that can set tracing to one of the following modes:

  • ALL – trace everything as normal
  • META_ONLY – do not trace inputs and outputs
  • OFF – do not trace anything within the wrapper
// only available since v0.4.25
import { withTracingLevel, TracingLevel } from "@lmnr-ai/lmnr";

withTracingLevel(TracingLevel.OFF, () => {
    // your code here
});

// code here is traced normally