Skip to content

Commit 1096f0a

Browse files
committed
Add method args and exception to ResultSetOperation
Relates #35
1 parent c1e5bb5 commit 1096f0a

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

datasource-micrometer/src/main/java/net/ttddyy/observation/tracing/DataSourceObservationListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ private void handleResultSet(MethodExecutionContext executionContext) {
401401
}
402402

403403
ResultSetOperation operation = new ResultSetOperation(executionContext.getMethod(),
404-
executionContext.getResult());
404+
executionContext.getMethodArgs(), executionContext.getResult(), executionContext.getThrown());
405405
resultSetAttributes.context.addOperation(operation);
406406

407407
String methodName = executionContext.getMethod().getName();

datasource-micrometer/src/main/java/net/ttddyy/observation/tracing/ResultSetOperation.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2024-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,11 +32,17 @@ public class ResultSetOperation {
3232

3333
private final Method method;
3434

35+
private final Object[] args;
36+
3537
private final Object result;
3638

37-
public ResultSetOperation(Method method, Object result) {
39+
private final Throwable thrown;
40+
41+
public ResultSetOperation(Method method, Object[] args, Object result, Throwable thrown) {
3842
this.method = method;
43+
this.args = args;
3944
this.result = result;
45+
this.thrown = thrown;
4046
}
4147

4248
private static final Set<String> NON_DATA_RETRIEVAL_METHODS = new HashSet<>();
@@ -56,8 +62,16 @@ public Method getMethod() {
5662
return this.method;
5763
}
5864

65+
public Object[] getArgs() {
66+
return this.args;
67+
}
68+
5969
public Object getResult() {
6070
return this.result;
6171
}
6272

73+
public Throwable getThrown() {
74+
return this.thrown;
75+
}
76+
6377
}

0 commit comments

Comments
 (0)