Sampling and blocking requests

Sampling

How it works

It is possible that while using hypertest sdk the latency of your APIs increase. You can go around this issue by telling the sdk to stop recording the requests for a certain cool off period. This is called sampling. You tell us which requests should be sampled by providing a maximum response time. The requests taking more than maximum response time are marked to be sampled. So, the next time such a request comes it wont be recorded, decreasing your latency.

Code

htSdk.setSamplingConfig({
  coolOffPeriodMs: 10000,
  maxResponseTimeMs: 100,
})

Blocking requests

Hypertest sdk allows you to specify a config to stop recording certain requests. You can specify the method and the path of the request you want to be be blocked.

htSdk.setBlockRequestsConfig({
  http: [
    {
      path: '/sampling/blocking'
    },
    {
      path: '/test/blocking',
      method: '*'
    },
    {
      path: /sampling\/blocking/,
      method: 'put'
    },
    {
      path: '/sampling/:id'
    },
    {
      path: '/sampling/{id}'
    }
  ]
})
  • Method is a string that takes '*' or any valid http verb as value. It is case insensitive. If you dont specify it, it is assumed to be '*' which matches it with all the possible verbs

  • Path can take the absolute request path or a regex or the cluster path of the http request.

Last updated