Git Product home page Git Product logo

atlassian-metrics's People

Contributors

mortench3000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atlassian-metrics's Issues

Fixing missing IP numbers and removed docker-compose

  • I fixed the missing .17 IPs so they match the pictures.
  • I switched to not using compose, as everything isn't running from there anyway, so using plain docker is fine
  • I bugfixed the sed command, and git-ignored prometheus.yml that will be created by our guide and shouldn't be comitted containing secrets and thus should be in git ignore.

get_jira_issues_rest_endpoint.groovy will return the same results

Your current get_jira_issues_rest_endpoint.groovy script will return the exact same result over and over again. This is become the groovy script is compiled on initial load.

I discovered this in: https://community.atlassian.com/t5/Marketplace-Apps-questions/GET-REST-Endpoint-returning-cache-ed-results/qaq-p/899238#U899277

Therefore you need to refactor the .groovy script and move the query and results into the getStaledIssues method.

E.g.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

import org.apache.log4j.*
log.level = Level.ALL

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response

@BaseScript CustomEndpointDelegate delegate

// Prometheus Format
getStaledIssues( 
    httpMethod: "GET", groups: ["jira-administrators"]
) { MultivaluedMap queryParams, String body -> 
    def query = jqlQueryParser.parseQuery("project = TIS and assignee != \"admin\" and updated <= -7d and resolution is EMPTY")

    def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())

    log.debug("Total issues: ${results.total}")
    return Response.ok(new String("staled_issues_count" + " " + results.total)).build()
}

This will ensure getStaledIssues() returns an updated value each time the REST endpoint is accessed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.