Skip to content

Instantly share code, notes, and snippets.

@pavolloffay
Last active October 14, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavolloffay/1f49546e5153ded920b2 to your computer and use it in GitHub Desktop.
Save pavolloffay/1f49546e5153ded920b2 to your computer and use it in GitHub Desktop.
By default data are deleted after 7 days
-H "Hawkular-Tenant:28026b36-8fe4-4332-84c8-524e173a68bf"
Metrics module info
curl -ivX GET http://localhost:8080/hawkular/metrics
curl -ivX GET -H "Hawkular-Tenant:28026b36-8fe4-4332-84c8-524e173a68bf" 'http://localhost:8080/hawkular/metrics/metrics?type=gauge'
curl -ivX GET -H "Hawkular-Tenant:id1" 'localhost:8080/hawkular/metrics/metrics?type=availability'
Tenants
curl -ivX GET 'http://localhost:8080/hawkular/metrics/tenants'
curl -ivX POST -H "Content-Type: application/json" 'http://localhost:8080/hawkular/metrics/tenants' -d '{"id": "id1"}
Metrics
* Counter - monotonic function
* Gauge
* Availability, similar to Gauge
* to create all use entity MetricDefinition
Gauge
curl -ivX GET -H "Hawkular-Tenant:28026b36-8fe4-4332-84c8-524e173a68bf" 'http://localhost:8080/hawkular/metrics/gauges?tags'
curl -ivX POST -H "Hawkular-Tenant:id1" -H "Content-Type: application/json" -d '{"id":"idGauge1", "tags": {"p1":"a1"}}' 'http://localhost:8080/hawkular/metrics/gauges?'
curl -ivX GET -H "Hawkular-Tenant:id1" http://localhost:8080/hawkular/metrics/gauges/idGauge1
data
curl -ivX POST -H "Hawkular-Tenant:id1" -H "Content-Type: application/json" -d '[{"value": "22", "timestamp":"1438789644"}]' http://localhost:8080/hawkular/metrics/gauges/idGauge1/data
curl -ivX GET -H "Hawkular-Tenant:id1" http://localhost:8080/hawkular/metrics/gauges/idGauge1/data?start=0&end=99999999
curl -ivX GET -H 'Hawkular-Tenant: 28026b36-8fe4-4332-84c8-524e173a68bf' 'http://localhost:8080/hawkular/metrics/gauges/MI~R~%5Bdhcp130-144~Local~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Used/data?start=1&buckets=1'
Availability
curl -ivX GET -H "Hawkular-Tenant:id1" 'http://localhost:8080/hawkular/metrics/availability?tags'
curl -ivX POST -H "Hawkular-Tenant:id1" -H "Content-Type: application/json" -d '{"id":"idAval1", "tags": {"p1":"a1"}}' 'http://localhost:8080/hawkular/metrics/availability'
curl -ivX GET -H "Hawkular-Tenant:id1" -H "tenantId:id1" 'http://localhost:8080/hawkular/metrics/availability/idAval1'
data
curl -ivX POST -H "Hawkular-Tenant:id1" -H "Content-Type: application/json" -d '[{"value": "22", "timestamp":"1438789644"}]' http://localhost:8080/hawkular/metrics/availability/idAval1/data
curl -ivX GET -H "Hawkular-Tenant:id1" http://localhost:8080/hawkular/metrics/availability/idAval1/data?start=0&end=99999999
Counters
curl -ivX POST -H "Hawkular-Tenant: 28026b36-8fe4-4332-84c8-524e173a68bf" -H "Content-Type: application/json" -d '{"id":"idCounter1", "tags": {"p1":"a1"}}' 'http://localhost:8080/hawkular/metrics/counters'
curl -ivX GET -H "Hawkular-Tenant:id1" -H "tenantId:id1" 'http://localhost:8080/hawkular/metrics/counters/idCounter1'
data
curl -ivX POST -H "Hawkular-Tenant: 28026b36-8fe4-4332-84c8-524e173a68bf" -H "Content-Type: application/json" -d '[{"value": "22", "timestamp":"1438789644"}]' http://localhost:8080/hawkular/metrics/counters/idCounter1/data
curl -ivX GET -H "Hawkular-Tenant:id1" http://localhost:8080/hawkular/metrics/counters/idCounter1/data?start=0&end=99999999
rate
curl -ivX GET -H "Hawkular-Tenant:id1" http://localhost:8080/hawkular/metrics/counters/idCounter1/rate?start=0&end=99999
Send mixed data
curl -ivX POST -H "Hawkular-Tenant:id1" -H "Content-Type: application/json" -d '{"availabilities":[{"data":[{"value": "UP", "timestamp":"1438789644"}],"id":"avail1"}],"counters":[{"data":[{"value": 22, "timestamp":"1438789644"}],"id":"counter1"}],"gauges":[{"data":[{"value": 22, "timestamp":"1438789644"}],"id":"gauge1"}]}' 'http://fbr-haw.bc.jonqe.lab.eng.bos.redhat.com:8080/hawkular/metrics/metrics/data'
<tsegismont> this not per second
<tsegismont> this is per millis
<tsegismont> timestamp sent by the server are in milliseconds
<tsegismont> and rate unit is per minute
<tsegismont> Because this is 0.7
<tsegismont> We don't drop weird transitions (what we call counter resets)
<tsegismont> 3240000 = (55 - 1) * 1000 * 60
<tsegismont> -120000 = (53-55) * 1000 * 60
<tsegismont> 360000 = (59 - 53) * 1000 * 60
<tsegismont> Due to https://issues.jboss.org/browse/HWKMETRICS-284
<tsegismont> there is not rate at 1444828917
<tsegismont> But when Hawkular master is upgraded
<tsegismont> you'll see the same result
<tsegismont> with these timestamps: 1444828915, 1444828916, 1444828917
<ploffay> Thanks, this was perfect
<tsegismont> Now, back to your timestamps on raw data
<tsegismont> if you were expecting seconds
<tsegismont> you may have incorrectly sent your raw points
<ploffay> We don't drop weird transitions (what we call counter resets) I don't understand this
<tsegismont> A counter should be monotonically increasing
<tsegismont> If your counter suddenly goes down
<tsegismont> It means that the machine was restarted
<tsegismont> And the counter was reset
<tsegismont> A good example is cpu ticks
<tsegismont> when machine starts
<tsegismont> ticks = 0
<tsegismont> Then ticks keep increasing
<tsegismont> until you restart the machine
<ploffay> so back to my example data values at 58 2 there is counter reset. Am I right?
<tsegismont> yes
<ploffay> great
<ploffay> so for 55 58 2 62 received each millisecond rate is, 3240000 = (55 - 1) * 1000 * 60| -120000 = (53-55) * 1000 * 60 | reset because of value 58->2 so new rate is (2-1) * 60000 | (2 - 62) * 60000
<tsegismont> ni
<tsegismont> rate is calculated with the following pairs
<tsegismont> 55,58
<tsegismont> 58,2
<tsegismont> ^^ this one is discarded
<tsegismont> 2,62
<ploffay> 58,2 -> is discarded but you sad that counter restarts after it goes down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment