Skip to content

Conversation

@Ashish-devtron
Copy link
Contributor

@Ashish-devtron Ashish-devtron commented Mar 15, 2023

Description

Show the timer/counter metrics forGitOps using Prometheus.

Fixes #https://dev.azure.com/DevtronLabs/Devtron/_workitems/edit/2314
Github issue: #3022

How Has This Been Tested?

  • Tested locally by hitting requests.

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?

Copy link
Contributor

Choose a reason for hiding this comment

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

use defered properly

util/helper.go Outdated

func TriggerGitOpsMetrics(operation string, method string, startTime time.Time, err error) {
if err != nil {
middleware.GitOpsDuration.WithLabelValues(operation, method, "Failed", fmt.Sprintf("%v", startTime.Format("Mon, 02 Jan 2006 15:04:05 MST"))).Observe(time.Since(startTime).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

refactor this properly

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Ashish-devtron Ashish-devtron merged commit 6cf9c9e into main Mar 22, 2023
@Ashish-devtron Ashish-devtron deleted the add-telemetry-to-gitops branch March 22, 2023 09:41
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