Comments (6)
I think I still get this bug. I use v0.6.0 together with akkaHttpVersion 10.1.11 , akkaVersion 2.5.29 and am using pathLabeled. For 200 requests I get the label specified by pathLabeled ("/GET me"), but when the api responds with an 401 unauthorised for the same path I get "/me" instead so the metrics is not counted together.
from akka-http-metrics.
This behavior depends on the rejection cause. Unmatched path is the rejection leading to 404
.
Unauthorised (401
) should probably be handled the same way, since a good practice is to always return 401
even if the path requested does not exists. This avoids leaking the (non)existence of resources to rogue users.
I'm reopening this to extend the behavior with other rejections.
Good catch @wake42 !
from akka-http-metrics.
As a note: pathLabeled
won't be used in case of rejection. (I'll double check this) that would explain the wrong grouping in your case.
from akka-http-metrics.
The api could also respond with 403 forbidden and 500 internal error. I guess all response codes should be caught by this?
from akka-http-metrics.
If the pathLabeled is not used then how do you group endpoints like /user/123, wouldn't that count every individual user as a separate endpoint for error responses?
from akka-http-metrics.
After double checking the code and running some tests for v1.0.0
, this is the actual behavior when pathDimension
is enabled:
Let's consider the request GET /user/723abce0-9263-4dad-80a6-4eb7002a86da
For server route
pathLabeled("user" / JavaUUID, "user/:user-id") { userId =>
complete(StatusCodes.NotFound)
}
Path dimension is user/:user-id
For server route
pathLabeled("user" / JavaUUID, "user/:user-id") { userId =>
reject
}
Path dimension is unhandled
This difference is due to the way akka-http
works with rejections.
In the rejection handler, we have no way to know if the path has been fully matched or not. It's then impossible for the metrics framework to process 'labeling' on the request path. To limit the risk of unbounded metrics generation, path dimension is set to unhandled
in this case.
There is however an inconsistency in the metrics framework. For server route:
pathLabeled("user" / JavaUUID, "user/:user-id") { userId =>
failWith(new Exception("ERROR!"))
}
Path dimension is /user/723abce0-9263-4dad-80a6-4eb7002a86da
which is unwanted. Must be replaced by unhandled
for consistency
from akka-http-metrics.
Related Issues (20)
- Error in stage [fr.davit.akka.http.metrics.core.MeterStage$$anon$1-MeterStage]: No value present HOT 10
- Create grafana dashboard HOT 1
- Hiding metrics route from scrapping HOT 4
- Extension methods from HttpMetrics break Http().newServerAt HOT 5
- Add a method bindFlow(handler: Flow[I,O,Mat]) to HttpMetricsServerBuilder HOT 2
- Getting error when using bindFlow : `.Error in stage [fr.davit.akka.http.metrics.core.MeterStage$$anon$1-MeterStage]: No value present HOT 2
- akka grpc
- 5xx and 4xx responses go to unlabelled when handled with AKKA `ExecutionDirectives.handleExceptions`
- Request/response headers as metric dimensions HOT 2
- Add directive to provide custom dimensions HOT 7
- Status and method labels are swapped in Prometheus metrics
- 1.7.0 not found in repos HOT 2
- bug: prometheus label issues in 1.7.0 HOT 8
- Support for Apache Pekko HOT 4
- StatusGroup / Path for requests? HOT 2
- No akka_http_responses_size_bytes_bucket for streamed endpoints
- Bug 1.4.0: java.lang.IllegalArgumentException: requirement failed: Responses with this status code must have an empty entity HOT 5
- Unable to get started with akk-http-metrics for scala Akka HTTP and prometheus. HOT 17
- Problem with big requests (>~100kb) HOT 9
- Instantiate HttpMetricsNames the same way as HttpMetricsSettings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akka-http-metrics.