Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use actuator/metrics for data points #615

Merged
merged 33 commits into from
Mar 13, 2024
Merged

Conversation

clemens-tolboom
Copy link
Collaborator

@clemens-tolboom clemens-tolboom commented Jan 24, 2024

Actuator metrics

Current

image

Previous

image

Other Actuator

This makes discussion easier as the links are available.

image

We can use de standard items and build custom

  • use standard
  • Through new issue make custom rock items available by their API like rserve.processes.current already there
  • make UI table
  • Add tests
  • cleanup UI
  • Align header same as Projects
  • Add search to filter on
    • image
  • Details clutters the table feel
    • image
    • Move Details in column as popout?
  • odd/even on path difference .. detail above has 2 items on same path
  • Bytes are rounded up to 2 digits precision B,KB,MB,GM,TB,EB
    • is similar nice to have for times ie uptime in days?
      image

Actuator

Metrics

By names

curl --silent --user admin:admin http://localhost:8080/actuator/metrics | json_pp
{
   "names" : [
      "application.ready.time",
      "application.started.time",
      "disk.free",
      "disk.total",
      "http.server.requests",
      "http.server.requests.active",
      "jvm.buffer.count",
      "jvm.buffer.memory.used",
...

fetch by name

# file: actuator-metrics
json=$(curl --silent --user admin:admin http://localhost:8080/actuator/metrics)

names=$(echo "$json" | jq -r '.names[]')
```bash
for name in $names; do
   echo "Processing $name"
   # Add your processing code here
done

Groups

curl --silent --user admin:admin http://localhost:8080/actuator/metrics|
json_pp | grep '\.' | cut -d . -f 1 | uniq -c

   2       "application
   2       "disk
   2       "http
  22       "jvm
   1       "logback
   5       "process
   1       "rserve
  42       "spring
   3       "system
   6       "tomcat

disk.free

curl --silent --user admin:admin http://localhost:8080/actuator/metrics/disk.free | json_pp

{
   "availableTags" : [
      {
         "tag" : "path",
         "values" : [
            "/Users/clemens/Documents/GitHub/molgenis-service-armadillo/."
         ]
      }
   ],
   "baseUnit" : "bytes",
   "description" : "Usable space for path",
   "measurements" : [
      {
         "statistic" : "VALUE",
         "value" : 269983137792
      }
   ],
   "name" : "disk.free"
}

@clemens-tolboom clemens-tolboom marked this pull request as draft January 24, 2024 10:35
@clemens-tolboom
Copy link
Collaborator Author

clemens-tolboom commented Jan 31, 2024

Weird error while testing on rserve.processes.current ... is that an actuator item?

15:45:45.103 [http-nio-8080-exec-4|] WARN  o.m.r.RServerConnectionFactory - Container for 'http://localhost:6312'  is down
15:45:45.118 [http-nio-8080-exec-4|] WARN  i.m.c.i.internal.DefaultGauge - Failed to apply the value function for the gauge 'rserve.processes.current'. Note that subsequent logs will be logged at debug level.
org.molgenis.r.exceptions.ConnectionCreationFailedException: org.molgenis.r.rock.RockServerException: Failure when opening a Rock R session
        at org.molgenis.r.rock.RockConnectionFactory.tryCreateConnection(RockConnectionFactory.java:39)
        at org.molgenis.r.RServerConnectionFactory.tryCreateConnection(RServerConnectionFactory.java:66)
        at org.molgenis.armadillo.info.RProcessEndpoint.connect(RProcessEndpoint.java:58)
...

@clemens-tolboom clemens-tolboom changed the title Can we use actuator Use actuator for data points Feb 9, 2024
@clemens-tolboom clemens-tolboom marked this pull request as ready for review February 9, 2024 16:39
@clemens-tolboom clemens-tolboom added this to the Sprint 217 milestone Feb 13, 2024
@clemens-tolboom clemens-tolboom changed the title Use actuator for data points Use actuator/metrics for data points Feb 13, 2024
@mswertz mswertz changed the title Use actuator/metrics for data points feat: use actuator/metrics for data points Feb 22, 2024
Copy link
Collaborator

@marikaris marikaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed. For now I'm not going to comment on the composition/options api. We will the refactor for that later. I do think we need tests and the typing should be fixed. Do you have the following plugins in your vsCode:
TypeScript Vue Plugin and Vue Language Features (Volar) ? I think it's the latter. I get error like these:
Screenshot 2024-02-26 at 10 43 25
:
Screenshot 2024-02-26 at 10 42 59
Screenshot 2024-02-26 at 10 43 07
Screenshot 2024-02-26 at 10 43 17

ui/src/api/api.ts Outdated Show resolved Hide resolved
ui/src/api/api.ts Outdated Show resolved Hide resolved
ui/src/api/api.ts Show resolved Hide resolved
ui/src/api/api.ts Show resolved Hide resolved
ui/src/components/ActuatorItem.vue Outdated Show resolved Hide resolved
ui/src/components/ActuatorItem.vue Outdated Show resolved Hide resolved
ui/src/views/Insight.vue Outdated Show resolved Hide resolved
ui/src/views/Insight.vue Outdated Show resolved Hide resolved
ui/src/views/Users.vue Show resolved Hide resolved
Copy link
Member

@mswertz mswertz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve but please check if you can add smoketest for the '/actuator' and '/metrics'
I expect you would like to copy the test for the UserController

ui/src/components/Actuator.vue Show resolved Hide resolved
ui/src/components/Actuator.vue Show resolved Hide resolved
ui/src/api/api.ts Outdated Show resolved Hide resolved
ui/src/components/ActuatorItem.vue Outdated Show resolved Hide resolved
@clemens-tolboom clemens-tolboom merged commit 422e5a3 into master Mar 13, 2024
2 checks passed
@clemens-tolboom clemens-tolboom deleted the feat/metrics branch March 13, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants