• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tensorchord / openmodelz / 6146306117

11 Sep 2023 12:22PM UTC coverage: 26.069% (-3.9%) from 29.927%
6146306117

Pull #171

github

xieydd
chore: Make proxy endpoint port configurable

Signed-off-by: xieydd <xieydd@gmail.com>
Pull Request #171: feat: Support BYOC

443 of 443 new or added lines in 14 files covered. (100.0%)

939 of 3602 relevant lines covered (26.07%)

1.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/agent/pkg/server/server_init_route.go
1
package server
2

3
import (
4
        "github.com/gin-gonic/gin"
5
        swaggerfiles "github.com/swaggo/files"
6
        ginSwagger "github.com/swaggo/gin-swagger"
7

8
        _ "github.com/tensorchord/openmodelz/agent/pkg/docs"
9
        "github.com/tensorchord/openmodelz/agent/pkg/metrics"
10
)
11

12
const (
13
        endpointInferencePlural = "/inferences"
14
        endpointInference       = "/inference"
15
        endpointServerPlural    = "/servers"
16
        endpointServer          = "/server"
17
        endpointScaleInference  = "/scale-inference"
18
        endpointInfo            = "/info"
19
        endpointLogPlural       = "/logs"
20
        endpointNamespacePlural = "/namespaces"
21
        endpointHealthz         = "/healthz"
22
        endpointBuild           = "/build"
23
        endpointImageCache      = "/image-cache"
24
)
25

26
func (s *Server) registerRoutes() {
×
27
        root := s.router.Group("/")
×
28
        v1 := s.router.Group("/api/v1")
×
29

×
30
        // swagger
×
31
        root.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
×
32
        // dataplane
×
33
        root.Any("/inference/:name",
×
34
                WrapHandler(s.middlewareCallID),
×
35
                WrapHandler(s.handleInferenceProxy))
×
36
        root.Any("/inference/:name/*proxyPath",
×
37
                WrapHandler(s.middlewareCallID),
×
38
                WrapHandler(s.handleInferenceProxy))
×
39

×
40
        v1.Any("/mosec/:id/*proxyPath", WrapHandler(s.proxyMosec))
×
41
        v1.Any("/gradio/:id/*proxyPath", WrapHandler(s.proxyGradio))
×
42
        v1.Any("/streamlit/:id/*proxyPath", WrapHandler(s.proxyStreamlit))
×
43
        v1.Any("/other/:id/*proxyPath", WrapHandler(s.proxyOther))
×
44

×
45
        // healthz
×
46
        root.GET(endpointHealthz, WrapHandler(s.handleHealthz))
×
47

×
48
        // landing page
×
49
        root.GET("/", WrapHandler(s.handleRoot))
×
50

×
51
        // control plane
×
52
        controlPlane := root.Group("/system")
×
53
        // inferences
×
54
        controlPlane.GET(endpointInferencePlural,
×
55
                WrapHandler(s.handleInferenceList))
×
56
        controlPlane.POST(endpointInferencePlural,
×
57
                WrapHandler(s.handleInferenceCreate))
×
58
        controlPlane.PUT(endpointInferencePlural,
×
59
                WrapHandler(s.handleInferenceUpdate))
×
60
        controlPlane.DELETE(endpointInferencePlural,
×
61
                WrapHandler(s.handleInferenceDelete))
×
62
        controlPlane.POST(endpointScaleInference,
×
63
                WrapHandler(s.handleInferenceScale))
×
64
        controlPlane.GET(endpointInference+"/:name",
×
65
                WrapHandler(s.handleInferenceGet))
×
66

×
67
        // instances
×
68
        controlPlane.GET(endpointInference+"/:name/instances",
×
69
                WrapHandler(s.handleInferenceInstance))
×
70
        controlPlane.GET(endpointInference+"/:name/instance/:instance/exec",
×
71
                WrapHandler(s.handleInferenceInstanceExec))
×
72

×
73
        // info
×
74
        controlPlane.GET(endpointInfo, WrapHandler(s.handleInfo))
×
75

×
76
        // servers
×
77
        controlPlane.GET(endpointServerPlural, WrapHandler(s.handleServerList))
×
78
        controlPlane.POST(endpointServer+"/:name/labels", WrapHandler(s.handleServerLabelCreate))
×
79
        controlPlane.DELETE(endpointServer+"/:name/delete", WrapHandler(s.handleServerDelete))
×
80

×
81
        // logs
×
82
        controlPlane.GET(endpointLogPlural+endpointInference,
×
83
                WrapHandler(s.handleInferenceLogs))
×
84
        controlPlane.GET(endpointLogPlural+endpointBuild, WrapHandler(s.handleBuildLogs))
×
85

×
86
        // namespaces
×
87
        controlPlane.GET(endpointNamespacePlural,
×
88
                WrapHandler(s.handleNamespaceList))
×
89
        controlPlane.POST(endpointNamespacePlural,
×
90
                WrapHandler(s.handleNamespaceCreate))
×
91

×
92
        // TODO(gaocegege): Support secrets
×
93
        // controlPlane.GET("/secrets")
×
94

×
95
        // builds
×
96
        if s.config.Build.BuildEnabled {
×
97
                controlPlane.GET(endpointBuild, WrapHandler(s.handleBuildList))
×
98
                controlPlane.GET(endpointBuild+"/:name", WrapHandler(s.handleBuildGet))
×
99
                controlPlane.POST(endpointBuild, WrapHandler(s.handleBuildCreate))
×
100
        }
×
101
        // TODO(gaocegege): Support metrics
102
        // metrics
103

104
        // image cache
105
        controlPlane.POST(endpointImageCache, WrapHandler(s.handleImageCacheCreate))
×
106
}
107

108
// registerMetricsRoutes registers the metrics routes.
109
func (s *Server) registerMetricsRoutes() {
×
110
        s.metricsRouter.GET("/metrics", gin.WrapH(metrics.PrometheusHandler()))
×
111
        s.metricsRouter.GET(endpointHealthz, WrapHandler(s.handleHealthz))
×
112
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc