Skip to content

Commit

Permalink
Closes #190 - Added tracing to the demo (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKunz authored May 10, 2019
1 parent 279d23d commit 00d9c23
Show file tree
Hide file tree
Showing 18 changed files with 476 additions and 11 deletions.
39 changes: 39 additions & 0 deletions inspectit-ocelot-demo/agentconfig/api-gateway/sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#extract the prepared statement SQL string from the HSQLDB jdbc driver
inspectit:
data:
sql:
is-tag: false

instrumentation:

actions:
hsqldb_prepared_statement_get_sql:
imports:
- org.hsqldb.jdbc
- java.lang.reflect
input:
_this: JDBCPreparedStatement
_class: Class
value-body: |
Field sqlField = _class.getDeclaredField("sql");
sqlField.setAccessible(true);
return sqlField.get(_this);
rules:
hsqldb_get_prep_statement_sql:
scopes:
hsqldb_prepared_statement_execute: true
tracing:
attributes:
sql: sql
entry:
sql:
action: hsqldb_prepared_statement_get_sql

scopes:
hsqldb_prepared_statement_execute:
type:
name: org.hsqldb.jdbc.JDBCPreparedStatement
methods:
- name: execute
matcher-mode: STARTS_WITH
34 changes: 34 additions & 0 deletions inspectit-ocelot-demo/agentconfig/api-gateway/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
inspectit:
data:
sql:
is-tag: false
instrumentation:
rules:

#use the existing rules from the default configuration but enable tracing
http_server_servlet_api:
tracing:
start-span: true
name: http_raw_path
kind: SERVER
start-span-conditions:
only-if-not-null: http_is_entry

http_client_apache_execute:
tracing:
start-span: true
kind: CLIENT
start-span-conditions:
only-if-not-null: http_is_entry

#we also record jdbc calls including their target database
servicegraph_record_jdbc_calls:
tracing:
start-span: true
attributes:
database: db_name
start-span-conditions:
only-if-not-null: servicegraph_is_entry
entry:
db_name:
action: get_jdbc_statement_connection_name
39 changes: 39 additions & 0 deletions inspectit-ocelot-demo/agentconfig/config-server/sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#extract the prepared statement SQL string from the HSQLDB jdbc driver
inspectit:
data:
sql:
is-tag: false

instrumentation:

actions:
hsqldb_prepared_statement_get_sql:
imports:
- org.hsqldb.jdbc
- java.lang.reflect
input:
_this: JDBCPreparedStatement
_class: Class
value-body: |
Field sqlField = _class.getDeclaredField("sql");
sqlField.setAccessible(true);
return sqlField.get(_this);
rules:
hsqldb_get_prep_statement_sql:
scopes:
hsqldb_prepared_statement_execute: true
tracing:
attributes:
sql: sql
entry:
sql:
action: hsqldb_prepared_statement_get_sql

scopes:
hsqldb_prepared_statement_execute:
type:
name: org.hsqldb.jdbc.JDBCPreparedStatement
methods:
- name: execute
matcher-mode: STARTS_WITH
34 changes: 34 additions & 0 deletions inspectit-ocelot-demo/agentconfig/config-server/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
inspectit:
data:
sql:
is-tag: false
instrumentation:
rules:

#use the existing rules from the default configuration but enable tracing
http_server_servlet_api:
tracing:
start-span: true
name: http_raw_path
kind: SERVER
start-span-conditions:
only-if-not-null: http_is_entry

http_client_apache_execute:
tracing:
start-span: true
kind: CLIENT
start-span-conditions:
only-if-not-null: http_is_entry

#we also record jdbc calls including their target database
servicegraph_record_jdbc_calls:
tracing:
start-span: true
attributes:
database: db_name
start-span-conditions:
only-if-not-null: servicegraph_is_entry
entry:
db_name:
action: get_jdbc_statement_connection_name
39 changes: 39 additions & 0 deletions inspectit-ocelot-demo/agentconfig/customers-service/sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#extract the prepared statement SQL string from the HSQLDB jdbc driver
inspectit:
data:
sql:
is-tag: false

instrumentation:

actions:
hsqldb_prepared_statement_get_sql:
imports:
- org.hsqldb.jdbc
- java.lang.reflect
input:
_this: JDBCPreparedStatement
_class: Class
value-body: |
Field sqlField = _class.getDeclaredField("sql");
sqlField.setAccessible(true);
return sqlField.get(_this);
rules:
hsqldb_get_prep_statement_sql:
scopes:
hsqldb_prepared_statement_execute: true
tracing:
attributes:
sql: sql
entry:
sql:
action: hsqldb_prepared_statement_get_sql

