Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/langtrace_python_sdk/instrumentation/neo4j/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@

def driver_patch(operation_name, version, tracer):
def traced_method(wrapped, instance, args, kwargs):

try:
query = args[0].text if hasattr(args[0], "text") else args[0]
query_text = json.dumps(query)
except (AttributeError, TypeError):
query_text = args[0]
api = APIS[operation_name]
service_provider = SERVICE_PROVIDERS.get("NEO4J", "neo4j")
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
Expand All @@ -49,7 +53,7 @@ def traced_method(wrapped, instance, args, kwargs):
"langtrace.version": v(LANGTRACE_SDK_NAME),
"db.system": "neo4j",
"db.operation": api["OPERATION"],
"db.query": json.dumps(args[0]) if args and len(args) > 0 else "",
"db.query": query_text,
**(extra_attributes if extra_attributes is not None else {}),
}

Expand Down
2 changes: 1 addition & 1 deletion src/langtrace_python_sdk/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.8.11"
__version__ = "3.8.12"
Loading