How to display changing of graphite counter in time (in grafana)? - grafana

I have a question. I send counter to graphite. It increases every time somebody uses endpoint. So, it increases slowly during the day. I want to display on dashboard amount of connections during time (histogram - one bar graph per 5 minutes). For example, i now have smth like this
.
And I want grafana to display changes in time (5 min). It started in 13:31. so i want one bar graph(from 13:31 too 13:36) that will have value 12, next bar grapgh with value 0 and e.t.c (For example, if counter increases by 3, next bar graph will have value 3). I have no ideas, how to do it and will be glad if you help.

For rate of change over time, Have a look at the perSecond function of Graphite.
For actual change (i.e the derivative) for your usecase id lookat the nonNegativeDerivative Function
https://graphite.readthedocs.io/en/latest/functions.html
I used this (as per the example) to calculate Network traffic

Related

Service utilization time and Bar chart

In my model I want to calculate the utilized time in seconds in service block and display it in bar chart in the form of percentage i.e. the percentage of service time of service block 1 out of the total time of the model.
For example:
service block 1= 60 second
service block 2= 10 second
service block 3= 400 second
Total time of the service blocks = 410 seconds
Service block 1 utilized time is (60/470)*100= 12.7%
So I have calculated the utilized time as shown in . The TimeIn is a variable in agent.
Picture 2 shows the variable, Statistics and data set used for calculation and Bar chart display. D2 is the data set used in value chart display.
D2.add((agent.TimeIn-agent.TimeOut)/X)
My Question:
How can I get the bar chart to only display 12.7 percent out of the 100%. Currently it does show 100% every time I run the model.
I have used the following in the bar chart value window:
D2.getYMean()
Any suggestions?
Thanks
One of the straight forward way to measure time utilization in a service station is to use time measure as shown on the figure below
there is other ways in finding the utilization time for service station. one of the method mentioned by Anylogic help is double utilization() (Returns the mean utilization of this block. The returned value is the average (collected over time) of number of agents being serviced). I have tried using the double utilization()with service station but didn't work. However it dose work with delay (x.stats.Utilization.mean()https://paginas.fe.up.pt/~ee01260/AnyLogic%20Models/Bank/AnyLogic_6_Enterprise_Library_Tutorial.pdf).

Google OR-Tools: Minimize Total Time

I am working on a VRPTW and want to minimize the total time (travel time + waiting time) cumulated for all vehicles. So if we have 2 vehicles one that starts at time 0 and returns at time 50 and one that starts at time 25 and returns at time 100, then the objective value would be 50+75=125.
Currently I have implemented the following code:
for i in range(data['num_vehicles']):
routing.AddVariableMinimizedByFinalizer(
time_dimension.CumulVar(routing.End(i)))
However, this seems like it is only minimizing the time we arrive back at the depot.
Also it results in very high waiting times.
How do I implement it correctly in Google OR tools?
This is called the span.
See the SetSpanCostCoefficientForVehicle method for one vehicle.
You can also set it for all vehicles.

How to visualize cycle times of a periodic process?

I have a periodic backend process and I would like to visualize the history of the length of cycles on my dashboard. Is it possible?
I have full control over the data/metrics I generate, so I could perhaps increment a counter every time a cycle completes (a cycle takes about 3 days), so I would get counter updates every 3 days or so. Then how could I get Grafana to report the length of each cycle? (for instance: 72h; 69h; 74h; etc.) The actual widget doesn't matter, but I need something visual to tell me at once if cycles are getting faster or slower.
Any pointers or ideas are welcome.
It looks like a standard time series: X-axis - time, Y-axis - duration [s]:
Then you may add:
trend line
aggregations (min/max/avg/derivation/diff/...)
moving average
other math functions, which are available in used datasource

reset chart to 0 in grafan

Below is a chart I have in grafana:
My problem is that if my chosen time range is say 5 minutes, the graph wont show only what happened in the last 5 minutes. So in the picture, nothing happened in the past 5 minutes so it's just showing the last points it has. How can I change this so that it goes back to zero if nothing has changed? I'm using a Prometheus counter for this, if that is relevant.
As explained in the Prometheus documentation, a counter value in itself is not of much use. It depends on when your job was last restarted and everything that happened since.
What's interesting about a counter is how much it changed over some period of time. I.e. either the average rate of change per second (e.g. 3 queries per second) or the increase over some time range (e.g. 10K queries in the last hour).
So instead of graphing something like e.g. http_requests, you should graph rate(http_requests[1m]) (the averate number of requests over the previous 1 minute) or increase(http_requests[1h]) (the total number of requests over the past hour). You can play with the range size until you get something which makes sense for your data. But make sure to use a range at least 2x your scrape interval (and ideally more, as Prometheus is somewhat daft in the way it computes rates/increases).

How to show delta from start of timespan to point in time for counter

I am trying to visualize a counter increase over time.
But I'm facing two problems:
The graph doesn't start at zero for the timeframe and
When ever the counter resets, the graph hits zero again
This leads to the graph being very hard to read cause what I realy would like is to see how quickly the counter increases over time while being able to quickly get an overview of total amounts of increases at a given point in time measured from the start of the time frame.
Visualisation of my problem
Update 20. November
Result of 'increase([your_metric_name][1m])'
You need to use some type of rate or increase function to get the type of graph you're looking for. And since you're using Prometheus, your query will look something like this:
rate([your_metric_name][1m])
If you want the rate per second, OR
increase([your_metric_name][1m])
If you want something more like a delta.
These pages can give you more information too: https://prometheus.io/docs/prometheus/latest/querying/functions/#rate()
https://prometheus.io/docs/prometheus/latest/querying/functions/#increase()