Skip to content

Commit

Permalink
feat(debug): exports (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
hekike authored Jul 4, 2024
1 parent 7d35c53 commit 565cf34
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/debug/httpdriver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (h *debugHandler) GetMetrics() GetMetricsHandler {
commonhttp.PlainTextResponseEncoder[string],
httptransport.AppendOptions(
h.options,
httptransport.WithErrorEncoder(func(ctx context.Context, err error, w http.ResponseWriter) bool {
httptransport.WithErrorEncoder(func(ctx context.Context, err error, w http.ResponseWriter, _ *http.Request) bool {
if _, ok := err.(*models.GenericUserError); ok {
commonhttp.NewHTTPError(
http.StatusBadRequest,
Expand Down
12 changes: 12 additions & 0 deletions openmeter/debug/adapters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package debug

import (
"github.com/openmeterio/openmeter/internal/debug"
"github.com/openmeterio/openmeter/openmeter/streaming"
)

func NewDebugConnector(
streaming streaming.Connector,
) DebugConnector {
return debug.NewDebugConnector(streaming)
}
19 changes: 19 additions & 0 deletions openmeter/debug/httpdriver/handlers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package httpdriver

import (
"github.com/openmeterio/openmeter/internal/debug"
"github.com/openmeterio/openmeter/internal/debug/httpdriver"
"github.com/openmeterio/openmeter/openmeter/namespace/namespacedriver"
"github.com/openmeterio/openmeter/pkg/framework/transport/httptransport"
)

type DebugHandler = httpdriver.DebugHandler
type GetMetricsHandler = httpdriver.GetMetricsHandler

func NewDebugHandler(
namespaceDecoder namespacedriver.NamespaceDecoder,
connector debug.DebugConnector,
options ...httptransport.HandlerOption,
) DebugHandler {
return httpdriver.NewDebugHandler(namespaceDecoder, connector, options...)
}
12 changes: 12 additions & 0 deletions openmeter/debug/httpdriver/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package httpdriver

import "github.com/openmeterio/openmeter/internal/debug/httpdriver"

// requests
type GetMetricsHandlerRequest = httpdriver.GetMetricsHandlerRequest

// responses
type GetMetricsHandlerResponse = httpdriver.GetMetricsHandlerResponse

// params
type GetMetricsHandlerParams = httpdriver.GetMetricsHandlerParams
7 changes: 7 additions & 0 deletions openmeter/debug/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package debug

import (
"github.com/openmeterio/openmeter/internal/debug"
)

type DebugConnector = debug.DebugConnector

0 comments on commit 565cf34

Please sign in to comment.