Skip to content

Commit ffbd672

Browse files
committed
fix plugin version
1 parent f422d90 commit ffbd672

File tree

2 files changed

+22
-3
lines changed
  • instrumentation-genai/opentelemetry-instrumentation-dify/src/opentelemetry/instrumentation/dify

2 files changed

+22
-3
lines changed

instrumentation-genai/opentelemetry-instrumentation-dify/src/opentelemetry/instrumentation/dify/config.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def is_version_supported():
5050
except:
5151
return False
5252

53+
5354
def is_wrapper_version_1():
5455
try:
5556
current_version = dify_config.CURRENT_VERSION
@@ -58,6 +59,14 @@ def is_wrapper_version_1():
5859
except:
5960
return False
6061

62+
def is_wrapper_version_1_for_plugin():
63+
try:
64+
current_version = dify_config.CURRENT_VERSION
65+
return (_compare_versions(current_version, "0.8.3") >= 0
66+
and _compare_versions(current_version, "1.3.1") < 0)
67+
except:
68+
return False
69+
6170
def is_wrapper_version_2():
6271
try:
6372
current_version = dify_config.CURRENT_VERSION
@@ -66,4 +75,13 @@ def is_wrapper_version_2():
6675
except:
6776
return False
6877

78+
def is_wrapper_version_2_for_plugin():
79+
try:
80+
current_version = dify_config.CURRENT_VERSION
81+
return (_compare_versions(current_version, "1.3.1") >= 0
82+
and _compare_versions(current_version, "1.4.3") <= 0)
83+
except:
84+
return False
85+
86+
6987

instrumentation-genai/opentelemetry-instrumentation-dify/src/opentelemetry/instrumentation/dify/wrapper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from opentelemetry.instrumentation.dify.handler._rag_handler import ToolInvokeHandler, RetrieveHandler
88
from opentelemetry.instrumentation.dify.handler._rag_handler import VectorSearchHandler
99
from opentelemetry.instrumentation.dify.handler._rag_handler import FullTextSearchHandler
10-
from opentelemetry.instrumentation.dify.config import is_wrapper_version_1, is_wrapper_version_2
10+
from opentelemetry.instrumentation.dify.config import is_wrapper_version_1, is_wrapper_version_2, \
11+
is_wrapper_version_2_for_plugin, is_wrapper_version_1_for_plugin
1112

1213
_WORKFLOW_NODE_MODULE = "core.workflow.nodes.base.node"
1314
_RAG_RETRIEVAL_MODULE = "core.rag.retrieval.dataset_retrieval"
@@ -149,9 +150,9 @@ def set_workflow_cycle_wrapper_version_1(handler):
149150

150151

151152
def set_plugin_wrapper(tracer):
152-
if is_wrapper_version_1():
153+
if is_wrapper_version_1_for_plugin():
153154
set_plugin_wrapper_version_1(tracer)
154-
elif is_wrapper_version_2():
155+
elif is_wrapper_version_2_for_plugin():
155156
set_plugin_wrapper_version_2(tracer)
156157
else:
157158
return

0 commit comments

Comments
 (0)