# Configuration
[EN] Source: https://mastra.ai/reference/observability/ai-tracing/configuration

## ObservabilityRegistryConfig

```typescript
interface ObservabilityRegistryConfig {
  default?: { enabled?: boolean };
  configs?: Record<string, TracingConfig | AITracing>;
  configSelector?: ConfigSelector;
}
```

<PropertiesTable
  props={[
    {
      name: "default",
      type: "{ enabled?: boolean }",
      description: "Enable default configuration",
      required: false,
    },
    {
      name: "configs",
      type: "Record<string, TracingConfig | AITracing>",
      description: "Named tracing configurations",
      required: false,
    },
    {
      name: "configSelector",
      type: "ConfigSelector",
      description: "Runtime configuration selector",
      required: false,
    },
  ]}
/>

## TracingConfig

```typescript
interface TracingConfig {
  name: string;
  serviceName: string;
  sampling?: SamplingStrategy;
  exporters?: AITracingExporter[];
  processors?: AISpanProcessor[];
}
```

<PropertiesTable
  props={[
    {
      name: "name",
      type: "string",
      description: "Configuration identifier",
      required: true,
    },
    {
      name: "serviceName",
      type: "string",
      description: "Service name in traces",
      required: true,
    },
    {
      name: "sampling",
      type: "SamplingStrategy",
      description: "Sampling configuration",
      required: false,
    },
    {
      name: "exporters",
      type: "AITracingExporter[]",
      description: "Trace data exporters",
      required: false,
    },
    {
      name: "processors",
      type: "AISpanProcessor[]",
      description: "Span processors",
      required: false,
    },
  ]}
/>

## SamplingStrategy

```typescript
type SamplingStrategy =
  | { type: "always" }
  | { type: "never" }
  | { type: "ratio"; probability: number }
  | { type: "custom"; sampler: (options?: TracingOptions) => boolean };
```

## ConfigSelector

```typescript
type ConfigSelector = (
  options: ConfigSelectorOptions,
  availableConfigs: Map<string, AITracing>,
) => string | undefined;
```

## ConfigSelectorOptions

```typescript
interface ConfigSelectorOptions {
  metadata?: Record<string, any>;
  runtimeContext?: Map<string, any>;
}
```