actframework icon indicating copy to clipboard operation
actframework copied to clipboard

Metric enhancement - use FQCN plus method name as metrics label

Open greenlaw110 opened this issue 4 years ago • 2 comments

Metric enhancement

  1. If no measure tag specified in @MeasureTime or @MeasureCount, it shall use ${class.simpleName}.${methodName} as tag, instead of ${methodName}

  2. Allow it to toggle measure time of every function call at runtime for any method even without @MeasureTime specified.

greenlaw110 avatar Apr 22 '20 19:04 greenlaw110

Before fix:

GH1332[2CmLfs0j9]>.amtl
+----------------------------------------------------+-------------+-------+---------+
|                        NAME                        | ACCUMULATED | COUNT |   AVG   |
+----------------------------------------------------+-------------+-------+---------+
| act:http:act:http:com.mycom.gh1322.AppEntry.getFoo | 40.93ms     |     1 | 40.93ms |
| act:http:act:http                                  | 40.93ms     |     1 | 40.93ms |
| act:http:act                                       | 41.05ms     |     2 | 20.52ms |
| act:http                                           | 41.05ms     |     2 | 20.52ms |
| act                                                | 632.39ms    |   103 | 6.13ms  |
| app:foo                                            | 0.10ms      |     1 | 0.10ms  | <<<<<<
| app                                                | 0.10ms      |     1 | 0.10ms  |
| act:http:act:routing                               | 0.11ms      |     1 | 0.11ms  |
+----------------------------------------------------+-------------+-------+---------+

greenlaw110 avatar Dec 04 '22 22:12 greenlaw110

After fix:

GH1332[2CmLfs1ja]>.amtl
+----------------------------------------------------+-------------+-------+---------+
|                        NAME                        | ACCUMULATED | COUNT |   AVG   |
+----------------------------------------------------+-------------+-------+---------+
| act:http:act:http:com.mycom.gh1322.AppEntry.getFoo | 69.85ms     |     2 | 34.92ms |
| act:http:act:http                                  | 69.85ms     |     2 | 34.92ms |
| act:http:act                                       | 70.07ms     |     4 | 17.51ms |
| act:http                                           | 70.07ms     |     4 | 17.51ms |
| act                                                | 1.16s       |   206 | 5.67ms  |
| app:foo                                            | 0.10ms      |     1 | 0.10ms  |
| app:com.mycom.gh1322.AppEntry.foo                  | 0.05ms      |     1 | 0.05ms  | <<<<<
| app                                                | 0.16ms      |     2 | 0.08ms  |
| act:http:act:routing                               | 0.21ms      |     2 | 0.10ms  |
+----------------------------------------------------+-------------+-------+---------+
Items found: 9

greenlaw110 avatar Dec 04 '22 22:12 greenlaw110