Graphite nginx requests per second - nginx

Is there any way how to get Graphite to graph req/s ?
When you retrieve nginx requests from nginx_status you are sending an absolute value to the graphite, so I'm thinking if there is any way how you can get the rate per second ?
My understanding is that derivative(series) would give you requests/minute but I could really use requests/s.
Cheers.

I'm not sure if this is the right way to do this but it seems like this did the trick
scaleToSeconds(derivative(stats.*.*.*.nginx.handles),1)
Anyone sees any problems with this ?

Run your nginx access logs through Logster, which will munge the data and forward several interesting metrics -- including requests per second, if you wish -- to Graphite.
https://github.com/etsy/logster

Related

How many http get requests/minute can we get without being considered attack/spam

Let's say we have a url fuzzer for security testing writen in Python.
How many Get requests can we have per second or minute without affecting that website ?
For example: Are 200 Requests/Minute too much ?
Thank you.
There's no fixed amount, it totally depends on the website.
Sometimes the HTTP response status code can help you to understand that using the 429 status code: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Set departure datetime in https://route.api.here.com/routing/7.2/calculateroute.json not working?

I'm trying to do truck routing using the HERE calculateroute service. I need to calculate the estimated arrival time. From my understanding this should work if I simply add departure="2020-03-10T17:00:00+02" or "now" to the request. However, if I add this I get the same result as with a request that does not have a fixed departure time. I'd expect to see a departure- and arrival time in the response but they're not there.
curl -X GET 'https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=50.16193,8.53361&waypoint1=50.11208,8.68342&jsonAttributes=1&alternatives=1&routeattributes=waypoints,summary,summaryByCountry,shape,boundingBox,legs,notes,lines,routeId,groups,tickets,incidents,zones&legattributes=waypoint,maneuvers,links,length,travelTime,shape,indices,boundingBox,baseTime,trafficTime,summary&linkattributes=consumption,dynamicSpeedInfo,flags,functionalClass,indices,length,maneuver,nextLink,nextStopName,publicTransportLine,remainDistance,remainTime,roadName,roadNumber,shape,speedLimit,timeDependentRestriction,timezone,truckRestrictions&instructionformat=text&app_id={app_id}&app_code={app_code}&mode=fastest;truck;traffic:enabled&truckType=truck&trailersCount=0&axleCount=2&limitedWeight=20&height=4&width=2.5&length=10&truckRestrictionPenalty=strict&departure=now'
curl -X GET 'https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=50.16193,8.53361&waypoint1=50.11208,8.68342&jsonAttributes=1&alternatives=1&routeattributes=waypoints,summary,summaryByCountry,shape,boundingBox,legs,notes,lines,routeId,groups,tickets,incidents,zones&legattributes=waypoint,maneuvers,links,length,travelTime,shape,indices,boundingBox,baseTime,trafficTime,summary&linkattributes=consumption,dynamicSpeedInfo,flags,functionalClass,indices,length,maneuver,nextLink,nextStopName,publicTransportLine,remainDistance,remainTime,roadName,roadNumber,shape,speedLimit,timeDependentRestriction,timezone,truckRestrictions&instructionformat=text&app_id={app_id}&app_code={app_code}&mode=fastest;truck;traffic:enabled&truckType=truck&trailersCount=0&axleCount=2&limitedWeight=20&height=4&width=2.5&length=10&truckRestrictionPenalty=strict'
According to the documentation my request seems to be fine: https://developer.here.com/documentation/routing/dev_guide/topics/resource-calculate-route.html
I also found out that it works with the newer routing API v8 (8.20.3). But since there's no way to also get the link ids (I think?) I need to use v7.2.
Am I doing anything wrong?
By default if you don't put anything it's now. For example you can compare departure=now vs departure=2021-03-19T08:23:05Z then you will see the different between traffic time and maybe basetime as well.

Ocassionally-unreliable DATE field of http response

We're interested in the rough timezone of the user, give or take a few hours, and for reasons we don't trust the user's device clock.
One cheap and easy thing we tried is to post a GET (a HEAD would work too) to (eg) google.com, and look for the DATE field of the header. This is, by the http standard, always in GMT. This may fall foul of caching, so we added a ?rng=XXXXXX to the end.
However in some cases the date field seems to be way off. Like, days off. The previous and next request get the correct date. Now maybe I just need to add more digits to my cache-beating rng field, but could something else be going on? Are there any flaws or downsides in this plan, considering we don't care about second-accuracy?
We seem pretty sure that given our player install base, and the frequency of these checks, and the poorness of our random suffix, that google/someone in between was able to cache them successfully.
Seems like a good rule not to use http headers for authoritative time, unless you control the server and can send non-caching responses.

Add many routes using Google Maps Directions Service Over Query Limit

I have an application that requires having many (sometimes over 50) dynamic routes added to the google map. Using the DirectionsService, I am able to add right around 10 routes or so before the requests start to fail with the status of "Over Query Limit". I was wondering if anyone has encountered this situation and has found a way to deal with it. It seems that even if I pause between requests, I am still failing for anything over the first 10. Not sure if there is a request limit for a single map instance?
Any help with this would be much appreciated!
According to the documentation, you can only get up to 2 requests per second. If your code do that slower than 2 per second, that should be fine.
I used the setInterval(function(){.... to test it and yup, if you do it slow enough it seems to work.
http://jsfiddle.net/bd1qdLv3/

Optimal route with timed waypoints

I want to plan a route for a delivery truck with a number of stops along the way where some of the stops need to be timed. I have tried to figure out a way that makes use of the Directions service and the Distance service without making a ton of requests. If someone has got a solution in theory I can probably put together the code myself. Thanks!

Resources