scopes:
hsqldb_prepared_statement_execute:
type:
name: org.hsqldb.jdbc.JDBCPreparedStatement
methods:
- name: execute
matcher-mode: STARTS_WITH
34 changes: 34 additions & 0 deletions inspectit-ocelot-demo/agentconfig/customers-service/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
inspectit:
data:
sql:
is-tag: false
instrumentation:
rules:

#use the existing rules from the default configuration but enable tracing
http_server_servlet_api:
tracing:
start-span: true
name: http_raw_path
kind: SERVER
start-span-conditions:
only-if-not-null: http_is_entry

http_client_apache_execute:
tracing:
start-span: true
kind: CLIENT
start-span-conditions:
only-if-not-null: http_is_entry

#we also record jdbc calls including their target database
servicegraph_record_jdbc_calls:
tracing:
start-span: true
attributes:
database: db_name
start-span-conditions:
only-if-not-null: servicegraph_is_entry
entry:
db_name:
action: get_jdbc_statement_connection_name
39 changes: 39 additions & 0 deletions inspectit-ocelot-demo/agentconfig/discovery-server/sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#extract the prepared statement SQL string from the HSQLDB jdbc driver
inspectit:
data:
sql:
is-tag: false

instrumentation:

actions:
hsqldb_prepared_statement_get_sql:
imports:
- org.hsqldb.jdbc
- java.lang.reflect
input:
_this: JDBCPreparedStatement
_class: Class
value-body: |
Field sqlField = _class.getDeclaredField("sql");
sqlField.setAccessible(true);
return sqlField.get(_this);
rules:
hsqldb_get_prep_statement_sql:
scopes:
hsqldb_prepared_statement_execute: true
tracing:
attributes:
sql: sql
entry:
sql:
action: hsqldb_prepared_statement_get_sql

scopes:
hsqldb_prepared_statement_execute:
type:
name: org.hsqldb.jdbc.JDBCPreparedStatement
methods:
- name: execute
matcher-mode: STARTS_WITH
34 changes: 34 additions & 0 deletions inspectit-ocelot-demo/agentconfig/discovery-server/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
inspectit:
data:
sql:
is-tag: false
instrumentation:
rules:

#use the existing rules from the default configuration but enable tracing
http_server_servlet_api:
tracing:
start-span: true
name: http_raw_path
kind: SERVER
start-span-conditions:
only-if-not-null: http_is_entry

http_client_apache_execute:
tracing:
start-span: true
kind: CLIENT
start-span-conditions:
only-if-not-null: http_is_entry

#we also record jdbc calls including their target database
servicegraph_record_jdbc_calls:
tracing:
start-span: true
attributes:
database: db_name
start-span-conditions:
only-if-not-null: servicegraph_is_entry
entry:
db_name:
action: get_jdbc_statement_connection_name
39 changes: 39 additions & 0 deletions inspectit-ocelot-demo/agentconfig/vets-service/sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#extract the prepared statement SQL string from the HSQLDB jdbc driver
inspectit:
data:
sql:
is-tag: false

instrumentation:

actions:
hsqldb_prepared_statement_get_sql:
imports:
- org.hsqldb.jdbc
- java.lang.reflect
input:
_this: JDBCPreparedStatement
_class: Class
value-body: |
Field sqlField = _class.getDeclaredField("sql");
sqlField.setAccessible(true);
return sqlField.get(_this);
rules:
hsqldb_get_prep_statement_sql:
scopes:
hsqldb_prepared_statement_execute: true
tracing:
attributes:
sql: sql
entry:
sql:
action: hsqldb_prepared_statement_get_sql

scopes:
hsqldb_prepared_statement_execute:
type:
name: org.hsqldb.jdbc.JDBCPreparedStatement
methods:
- name: execute
matcher-mode: STARTS_WITH
34 changes: 34 additions & 0 deletions inspectit-ocelot-demo/agentconfig/vets-service/tracing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
inspectit:
data:
sql:
is-tag: false
instrumentation:
rules:

#use the existing rules from the default configuration but enable tracing
http_server_servlet_api:
tracing:
start-span: true
name: http_raw_path
kind: SERVER
start-span-conditions:
only-if-not-null: http_is_entry

http_client_apache_execute:
tracing:
start-span: true
kind: CLIENT
start-span-conditions:
only-if-not-null: http_is_entry

#we also record jdbc calls including their target database
servicegraph_record_jdbc_calls:
tracing:
start-span: true
attributes:
database: db_name
start-span-conditions:
only-if-not-null: servicegraph_is_entry
entry:
db_name:
action: get_jdbc_statement_connection_name
Loading

0 comments on commit 00d9c23

Please sign in to comment.