Skip to content

Commit

Permalink
Add JFR event labels and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
chiroito committed Apr 16, 2024
1 parent f46616e commit 37a4a3a
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public void beforeInvoke(StatementBeforeInvokeContext beforeContext) {
startEvent.connectionId = conInfo.connectionId.value;
startEvent.wrappedConnectionId = conInfo.wrappedConnectionId.value;
startEvent.operationId = beforeContext.operationInfo.id.value;
startEvent.sql = beforeContext.sql;
startEvent.query = beforeContext.sql;
startEvent.isPrepared = beforeContext.isPrepared;
beforeContext.sqlParameter.ifPresent(p -> startEvent.sqlParameter = p);
beforeContext.sqlParameter.ifPresent(p -> startEvent.queryParameter = p);
beforeContext.isStatementPoolable.ifPresent(p -> startEvent.isStatementPoolable = p);
beforeContext.isStatementClosed.ifPresent(p -> startEvent.isStatementClosed = p);
beforeContext.isAutoCommitted.ifPresent(p -> startEvent.isAutoCommitted = p);
Expand All @@ -45,9 +45,9 @@ public void afterInvoke(StatementBeforeInvokeContext beforeContext, StatementAft
periodEvent.connectionId = conInfo.connectionId.value;
periodEvent.wrappedConnectionId = conInfo.wrappedConnectionId.value;
periodEvent.operationId = beforeContext.operationInfo.id.value;
periodEvent.sql = beforeContext.sql;
periodEvent.query = beforeContext.sql;
periodEvent.isPrepared = beforeContext.isPrepared;
beforeContext.sqlParameter.ifPresent(p -> periodEvent.sqlParameter = p);
beforeContext.sqlParameter.ifPresent(p -> periodEvent.queryParameter = p);
beforeContext.isStatementPoolable.ifPresent(p -> periodEvent.isStatementPoolable = p);
beforeContext.isStatementClosed.ifPresent(p -> periodEvent.isStatementClosed = p);
beforeContext.isAutoCommitted.ifPresent(p -> periodEvent.isAutoCommitted = p);
Expand All @@ -67,9 +67,9 @@ public void afterInvoke(StatementBeforeInvokeContext beforeContext, StatementAft
endEvent.connectionId = conInfo.connectionId.value;
endEvent.wrappedConnectionId = conInfo.wrappedConnectionId.value;
endEvent.operationId = beforeContext.operationInfo.id.value;
endEvent.sql = beforeContext.sql;
endEvent.query = beforeContext.sql;
endEvent.isPrepared = beforeContext.isPrepared;
beforeContext.sqlParameter.ifPresent(p -> endEvent.sqlParameter = p);
beforeContext.sqlParameter.ifPresent(p -> endEvent.queryParameter = p);
beforeContext.isStatementPoolable.ifPresent(p -> endEvent.isStatementPoolable = p);
beforeContext.isStatementClosed.ifPresent(p -> endEvent.isStatementClosed = p);
beforeContext.isAutoCommitted.ifPresent(p -> endEvent.isAutoCommitted = p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.jfr4jdbc.WrappedConnectionIdRelational;
import jdk.jfr.*;

import java.sql.Connection;

@Name("jdbc.CancelEnd")
@Label("Cancel End")
@Category("jdbc")
Expand All @@ -13,20 +15,24 @@
public class CancelEndEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that cancels the query")
@Description("Label for data source managing the connection that canceled the query")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that cancels the query")
@Description("ID for the connection that canceled the query")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that cancels the query")
@Description("ID for actual connection that canceled the query")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class that canceled the query")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
import dev.jfr4jdbc.WrappedConnectionIdRelational;
import jdk.jfr.*;

import java.sql.Connection;

@Name("jdbc.Cancel")
@Label("Cancel")
@Category("jdbc")
@Description("Statement was canceling")
public class CancelPeriodEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that cancels the query")
@Description("Label for data source managing the connection that canceled the query")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that cancels the query")
@Description("ID for the connection that canceled the query")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that cancels the query")
@Description("ID for actual connection that canceled the query")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class that canceled the query")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.jfr4jdbc.WrappedConnectionIdRelational;
import jdk.jfr.*;

import java.sql.Connection;

@Name("jdbc.CancelStart")
@Label("Cancel Start")
@Category("jdbc")
Expand All @@ -27,6 +29,10 @@ public class CancelStartEvent extends Event {
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class to cancel the query")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1")
public int operationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@
@Enabled(false)
public class CloseEndEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that closed")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that closed")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that closed")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Closed connection class")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Exception")
@Description("Exception caused by closing")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by closing")
public String exceptionMessage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,34 @@
@Description("Connection was closing")
public class ClosePeriodEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that closed")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that closed")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that closed")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Closed connection class")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Exception")
@Description("Exception caused by closing")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by closing")
public String exceptionMessage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@
@Enabled(false)
public class CommitEndEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that committed the transaction")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that committed the transaction")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that committed the transaction")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class that committed the transaction")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Exception")
@Description("Exception caused by committing")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by committing")
public String exceptionMessage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,34 @@
@Description("Transaction was committing")
public class CommitPeriodEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that committed the transaction")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that committed the transaction")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that committed the transaction")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class that committed the transaction")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Exception")
@Description("Exception caused by committing")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by committing")
public String exceptionMessage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@
@Enabled(false)
public class CommitStartEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection to commit the transaction")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection to commit the transaction")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection to commit the transaction")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("Connection Class")
@Description("Connection class to commit the transaction")
public Class<? extends Connection> connectionClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1")
public int operationId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,42 @@
@Enabled(false)
public class ResultSetEndEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that moved next cursor")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that moved next cursor")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that moved next cursor")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("ResultSet Class")
@Description("ResultSet class that moved next cursor")
public Class<? extends ResultSet> resultSetClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Result next()")
@Description("Whether the new current row is valid")
public boolean result;

@Label("Row No")
@Description("Current Row No")
public int rowNo;

public Class<? extends ResultSet> resultSetClass;

@Label("Exception")
@Description("Exception caused by moving next cursor")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by moving next cursor")
public String exceptionMessage;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,42 @@
@Description("ResultSet was moving next cursor")
public class ResultSetPeriodEvent extends Event {

@Label("DataSource Label")
@Description("Label for data source managing the connection that moved next cursor")
@DataSourceLabelRelational
public String dataSourceLabel;

@Label("Connection Id")
@Description("ID for the connection that moved next cursor")
@ConnectionIdRelational
public int connectionId;

@Label("Wrapped Connection Id")
@Description("ID for actual connection that moved next cursor")
@WrappedConnectionIdRelational
public int wrappedConnectionId;

@Label("ResultSet Class")
@Description("ResultSet class that moved next cursor")
public Class<? extends ResultSet> resultSetClass;

@Label("Operation Id")
@Description("ID for operations within this connection, numbered sequentially from 1.")
public int operationId;

@Label("Result next()")
@Description("Whether the new current row is valid")
public boolean result;

@Label("Row No")
@Description("Current Row No")
public int rowNo;

public Class<? extends ResultSet> resultSetClass;

@Label("Exception")
@Description("Exception caused by moving next cursor")
public Class exception;

@Label("Exception Message")
@Description("Exception message caused by moving next cursor")
public String exceptionMessage;
}
Loading

0 comments on commit 37a4a3a

Please sign in to comment.