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

Only track fresh starts of workspaces in workspace started metrics #686

Merged
merged 2 commits into from
Dec 6, 2021

Conversation

JPinkney
Copy link
Contributor

Signed-off-by: Josh Pinkney joshpinkney@gmail.com

What does this PR do?

This PR makes it so that when an already running workspace is reconciled we don't count that as a workspace start in the metrics

What issues does this PR fix or reference?

#618

Is it tested? How?

  1. Follow the metrics docs to run prometheus/grafana: https://github.com/devfile/devworkspace-operator/tree/main/doc/grafana.
  2. Create a devworkspace and wait for it to start oc apply -f samples/theia-next.yaml
  3. Observe that the workspace start metric was updated in grafana
  4. Change the devworkspace such that its reconciled (I tested by adding a postStart event into the devworkspace)
  5. Observe that the workspace started metric is not updated
  6. Scale the devworkspace down by setting started: false
  7. Scale the devworkspace up by setting started: true
  8. Observe that the devworkspace started metric is updated

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
}

func CurrentTime() string {
return strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is a rearrangement of what's already here, but it might make sense to do sometime line

Suggested change
return strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
return strconv.Itoa(time.Now().UnixNano()/time.Millisecond)

Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Dec 1, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, JPinkney

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@amisevsk
Copy link
Collaborator

amisevsk commented Dec 1, 2021

Well done, this looks like a frustrating one to figure out 😄

@JPinkney
Copy link
Contributor Author

JPinkney commented Dec 3, 2021

/test v8-devworkspace-operator-e2e

@JPinkney JPinkney merged commit 71b00cb into main Dec 6, 2021
@JPinkney JPinkney deleted the running-to-starting-metrics branch December 6, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants