Skip to content

feat: metrics - #188

Merged
AlexsJones merged 22 commits into
mainfrom
feat/metrics
Oct 11, 2022
Merged

AlexsJones merged 22 commits into
mainfrom
feat/metrics

Conversation

@AlexsJones

@AlexsJones AlexsJones commented Oct 5, 2022 •

Copy link
Copy Markdown
Member

This pull request adds prometheus metrics into the connect service using a custom library ( go-http-metrics)

( I decided not to go with custom gauges and counters but to use the http-metrics lib )

An example of the metrics we are able to leverage through http/https/grpc

http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.005"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.01"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.025"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.05"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.1"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.25"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="0.5"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="2.5"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="5"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="10"} 3
http_request_duration_seconds_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="+Inf"} 3
http_request_duration_seconds_sum{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service=""} 0.0008348739999999999
http_request_duration_seconds_count{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service=""} 3
# HELP http_requests_inflight The number of inflight requests being handled at the same time.
# TYPE http_requests_inflight gauge
http_requests_inflight{handler="/schema.v1.Service/ResolveString",service=""} 0
# HELP http_response_size_bytes The size of the HTTP responses.
# TYPE http_response_size_bytes histogram
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="100"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1000"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="10000"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="100000"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1e+06"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1e+07"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1e+08"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="1e+09"} 3
http_response_size_bytes_bucket{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service="",le="+Inf"} 3
http_response_size_bytes_sum{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service=""} 162
http_response_size_bytes_count{code="200",handler="/schema.v1.Service/ResolveString",method="POST",service=""} 3

The advantage here is when this is scrapped we can perform some interesting queries

sum(
    rate(http_request_duration_seconds_count[30s])
) by (handler)

@AlexsJones AlexsJones changed the title Feat/metrics feat: metrics Oct 5, 2022

@beeme1mr beeme1mr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you have a rough idea about what kind of overhead this will introduce? What do you think about providing the ability to either explicitly enable or disable it?

Comment thread cmd/start.go Resolved
Comment thread cmd/start.go Resolved
Comment thread docs/configuration.md Resolved
Comment thread pkg/service/connect_metrics.go Resolved
AlexsJones and others added 18 commits October 10, 2022 19:34
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Co-authored-by: Michael Beemer <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
@AlexsJones
AlexsJones requested a review from beeme1mr October 11, 2022 07:23
Signed-off-by: Alex Jones <[email protected]>
@AlexsJones
AlexsJones merged commit 6b3b611 into main Oct 11, 2022
@AlexsJones
AlexsJones deleted the feat/metrics branch October 11, 2022 11:22
raphael-wigoutschnigg-dt pushed a commit to open-feature-forking/flagd that referenced this pull request Mar 11, 2025
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants