-
Notifications
You must be signed in to change notification settings - Fork 58
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
poc: a metrics module for pebble #519
Draft
IronCore864
wants to merge
18
commits into
canonical:master
Choose a base branch
from
IronCore864:poc-custom-metrics-lib
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+518
−40
Draft
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f76470c
poc: a metrics module for pebble
IronCore864 6d8ee59
chore: undo unnecessary change
IronCore864 b4abc9a
chore: undo unnecessary change
IronCore864 a274276
chore: undo unnecessary change
IronCore864 a2c07e6
chore: metrics identity basic auth poc
IronCore864 4ebb633
chore: a poc for metrics with labels
IronCore864 7468b95
poc: remove adding identities using env vars according to comment in …
IronCore864 790a8f9
chore: update tests for the metrics lib poc
IronCore864 272005b
chore: refactor identities and access according to spec review
IronCore864 5be3e96
feat: use sha512 to verify password
IronCore864 a6c374d
feat: move the metrics api to /v1/metrics
IronCore864 1bd54cb
chore: remove Username from apiBasicIdentity
IronCore864 98ea11e
chore: revert changes on user state
IronCore864 68c18b7
Merge branch 'master' into poc-custom-metrics-lib
IronCore864 7fc255e
chore: fix failed identity tests
IronCore864 31a0617
test: unit tests for basic identity
IronCore864 a57f041
chore: rework the metrics for services
IronCore864 b7a442f
chore: add metrics for checks, not done
IronCore864 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2024 Canonical Ltd | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License version 3 as | ||
// published by the Free Software Foundation. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package daemon | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/canonical/pebble/internals/metrics" | ||
) | ||
|
||
func Metrics(c *Command, r *http.Request, _ *UserState) Response { | ||
return metricsResponse{} | ||
} | ||
|
||
// metricsResponse is a Response implementation to serve the metrics in a prometheus metrics format. | ||
type metricsResponse struct{} | ||
|
||
func (r metricsResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) { | ||
registry := metrics.GetRegistry() | ||
w.WriteHeader(http.StatusOK) | ||
w.Write([]byte(registry.GatherMetrics())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
WriteHeader
is implicit and usually omitted if the status is OK.