Skip to content

agoda-com/dev-local-api-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Metrics Collector API: Because Numbers Are Fun!

Welcome to the Metrics Collector API, where we turn your development chaos into beautiful, orderly data. This repository contains the OpenAPI specification for an API that's more excited about collecting metrics than your cat is about knocking things off tables.

What's This All About?

Ever wondered how long your builds really take, or if your tests are secretly planning a rebellion? Well, wonder no more! This API specification defines endpoints to collect all sorts of juicy development metrics, from build times to test execution durations. It's like FitBit, but for your code!

Getting Started (or "How to Make Your Computer Do the Hard Work")

  1. Clone this repo (you know the drill)
  2. Pick your favorite code generator
  3. Generate some server-side code
  4. Implement your data storage
  5. Deploy your API

Choosing a Code Generator

There are more code generators out there than flavors of La Croix. Here are a few popular ones:

  • OpenAPI Generator (the Swiss Army knife of generators)
  • Swagger Codegen (old but gold)
  • NSwag (for when you're feeling fancy)

We'll use OpenAPI Generator in our examples because we're basic like that.

Generating Server-Side Code

Time to make your computer earn its keep:

  1. Install OpenAPI Generator (follow their instructions, we believe in you)

  2. Run the generator. For example, to generate a Spring Boot server:

    openapi-generator generate -i openapi.yaml -g spring -o ./generated-server
    

    Replace spring with your language of choice. Go wild! (But stick to the supported ones, we're not magicians.)

  3. Marvel at the generated code in ./generated-server. It's not Shakespeare, but it'll do.

Implementing Data Storage

Now for the fun part: making those generated interfaces actually do something! Here's a taste of what you're in for:

@Service
public class DotnetServiceImpl implements DotnetApiDelegate {

    @Autowired
    private YourDataStorageService dataStorage;

    @Override
    public ResponseEntity<Void> dotnetCollectData(DotnetMsBuild dotnetMsBuild) {
        // Your logic here. Try not to cry.
        dataStorage.storeBuildMetrics(dotnetMsBuild);
        return ResponseEntity.ok().build();
    }
}

Deploying Your API

Choose your deployment method. Docker? Serverless? Carrier pigeon? The world is your oyster. (Note: carrier pigeon method not recommended for high-traffic APIs.)

Contributing

Found a bug? Have an idea? We're all ears! Submit a pull request and join the "I improved an open-source project" club. Membership cards pending.

License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details. It's very riveting reading, we promise.

Remember, with great metrics comes great responsibility. Happy collecting!

About

Developer Local API Spec

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published