Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Conversation

alepuccetti
Copy link

This metric shows in the UI the HTTP responses codes rate for those codes that are seen in the time interval where Scope UI shows historical data.

For convenience, I added the build-tools and the circle.yml to use cricleci and dockerhub.

This PR is rebased on #1

@2opremio PTAL

@alepuccetti alepuccetti force-pushed the alessandro/responses branch 2 times, most recently from f50d398 to a0d27c2 Compare October 18, 2016 09:56
@alepuccetti
Copy link
Author

@2opremio This should be good to go too.

README.md Outdated
Weave Scope UI shows this information as single value and graph which are updated every second.
The single value is the latest value measured, while the graph is the historical representation of recents values.

### HTTP Responses Codes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Responses/Response/

README.md Outdated
@@ -1,29 +1,64 @@
# Scope HTTP Statistics Plugin

The Scope HTTP Statistics plugin provide to the [Weave Scope](https://github.com/weaveworks/scope) user statistics about HTTP traffic at the process level using eBPF, as of now only the number of HTTP requests are collected.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try to use a simpler phrasing? (sorry, I missed this in a prior review)

@alepuccetti
Copy link
Author

@2opremio Updated

# Aggregate the kernel's per-task http request counts into userland's
# per-process counts
req_count_table = self.bpf.get_table(EBPF_TABLE_NAME)
req_count_table = self.bpf.get_table(EBPF_TABLE_REQUESTS_RATE_NAME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/TABLE_REQUESTS_RATE/REQUEST_RATE_TABLE/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose I should do also.
s/EBPF_TABLE_RESPONSES_CODE_NAME/EBPF_RESPONSE_CODE_TABLE_NAME/g

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please

};

/* HTTP responses look like "HTTP/1.1 XXX". We only need to read the first 12 characters */
#define HTTP_CODE_MSG_LEN 12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the same for kprobe__skb_copy_datagram_iter ? (we read 7 characters)

override:
- echo "no dependencies"

test:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test to verify that the ebpf code compiles?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is difficult because the ebpf code is compiled at run-time and not at circleCI time. Could further tests be added later in another PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@2opremio ebpf compilation test issue tracked via #3

@2opremio
Copy link
Contributor

LGTM (comments-aside). If possible I would like alban to sign-off the ebpf code (I am still a newbie myself).

@alban
Copy link

alban commented Oct 19, 2016

I reviewed the ebpf code before and it LGTM.

Alessandro Puccetti added 6 commits October 19, 2016 13:46
This patch adds the new HTTP responses codes metric. The eBPF program searches into the buffer the string `HTTP/1.1 XXX`, where XXX is the 3 digits HTTP response code. The statistics are exposed to Weave Scope using the report interface. `tcp_sendmsg()` invokes `copy_from_iter()` multiple times to copy data from the iovec. We inspect the data (`addr`) passed to `copy_from_iter()` only for its first invocation. This limitation does not impact significantly the metric because is very unlikely that a response code is splitted in multiple iovec or is not at the beginning of the first iovec's element. Codes tracked: - 100: Continue - 200: OK - 201: Created - 202: Accepted - 204: No Content - 308: Permanent Redirect Redirect - 400: Bad Request - 401: Unauthorized - 403: Forbidden - 404: Not Found - 408: Request Timeout - 451: Unavailable For Legal Reasons - 500: Internal Server Error - 501: Not Implemented - 502: Bad Gateway - 503: Service Unavailable
This patch explains better HTTP Requests metrics and adds the description for HTTP Responses Codes metrics.
Use tabs, and proper comments formatting.
DockerHub does not allow the organization name to have dashes
This patch fixes a bug in computing the HTTP response metrics priority. Using `http_code` to compute the priority fails when the code is mapped to `OTHERS`.
Alessandro Puccetti added 2 commits October 19, 2016 13:48
git-subtree-dir: tools git-subtree-split: b990f488bdc7909b62d9245bc4b4caf58f5ae7ea
@alepuccetti
Copy link
Author

@2opremio I addressed your comments and I also fixed a bug.

@alepuccetti
Copy link
Author

This PR is relevant to weaveworks/scope#1631

@2opremio
Copy link
Contributor

This is good to go (as per my previous comment). @alepuccetti feel free to merge away!

@alepuccetti alepuccetti merged commit 3e05621 into weaveworks-plugins:master Oct 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants