@@ -16,7 +16,6 @@ limitations under the License.
1616package main
1717
1818import (
19- "crypto/tls"
2019 "flag"
2120 "net/url"
2221 "os"
@@ -29,6 +28,7 @@ import (
2928
3029 "github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/proxy"
3130 "github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/version"
31+ "github.com/llm-d/llm-d-inference-scheduler/pkg/telemetry"
3232)
3333
3434var (
@@ -70,6 +70,20 @@ func main() {
7070 ctx := ctrl .SetupSignalHandler ()
7171 log .IntoContext (ctx , logger )
7272
73+ // Initialize tracing before creating any spans
74+ shutdownTracing , err := telemetry .InitTracing (ctx )
75+ if err != nil {
76+ // Log error but don't fail - tracing is optional
77+ logger .Error (err , "Failed to initialize tracing" )
78+ }
79+ if shutdownTracing != nil {
80+ defer func () {
81+ if err := shutdownTracing (ctx ); err != nil {
82+ logger .Error (err , "Failed to shutdown tracing" )
83+ }
84+ }()
85+ }
86+
7387 logger .Info ("Proxy starting" , "Built on" , version .BuildRef , "From Git SHA" , version .CommitSHA )
7488
7589 // Validate connector
@@ -111,28 +125,15 @@ func main() {
111125 return
112126 }
113127
114- var cert * tls.Certificate
115- if * secureProxy {
116- var tempCert tls.Certificate
117- if * certPath != "" {
118- tempCert , err = tls .LoadX509KeyPair (* certPath + "/tls.crt" , * certPath + "/tls.key" )
119- } else {
120- tempCert , err = proxy .CreateSelfSignedTLSCertificate ()
121- }
122- if err != nil {
123- logger .Error (err , "failed to create TLS certificate" )
124- return
125- }
126- cert = & tempCert
127- }
128-
129128 config := proxy.Config {
130129 Connector : * connector ,
131130 PrefillerUseTLS : * prefillerUseTLS ,
132131 PrefillerInsecureSkipVerify : * prefillerInsecureSkipVerify ,
133132 DecoderInsecureSkipVerify : * decoderInsecureSkipVerify ,
134133 DataParallelSize : * vLLMDataParallelSize ,
135134 EnablePrefillerSampling : * enablePrefillerSampling ,
135+ SecureServing : * secureProxy ,
136+ CertPath : * certPath ,
136137 }
137138
138139 // Create SSRF protection validator
@@ -144,7 +145,7 @@ func main() {
144145
145146 proxyServer := proxy .NewProxy (* port , targetURL , config )
146147
147- if err := proxyServer .Start (ctx , cert , validator ); err != nil {
148+ if err := proxyServer .Start (ctx , validator ); err != nil {
148149 logger .Error (err , "failed to start proxy server" )
149150 }
150151}
0 commit comments