Git Product home page Git Product logo

khs-spring-boot-api-statistics-starter's Introduction

khs-spring-boot-api-statistics-starter

A Spring Boot starter for publishing api statistics.

Description

This Spring Boot starter can be used to POST API usage statistics to a publishing target (url) on a configurable interval. The body of the request will be a JSON array of statistics (see schema below), and a security token can be applied to ensure that only authorized clients have access.

Installation

Add this dependency to your pom.xml:

<dependency>
	<groupId>com.keyholesoftware</groupId>
	<artifactId>khs-spring-api-statistics-starter</artifactId>
	<version>1.0.1</version>
</dependency>	

Annotate your Spring Boot main class:

@SpringBootApplication
@EnableApiStatistics
public class MySpringBootApp {

	public static void main(String[] args) {
		SpringApplication.run(MySpringBootApp.class, args);
	}
}

Configurable Properties: api.statistics.name - The name under which to group the published statistics api.statistics.pattern-match: A regex expression to filter API's in/out api.statistics.publish-url: The url to POST the statistics to api.statistics.token: A security token to prevent unwanted clients from POSTing stats to the publish-url

Example Configuration(s):

(i.e. application.yml)

api:
  statistics:
    name: apigateway
    pattern-match: /api/.*
    publish-url: http://beta.grokola.com/sherpa/api/stats/308
    token: 9x019749-XXXX-XXXX-XXXX-38090a0ea9g9

Example Payload:

[
  {
    uri: "/api/projects/1",
    method: "GET",
    duration: "19",
    service: "apigateway"
  },
  {
    uri: "/api/projects/1",
    method: "GET",
    duration: "16",
    service: "apigateway"
  },
  {
    uri: "/api/projects/2",
    method: "GET",
    duration: "14",
    service: "apigateway"
  }
  ...
]

khs-spring-boot-api-statistics-starter's People

Contributors

dpitt avatar jaimeniswonger avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

khs-spring-boot-api-statistics-starter's Issues

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.