diff --git a/.github/workflows/watch.yml b/.github/workflows/watch.yml index 5c32744..d172c08 100644 --- a/.github/workflows/watch.yml +++ b/.github/workflows/watch.yml @@ -30,7 +30,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} XDG_CACHE_HOME: ${{ github.workspace }}/build/cache HTDOCS_DIR: ${{ github.workspace }}/build/htdocs - BUILD_DIR: ${{ github.workspace }}/build + API_DIR: ${{ github.workspace }}/build/htdocs/api/v1 outputs: changed: ${{ steps.generate.outputs.changed }} steps: @@ -77,12 +77,14 @@ jobs: env: GITHUB_TOKEN: ${{github.token}} run: > + mkdir -p ${API_DIR} + k6registry -v --lint --ref "${BASE_URL}/registry.json" - registry.yaml --out "${HTDOCS_DIR}/registry.json" + registry.yaml --out "${API_DIR}/registry.json" - ./generate-api-files.sh -b "${HTDOCS_DIR}" + ./generate-api-files.sh -b "${API_DIR}" - name: Cache Clean if: ${{ ( github.ref_name == 'main' && steps.generate.outputs.changed == 'true' ) || inputs.force_changed }} @@ -148,6 +150,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HTDOCS_DIR: ${{ github.workspace }}/htdocs + API_DIR: ${{ github.workspace }}/build/htdocs/api/v1 WIKI_WORK_DIR: ${{ github.workspace }}/wiki.work steps: - name: Checkout @@ -176,7 +179,11 @@ jobs: - name: Generate run: | rm -rf ${WIKI_WORK_DIR}/* - gomplate -c registry=${HTDOCS_DIR}/registry.json -c metrics=${HTDOCS_DIR}/metrics.json -c official_metrics=${HTDOCS_DIR}/tier/official-metrics.json -c schema=registry.schema.json --input-dir wiki --output-map="${WIKI_WORK_DIR}/{{.in|strings.TrimSuffix \".tpl\"}}" + gomplate -c registry=${API_DIR}/registry.json \ + -c metrics=${API_DIR}/metrics.json \ + -c official_metrics=${API_DIR}/tier/official-metrics.json \ + -c schema=registry.schema.json --input-dir wiki \ + --output-map="${WIKI_WORK_DIR}/{{.in|strings.TrimSuffix \".tpl\"}}" - name: Push run: | cd ${WIKI_WORK_DIR} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b442b2..b2f248a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,7 +60,7 @@ mv public/schema/registry.schema.html public/schema/index.html The registry is exposed using and API defined in [openapi.yaml]. This API is served using static files generated from the registry using the [generate-api-files.sh] script. The script takes the registry.json generated from [registry.yaml] using `k6registry` as input to generate the json file to be returned by each endpoint. It also generates a metrics.txt file with metrics for the extensions by tier, grade, and issues found. ```bash -BUILD_DIR=build +export BUILD_DIR=build/api/v1 k6registry registry.yaml > ${BUILD_DIR}/registry.json ./generate-api-files.sh -b ${BUILD_DIR} ``` @@ -68,7 +68,7 @@ k6registry registry.yaml > ${BUILD_DIR}/registry.json Generates the following files ```ascii -build/ +build/api/v1 ├── catalog.json ├── metrics.json ├── metrics.txt @@ -121,8 +121,6 @@ build/ ```bash export BASE_URL=https://registry.k6.io -curl -s -o build/registry.json $BASE_URL/registry.json -curl -s -o build/metrics.json $BASE_URL/metrics.json -curl -s -o build/official-metrics.json $BASE_URL/tier/official-metrics.json -gomplate -c registry=build/registry.json -c metrics=build/metrics.json -c official_metrics=build/tier/official-metrics.json -c schema=registry.schema.json --input-dir wiki --output-map='build/wiki/{{.in|strings.TrimSuffix ".tpl"}}' +export API_DIR=build/api/v1 +gomplate -c registry=${API_DIR}/registry.json -c metrics=${API_DIR}/metrics.json -c official_metrics=${API_DIR}/tier/official-metrics.json -c schema=registry.schema.json --input-dir wiki --output-map='build/wiki/{{.in|strings.TrimSuffix ".tpl"}}' ``` diff --git a/openapi.yaml b/openapi.yaml index 0f4174b..a3ba908 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,6 +1,6 @@ openapi: "3.1.0" info: - version: "0.1.0" + version: "1.0.0" title: Grafana k6 Extension Registry Service summary: Query the Grafana k6 Extension Registry database. description: | @@ -26,6 +26,7 @@ info: externalDocs: description: Find out more about Grafana k6 extensions url: https://grafana.com/docs/k6/latest/extensions/ +basePath: "/api/v1" servers: - url: https://registry.k6.io tags: diff --git a/public/index.html b/public/index.html index d23dbb1..26673c0 100644 --- a/public/index.html +++ b/public/index.html @@ -376,7 +376,7 @@ -

Grafana k6 Extension Registry Service (0.1.0)

Download OpenAPI specification:

Grafana k6 Extension Registry Service (1.0.0)

Download OpenAPI specification:

Query the Grafana k6 Extension Registry database.

Download the entire registry as a single JSON file

Responses

Response samples

Content type
application/json
[
  • {
    }
]

module

Response samples

Content type
application/json
[
  • {
    }
]

module

Query a specific extension

Query an extension

Query the data of a specific extension as a single JSON file

@@ -428,7 +428,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

Response samples

Content type
application/json
{
  • "module": "github.com/grafana/xk6-dashboard",
  • "imports": [
    ],
  • "outputs": [
    ],
  • "description": "This is a very cool extension, it displays the message 'Hello World!'",
  • "versions": [
    ],
  • "cgo": false,
  • "constraints": [
    ],
  • "repo": {},
  • "tier": "community",
  • "compliance": {
    }
}

Download a badge

Response samples

Content type
application/json
{
  • "module": "github.com/grafana/xk6-dashboard",
  • "imports": [
    ],
  • "outputs": [
    ],
  • "description": "This is a very cool extension, it displays the message 'Hello World!'",
  • "versions": [
    ],
  • "cgo": false,
  • "constraints": [
    ],
  • "repo": {},
  • "tier": "community",
  • "compliance": {
    }
}

Download a badge

Download an extension's badge as an SVG image

@@ -440,7 +440,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

Download a grade badge

Download a grade badge

Download an extension's grade badge as an SVG image

@@ -452,13 +452,13 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

catalog

catalog

Extension catalog queries

Entire catalog

Download the entire catalog as a single JSON file

Responses

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

Catalog by support

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

Catalog by support

Query the catalog containing extensions available with a given support.

path Parameters
tier
required
string (tier)
Enum: "official" "community"
Examples:
  • official -
  • community -

tier to be queried

@@ -466,15 +466,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

Catalog by min support

Query the catalog containing extensions available with at least the support specified as a parameter.

-
path Parameters
tier
required
string (tier)
Enum: "official" "community"
Examples:
  • official -
  • community -

tier to be queried

-

Responses

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

subset

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

subset

Query subsets of the registry

Subset by support

Querying the subset of the registry containing the extensions with support specified in the parameter

@@ -484,15 +476,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

Response samples

Content type
application/json
[
  • {
    }
]

Subset by min support

Query the subset of the registry that contains the extensions whose support is at least the level specified as a parameter.

-
path Parameters
tier
required
string (tier)
Enum: "official" "community"
Examples:
  • official -
  • community -

tier to be queried

-

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Subset by grade

Response samples

Content type
application/json
[
  • {
    }
]

Subset by grade

Querying the subset of the registry containing the extensions with the compliance grade specified in the parameter

path Parameters
grade
required
string (grade)
Enum: "A" "B" "C" "D" "E" "F" "G"
Examples:
  • A -
  • C -

grade to be queried

@@ -500,25 +484,17 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

successful operation

Response samples

Content type
application/json
[
  • {
    }
]

Subset by min grade

Querying the subset of the registry containing extensions with at least compliance grade specified in the parameter

-
path Parameters
grade
required
string (grade)
Enum: "A" "B" "C" "D" "E" "F" "G"
Examples:
  • A -
  • C -

grade to be queried

-

Responses

Response samples

Content type
application/json
[
  • {
    }
]

metrics

Response samples

Content type
application/json
[
  • {
    }
]

metrics

Registry metrics queries

Registry metrics

Download the registry metrics as a single JSON file

Responses

Response samples

Content type
application/json
"{\n \"cgo_count\": 1,\n \"extension_count\": 72,\n \"grade_a_count\": 19,\n \"grade_b_count\": 4,\n \"grade_c_count\": 44,\n \"grade_d_count\": 4,\n \"grade_e_count\": 1,\n \"issue_build_count\": 5,\n \"issue_codeowners_count\": 5,\n \"issue_examples_count\": 16,\n \"issue_replace_count\": 2,\n \"issue_smoke_count\": 51,\n \"issue_types_count\": 44,\n \"product_cloud_count\": 4,\n \"product_oss_count\": 71,\n \"product_synthetic_count\": 2,\n \"tier_community_count\": 54,\n \"tier_official_count\": 18,\n \"type_javascript_count\": 57,\n \"type_output_count\": 16\n}\n"

Registry metrics in Prometheus text format.

Response samples

Content type
application/json
"{\n \"cgo_count\": 1,\n \"extension_count\": 72,\n \"grade_a_count\": 19,\n \"grade_b_count\": 4,\n \"grade_c_count\": 44,\n \"grade_d_count\": 4,\n \"grade_e_count\": 1,\n \"issue_build_count\": 5,\n \"issue_codeowners_count\": 5,\n \"issue_examples_count\": 16,\n \"issue_replace_count\": 2,\n \"issue_smoke_count\": 51,\n \"issue_types_count\": 44,\n \"product_cloud_count\": 4,\n \"product_oss_count\": 71,\n \"product_synthetic_count\": 2,\n \"tier_community_count\": 54,\n \"tier_official_count\": 18,\n \"type_javascript_count\": 57,\n \"type_output_count\": 16\n}\n"

Registry metrics in Prometheus text format.

Download the registry metrics as a single TXT file in Prometheus text format

Responses

Response samples

Content type
text/plain
# HELP registry_tier_official_count Number of extensions in the 'official' tier.
+

Response samples

Content type
text/plain
# HELP registry_tier_official_count Number of extensions in the 'official' tier.
 # TYPE registry_tier_official_count counter
 registry_tier_official_count 14 1733941259568
 # HELP registry_type_javascript_count Number of JavaScript extension.
@@ -573,9 +549,9 @@
 " class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Download the registry metrics for tier as a single JSON file

Responses

Response samples

Content type
application/json
"{\n \"cgo_count\": 1,\n \"extension_count\": 72,\n \"grade_a_count\": 19,\n \"grade_b_count\": 4,\n \"grade_c_count\": 44,\n \"grade_d_count\": 4,\n \"grade_e_count\": 1,\n \"issue_build_count\": 5,\n \"issue_codeowners_count\": 5,\n \"issue_examples_count\": 16,\n \"issue_replace_count\": 2,\n \"issue_smoke_count\": 51,\n \"issue_types_count\": 44,\n \"product_cloud_count\": 4,\n \"product_oss_count\": 71,\n \"product_synthetic_count\": 2,\n \"tier_community_count\": 54,\n \"tier_official_count\": 18,\n \"type_javascript_count\": 57,\n \"type_output_count\": 16\n}\n"
+

Response samples

Content type
application/json
"{\n \"cgo_count\": 1,\n \"extension_count\": 72,\n \"grade_a_count\": 19,\n \"grade_b_count\": 4,\n \"grade_c_count\": 44,\n \"grade_d_count\": 4,\n \"grade_e_count\": 1,\n \"issue_build_count\": 5,\n \"issue_codeowners_count\": 5,\n \"issue_examples_count\": 16,\n \"issue_replace_count\": 2,\n \"issue_smoke_count\": 51,\n \"issue_types_count\": 44,\n \"product_cloud_count\": 4,\n \"product_oss_count\": 71,\n \"product_synthetic_count\": 2,\n \"tier_community_count\": 54,\n \"tier_official_count\": 18,\n \"type_javascript_count\": 57,\n \"type_output_count\": 16\n}\n"