mirror of
https://github.com/prometheus/prometheus.git
synced 2026-02-03 20:39:32 -05:00
* Add OpenAPI 3.2 specification generation for Prometheus HTTP API This commit introduces an OpenAPI specification for the Prometheus API. After testing multiple code-generation servers with built-in APIs, this implementation uses an independent spec file outside of the critical path. This spec file is tested with a framework present in this pull request. The specification helps clients know which parameters they can use and is served at /api/v1/openapi.yaml. The spec file will evolve with the Prometheus API and has the same version number. Downstream projects can tune the APIs presented in the spec file with configuration options using the IncludePaths setting for path filtering. In the future, there is room to generate a server from this spec file (e.g. with interfaces), but this is out of scope for this pull request. Architecture: - Core OpenAPI infrastructure (openapi.go): Dynamic spec building, caching, and thread-safe spec generation - Schema definitions (openapi_schemas.go): Complete type definitions for all API request and response types - Path specifications (openapi_paths.go): Endpoint definitions with parameters, request bodies, and response schemas - Examples (openapi_examples.go): Realistic request/response examples - Helper functions (openapi_helpers.go): Reusable builders for common OpenAPI structures Testing: - Comprehensive test suite with golden file validation - Test helpers package for API testing infrastructure - OpenAPI compliance validation utilities The golden file captures the complete specification for snapshot testing. Update with: go test -run TestOpenAPIGolden -update-openapi-spec REVIEWERS: The most important thing to check would be the OpenAPI golden file (web/api/v1/testdata/openapi_golden.yaml). Test scenarios are important as they test the actual OpenAPI spec validity. Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> * Add OpenAPI 3.1 support with version selection Add support for both OpenAPI 3.1 and 3.2 specifications with version selection via openapi_version query parameter. Defaults to 3.1 for broader compatibility Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> * Enhance OpenAPI examples and add helper functions - Add timestampExamples helper for consistent time formatting - Add exampleMap helper to simplify example creation - Improve example summaries with query details - Add matrix result example for range vector queries Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> * web/api: Add AtST method to test helper iterators Implement the AtST() method required by chunkenc.Iterator interface for FakeSeriesIterator and FakeHistogramSeriesIterator test helpers. The method returns 0 as these test helpers don't use start timestamps Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> * OpenAPI: Add minimum coverage test Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> * OpenAPI: Improve examples handling Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> --------- Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
112 lines
5.4 KiB
Modula-2
112 lines
5.4 KiB
Modula-2
module github.com/prometheus/prometheus/internal/tools
|
|
|
|
go 1.25.0
|
|
|
|
require (
|
|
github.com/bufbuild/buf v1.62.1
|
|
github.com/daixiang0/gci v0.13.7
|
|
github.com/gogo/protobuf v1.3.2
|
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4
|
|
)
|
|
|
|
require (
|
|
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.11-20250718181942-e35f9b667443.1 // indirect
|
|
buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.11-20250109164928-1da0de137947.1 // indirect
|
|
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20251209175733-2a1774d88802.1 // indirect
|
|
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20251202164234-62b14f0b533c.2 // indirect
|
|
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.11-20251202164234-62b14f0b533c.1 // indirect
|
|
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.11-20241007202033-cf42259fcbfc.1 // indirect
|
|
buf.build/go/app v0.2.0 // indirect
|
|
buf.build/go/bufplugin v0.9.0 // indirect
|
|
buf.build/go/bufprivateusage v0.1.0 // indirect
|
|
buf.build/go/interrupt v1.1.0 // indirect
|
|
buf.build/go/protovalidate v1.1.0 // indirect
|
|
buf.build/go/protoyaml v0.6.0 // indirect
|
|
buf.build/go/spdx v0.2.0 // indirect
|
|
buf.build/go/standard v0.1.0 // indirect
|
|
cel.dev/expr v0.25.1 // indirect
|
|
connectrpc.com/connect v1.19.1 // indirect
|
|
connectrpc.com/otelconnect v0.8.0 // indirect
|
|
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
|
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
|
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
|
github.com/bufbuild/protocompile v0.14.2-0.20251223142729-db46c1b9d34e // indirect
|
|
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1 // indirect
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/cli/browser v1.3.0 // indirect
|
|
github.com/containerd/errdefs v1.0.0 // indirect
|
|
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
|
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
|
|
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
|
|
github.com/distribution/reference v0.6.0 // indirect
|
|
github.com/docker/cli v29.1.3+incompatible // indirect
|
|
github.com/docker/distribution v2.8.3+incompatible // indirect
|
|
github.com/docker/docker v28.5.2+incompatible // indirect
|
|
github.com/docker/docker-credential-helpers v0.9.4 // indirect
|
|
github.com/docker/go-connections v0.6.0 // indirect
|
|
github.com/docker/go-units v0.5.0 // indirect
|
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
|
github.com/go-chi/chi/v5 v5.2.3 // indirect
|
|
github.com/go-logr/logr v1.4.3 // indirect
|
|
github.com/go-logr/stdr v1.2.2 // indirect
|
|
github.com/gofrs/flock v0.13.0 // indirect
|
|
github.com/google/cel-go v0.26.1 // indirect
|
|
github.com/google/go-containerregistry v0.20.7 // indirect
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
github.com/hexops/gotextdiff v1.0.3 // indirect
|
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
|
github.com/jdx/go-netrc v1.0.0 // indirect
|
|
github.com/klauspost/compress v1.18.2 // indirect
|
|
github.com/klauspost/pgzip v1.2.6 // indirect
|
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
github.com/moby/docker-image-spec v1.3.1 // indirect
|
|
github.com/moby/term v0.5.2 // indirect
|
|
github.com/morikuni/aec v1.1.0 // indirect
|
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
|
github.com/opencontainers/image-spec v1.1.1 // indirect
|
|
github.com/petermattis/goid v0.0.0-20251121121749-a11dd1a45f9a // indirect
|
|
github.com/pkg/errors v0.9.1 // indirect
|
|
github.com/quic-go/qpack v0.6.0 // indirect
|
|
github.com/quic-go/quic-go v0.58.0 // indirect
|
|
github.com/rivo/uniseg v0.4.7 // indirect
|
|
github.com/rs/cors v1.11.1 // indirect
|
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
|
github.com/segmentio/asm v1.2.1 // indirect
|
|
github.com/segmentio/encoding v0.5.3 // indirect
|
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
|
github.com/spf13/cobra v1.10.2 // indirect
|
|
github.com/spf13/pflag v1.0.10 // indirect
|
|
github.com/stoewer/go-strcase v1.3.1 // indirect
|
|
github.com/tetratelabs/wazero v1.11.0 // indirect
|
|
github.com/tidwall/btree v1.8.1 // indirect
|
|
github.com/vbatts/tar-split v0.12.2 // indirect
|
|
go.lsp.dev/jsonrpc2 v0.10.0 // indirect
|
|
go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 // indirect
|
|
go.lsp.dev/protocol v0.12.0 // indirect
|
|
go.lsp.dev/uri v0.3.0 // indirect
|
|
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 // indirect
|
|
go.opentelemetry.io/otel v1.39.0 // indirect
|
|
go.opentelemetry.io/otel/metric v1.39.0 // indirect
|
|
go.opentelemetry.io/otel/trace v1.39.0 // indirect
|
|
go.uber.org/mock v0.6.0 // indirect
|
|
go.uber.org/multierr v1.11.0 // indirect
|
|
go.uber.org/zap v1.27.1 // indirect
|
|
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
|
golang.org/x/crypto v0.46.0 // indirect
|
|
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
|
|
golang.org/x/mod v0.31.0 // indirect
|
|
golang.org/x/net v0.48.0 // indirect
|
|
golang.org/x/sync v0.19.0 // indirect
|
|
golang.org/x/sys v0.39.0 // indirect
|
|
golang.org/x/term v0.38.0 // indirect
|
|
golang.org/x/text v0.32.0 // indirect
|
|
google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b // indirect
|
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
|
|
google.golang.org/grpc v1.78.0 // indirect
|
|
google.golang.org/protobuf v1.36.11 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
pluginrpc.com/pluginrpc v0.5.0 // indirect
|
|
)
|