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

Feat/openapi generation #4

Merged
merged 10 commits into from
Oct 25, 2023
Merged

Feat/openapi generation #4

merged 10 commits into from
Oct 25, 2023

Conversation

niklastreml
Copy link
Collaborator

@niklastreml niklastreml commented Oct 24, 2023

Motivation

Implements dynamic openapi schemas based on the registered checks

Concept

I have added a new method Schema() to the check interface which has to return an OpenAPI schema of the Result including its metrics type as the data attribute. To make this easier and less prone to errors, a helper function is also provided. An example of how to implement this can be found in the roundtrip check.

Below is a sample of what is generated by sparrow:

openapi: 3.0.0
components: {}
info:
    title: Sparrow Metrics API
    description: Serves metrics collected by sparrows checks
    contact:
        name: CaaS Team
        url: https://caas.telekom.de
        email: [email protected]
    version: ""
paths:
    /v1/metrics/rtt:
        description: rtt
        get:
            tags:
                - Metrics
                - rtt
            description: Returns the performance data for check rtt
            responses:
                "200":
                    description: Metrics for check rtt
                    content:
                        application/json:
                            schema:
                                type: object
                                properties:
                                    data:
                                        type: object
                                        properties:
                                            ms:
                                                type: integer
                                                format: int64
                                    error:
                                        type: string
                                    timestamp:
                                        type: string
                                        format: date-time

Changes

  • Feat: Added a schema method to check interface
  • Feat: Added an Openapi() method to sparrow
  • Misc: Added a debug config for vscode
  • Feat: Added a helper to turn check metrics into openapi schemas

Tests done

  • Created unit tests for all added logic

TODO

  • I've assigned this PR to myself
  • I've labeled this PR correctly
  • Rebase from main

@niklastreml niklastreml added the feature Introduces a new feature label Oct 24, 2023
@niklastreml niklastreml self-assigned this Oct 24, 2023
@niklastreml niklastreml added this to the 1.0 milestone Oct 24, 2023
@niklastreml niklastreml requested a review from y-eight October 24, 2023 11:24
@niklastreml niklastreml removed this from the 1.0 milestone Oct 24, 2023
Copy link
Member

@y-eight y-eight left a comment

Choose a reason for hiding this comment

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

reviewed & refactored together... LGTM

@niklastreml niklastreml merged commit a8b4655 into main Oct 25, 2023
1 check passed
@lvlcn-t lvlcn-t deleted the feat/openapi-generation branch November 8, 2023 13:56
lvlcn-t pushed a commit that referenced this pull request Jan 29, 2024
* feat: added workflow to prune old images (#1)

* fix: added runs-on variable (#2)

* feat: trying new regex (#3)

* fix: trying commit as expression (#4)

* fix: trying keep tags (#5)

* beingtoospecific (#6)

* fix: regex expression fixed (#7)

* fix: new regex (#8)

* Test (#9)

* fix: new regex

* test

* fix: fixed regex hopefully (#10)

* fix: pruning snapshots (#11)

* feat: added new workflow to prune old images for packages sparrow and charts/sparrow

* fix: removed keep-last conditions

* fix: removed comments

* fix: removed unnecessary permission declaration

* fix: removed dry-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants