Skip to content
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

Simplify interpretation of produced metrics #23

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Izzette
Copy link
Collaborator

@Izzette Izzette commented Feb 6, 2024

  • Dramatically change data scheam:
    • Add pre-computed phase durations.
    • Clearer more consistent naming (hopefully).
  • Introduce JSON specs for metric output.
  • Fixed tests.
  • Added tests to validate the JSON schema.
  • Generate documentation directly from the JSON schema using json-schema-for-humans.
  • Generate documentation in the CI / pre-commit.

TODO:

  • It would be useful to include a partial: true/false attribute and emit this with true only once when the pod becomes ready or is deleted before it becomes ready. This will allow aggregations based on the data to avoid having duplicate partial datapoints resulting in skewed distributions depending on how many events were received before the "final state" was achieved. This may be better to do in a different PR.

* Add pre-computed phase durations

* Introduce JSON specs for metric output
@Izzette Izzette marked this pull request as draft February 6, 2024 14:17
@@ -46,32 +50,68 @@ func (cs containerStatistic) logger() zerolog.Logger {
Logger()
}

func (cs containerStatistic) appendInitFields(event *zerolog.Event) {
if !cs.runningTimestamp.IsZero() && cs.previous != nil && !cs.previous.readyTimestamp.IsZero() {

Choose a reason for hiding this comment

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

cs.runningTimeStamp is always != nil ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, it's a time.Time not a pointer to time.Time so it's the time.Time zero value until set, which is—I believe—the unix epoch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So yes technically this code won't work before 1970

Choose a reason for hiding this comment

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

(it was a joke, happy to see that someone read my comment 😀 )

Comment on lines +90 to +91
// Instead, readiness represents the time an init container has excited successfully,allowing the following containers
// to proceed.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
// Instead, readiness represents the time an init container has excited successfully,allowing the following containers
// to proceed.
// Instead, readiness represents the time until an init container has exited successfully, allowing the following
// containers to proceed.

@Izzette Izzette marked this pull request as ready for review June 8, 2024 09:29
writer http.ResponseWriter,
req *http.Request,
) {
startTime := time.Now()
logger := c.logger()

responseLogger := &responseLogger{responseWriter: writer}
responseLogger := &httpResponseLogger{responseWriter: writer}
Copy link

Choose a reason for hiding this comment

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

In the context of ServeHTTP method, an http prefix can be skipped IMHO

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.

3 participants