<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error from mlflow traces in Databricks notebook in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140543#M1459</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/199165"&gt;@rafaelgildin&lt;/a&gt;&amp;nbsp;, I see that you have raised an Issue in the OSS mlflow repo, while the issue that you are encountering is on Databricks. The issue here is that you are explicitly adding trace.set_tracer_provider(tracer_provider). Databricks installs its own OpenTelemetry TracerProvider by default.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can remove the part and let autolog() generate the spans naturally.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Nov 2025 18:41:16 GMT</pubDate>
    <dc:creator>iyashk-DB</dc:creator>
    <dc:date>2025-11-27T18:41:16Z</dc:date>
    <item>
      <title>Error from mlflow traces in Databricks notebook</title>
      <link>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140533#M1456</link>
      <description>&lt;P&gt;I'm unable to log my traces in my mlflow experiments.&lt;BR /&gt;&lt;BR /&gt;The goal is to have the tracing from my genAI calls like described in&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/mlflow3/genai/getting-started/connect-environment?language=.env+File" target="_self"&gt;Tutorial: Connect your development environment to MLflow&lt;/A&gt;&amp;nbsp;.&lt;BR /&gt;&lt;BR /&gt;So I'm able to create my experiment run, but they are every time empty, as shown below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rafaelgildin_0-1764261207256.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/21985i58EBAB213E5D5EFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rafaelgildin_0-1764261207256.png" alt="rafaelgildin_0-1764261207256.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By adding the logging for showing debugging infos I was able to get the following error.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Overriding of current TracerProvider is not allowed 2025/11/27 16:16:35 DEBUG mlflow.tracing.utils: Failed to get attribute mlflow.traceRequestId with from span NonRecordingSpan(SpanContext(trace_id=0x00000000000000000000000000000000, span_id=0x0000000000000000, trace_flags=0x00, trace_state=[], is_remote=False)). Traceback (most recent call last): File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-7eff4f88-fa35-45e5-8cad-fdcd71df8df3/lib/python3.12/site-packages/mlflow/tracing/utils/__init__.py", line 240, in get_otel_attribute attribute_value = span.attributes.get(key) ^^^^^^^^^^^^^^^&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;What I've tried to do for solving it.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Recreating my compute resource to check if the error persist. And it does.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Adding multiple layers for open telemetry and trying to change the packages versions.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Which none worked out. Also this is very strange, since I've people from my team that's able to run it with ease.&lt;BR /&gt;&lt;BR /&gt;Current code I'm using with my notebook in databricks.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# -------------------------------- cell 1
%pip install uv
%uv pip install -U 'mlflow[databricks]&amp;gt;=3.1' openai "flask&amp;lt;3.0.0" "opentelemetry-exporter-otlp-proto-grpc"
dbutils.library.restartPython()

# -------------------------------- cell 2
import os, logging, mlflow
from dotenv import load_dotenv
from databricks.sdk.runtime import dbutils

# Initialize OpenTelemetry
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace.export import BatchSpanProcessor

os.environ["MLFLOW_ENABLE_TRACES"] = "true"
os.environ["MLFLOW_TRACKING_URI"] = "databricks"

# Set up the tracer provider
resource = Resource.create({"service.name": "mlflow-tracing"})
tracer_provider = TracerProvider(resource=resource)
trace._TRACER_PROVIDER = None 
trace.set_tracer_provider(tracer_provider)

logging.getLogger().setLevel(logging.DEBUG)
mlflow.openai.autolog()
mlflow.set_experiment(experiment_id=EXPERIMENT_ID)

os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY

from openai import OpenAI
client = OpenAI()

messages = [
  {
    "role": "system", 
    "content": "You are a helpful assistant."
  },
  {
    "role": "user",
    "content": "Hello!"
  }
]

client.chat.completions.create(model="gpt-4o-mini-2024-07-18", messages=messages)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 16:40:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140533#M1456</guid>
      <dc:creator>rafaelgildin</dc:creator>
      <dc:date>2025-11-27T16:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error from mlflow traces in Databricks notebook</title>
      <link>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140534#M1457</link>
      <description>&lt;P&gt;Also, I've created this issue on Mlflow Github:&amp;nbsp;&lt;A href="https://github.com/mlflow/mlflow/issues/19092" target="_blank"&gt;https://github.com/mlflow/mlflow/issues/19092&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 17:09:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140534#M1457</guid>
      <dc:creator>rafaelgildin</dc:creator>
      <dc:date>2025-11-27T17:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error from mlflow traces in Databricks notebook</title>
      <link>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140543#M1459</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/199165"&gt;@rafaelgildin&lt;/a&gt;&amp;nbsp;, I see that you have raised an Issue in the OSS mlflow repo, while the issue that you are encountering is on Databricks. The issue here is that you are explicitly adding trace.set_tracer_provider(tracer_provider). Databricks installs its own OpenTelemetry TracerProvider by default.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can remove the part and let autolog() generate the spans naturally.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 18:41:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140543#M1459</guid>
      <dc:creator>iyashk-DB</dc:creator>
      <dc:date>2025-11-27T18:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error from mlflow traces in Databricks notebook</title>
      <link>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140560#M1461</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/112558"&gt;@iyashk-DB&lt;/a&gt;&amp;nbsp;thanks for the response.&lt;BR /&gt;But I keep geeting the same error.&lt;BR /&gt;should I change something else pls?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2025/11/27 21:24:59 DEBUG mlflow.tracing.utils: Failed to get attribute mlflow.traceRequestId with from span NonRecordingSpan(SpanContext(trace_id=0x00000000000000000000000000000000, span_id=0x0000000000000000, trace_flags=0x00, trace_state=[], is_remote=False)). Traceback (most recent call last): File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c56af6ef-cbd4-4a46-8da6-ba9e8059213d/lib/python3.12/site-packages/mlflow/tracing/utils/__init__.py", line 240, in get_otel_attribute attribute_value = span.attributes.get(key) ^^^^^^^^^^^^^^^ AttributeError: 'NonRecordingSpan' object has no attribute 'attributes'. Did you mean: 'set_attributes'? 2025/11/27 21:24:59 WARNING mlflow.tracing.fluent: Failed to start span Completions: 'NonRecordingSpan' object has no attribute 'context'. For full traceback, set logging level to debug. Traceback (most recent call last): File "/local_disk0/.ephemeral_nfs/envs/pythonEnv-c56af6ef-cbd4-4a46-8da6-ba9e8059213d/lib/python3.12/site-packages/mlflow/tracing/fluent.py", line 592, in start_span_no_context trace_id, encode_span_id(otel_span.context.span_id) ^^^^^^^^^^^^^^^^^ AttributeError: 'NonRecordingSpan' object has no attribute 'context'. Did you mean: '_context'? ChatCompletion(id='chatcmpl-Cgdlz7DUK2qHR4Qiu24n8ZYW2wFLc', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Hello! How can I assist you today?', refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=None))], created=1764278699, model='gpt-4o-mini-2024-07-18', object='chat.completion', service_tier='default', system_fingerprint='fp_eca0ce8298', usage=CompletionUsage(completion_tokens=9, prompt_tokens=19, total_tokens=28, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0)))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 21:27:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/error-from-mlflow-traces-in-databricks-notebook/m-p/140560#M1461</guid>
      <dc:creator>rafaelgildin</dc:creator>
      <dc:date>2025-11-27T21:27:39Z</dc:date>
    </item>
  </channel>
</rss>

