-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add envoy stat_prefix support for httpproxy #5535
Conversation
Hi @therealak12! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace |
I prefer this to xref: #5539 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we think users will need to configure this per-route stat prefix? Is there any value in making this configurable? If not we can probably get away with just adding a boolean flag and configuring the stat prefix using some details of the Envoy (hashing the route match parameters for example) route to ensure uniqueness/ability to differentiate between different routes
In general this seems like it achieves what #4637 requires, an opt-in ability to signal Envoy to collect per-route upstream stats
This PR does something like what you've explained. |
I think it would be useful to modify that PR with a generated stat prefix that differentiates between different Envoy routes (maybe in addition to or instead of the existing stat prefix that differentiates between originating resources) and test it out with a couple different HTTPProxies/Ingresses/HTTPRoutes with multiple route rules (I would guess that using different stat prefixes could possibly expand the memory footprint that was analysed in #4637 as well, but would have to confirm to be sure) cc @izturn @wilsonwu from #4637 is the goal to see stats between different route matches (e.g. see the upstream stats for requests to /foo vs /bar), if so I don't think the existing PRs do so? |
@sunjayBhatia Please don't worry about the prefix section for now. It is just a temporary thing that I put in place to make the PoC work. I will improve the These are the stats for an httpproxy with the following spec: routes:
- conditions:
- prefix: /etc
permitInsecure: true
services:
- name: python-http-server
port: 8000
- conditions:
- prefix: /tmp
permitInsecure: true
services:
- name: python-http-server
port: 8000
virtualhost:
fqdn: some-random-path.apps.private.okd4.ts-2.staging-snappcloud.io It sets StatPrefix to a string built like this: fmt.Sprintf("%s_%s_%s_%s", httpRoute.GetNamespace(), "httproute", httpRoute.GetName(), r.PathMatchCondition.String()) |
this seems more usable and now does separate the stats for different route rules we'll have to figure out a stat prefix we can generate that can express uniqueness, but also can be used by an operator to figure out what route theyre looking at (e.g. not just an opaque hash) would love to get @izturn and @wilsonwu's thoughts since they originally requested this |
We had a conversation about the hash which I've replied here: It seems the 60 characters limit can be safely removed now, and then we'll have the full hostname available in the stats. |
One point to add here, It's not that trivial to include the There are various cases such as regex, exact, and prefix match. To distinguish between two routes, one having Besides, there are query and header match conditions too. A possible format for the stat_prefix would be:
where Although this supports all 3 match types, it doesn't count headers or query matches in. Trying to put those in the prefix makes it too complex and even useless. It would be nice if we agree on a format before going on. |
Yep agreed, especially as there can be multiple match conditions in a route and these conditions can be complex to serialize into a string that isnt incredibly long Some notes for discussion:
|
@therealak12 , thx for your pr, i am ok with it |
can you clarify a bit more @izturn how do you intend to use the new stats? specifically around the last bullet here: #5535 (comment) |
Sorry for the late reply, I think per route stats is enough for our current situation, if some use cases for per virtualhost, just calculated by metrics system is OK. |
@sunjayBhatia Sorry for the late reply, As @wilsonwu said, I think per route stats is enough for our use case |
As @sunjayBhatia pointed above, the per-route metrics are located at the highest level of the granularity pyramid:
So let's discuss whether per-virtualhost metrics is enough or if we should agree on a format for presenting per-route metrics. In our use case, we are happy with only including the Your valuable comment will be crucial in reaching the best decision. Thanks in advance. |
Thanks for these information, I our use case, we make envoy as an API gateway, so users pay more attention to the API, and as my early reply I thnk if we have per route metrics, the per virtualhost and per envoy metrics can be caculated be themselves, anyway, support per virtualhost metrics directly is better. |
@sunjayBhatia |
Signed-off-by: Ahmad Karimi <ak12hastam@gmail.com>
I've just made a change to address your comment. I'd appreciate it if you take a look. Thanks. |
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Thanks for the PR @therealak12, I'am also very much interested by this feature. |
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Thankyou for the PR, and have been waiting for a while now, we would be happy to test / provide initial feedback if reqd. |
any progress? |
The Contour project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to the #contour channel in the Kubernetes Slack |
Going to close the PR. |
This pull request addresses issue#4637.
I'm not sure if this is a perfect implementation but I thought receiving feedback could help me implement it more properly.
Currently it adds a field in the envoy stanza of contour configuration, which, if set, will also be set in the envoy route config.
Another possible implementation would be to add a field to HTTPProxy spec, allowing users to set different
StatPrefix
es per route.Also, as a third way to implement, we can set
resource.name._resource.kind_resource.namespace
as the stat_prefix!