@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ "errors"
5
6
"io"
6
7
"log"
7
8
"net/http"
@@ -121,6 +122,11 @@ func main() {
121
122
Usage : "The Honeycomb team ID to send tracing data to. If not specified, tracing will not be shipped anywhere." ,
122
123
EnvVars : []string {"TUNNELD_TRACING_HONEYCOMB_TEAM" },
123
124
},
125
+ & cli.StringFlag {
126
+ Name : "tracing-service-id" ,
127
+ Usage : "The service ID to annotate all traces with that uniquely identifies this deployment." ,
128
+ EnvVars : []string {"TUNNELD_TRACING_SERVICE_ID" },
129
+ },
124
130
},
125
131
Action : runApp ,
126
132
}
@@ -146,6 +152,7 @@ func runApp(ctx *cli.Context) error {
146
152
realIPHeader = ctx .String ("real-ip-header" )
147
153
pprofListenAddress = ctx .String ("pprof-listen-address" )
148
154
tracingHoneycombTeam = ctx .String ("tracing-honeycomb-team" )
155
+ tracingServiceID = ctx .String ("tracing-service-id" )
149
156
)
150
157
if baseURL == "" {
151
158
return xerrors .New ("base-url is required. See --help for more information." )
@@ -173,12 +180,12 @@ func runApp(ctx *cli.Context) error {
173
180
if tracingHoneycombTeam != "" {
174
181
exp , err := newHoneycombExporter (ctx .Context , tracingHoneycombTeam )
175
182
if err != nil {
176
- return xerrors .Errorf ("failed to create honeycomb telemetry exporter: %w" , err )
183
+ return xerrors .Errorf ("create honeycomb telemetry exporter: %w" , err )
177
184
}
178
185
179
186
// Create a new tracer provider with a batch span processor and the otlp
180
187
// exporter.
181
- tp := newTraceProvider (exp )
188
+ tp := newTraceProvider (exp , tracingServiceID )
182
189
otel .SetTracerProvider (tp )
183
190
otel .SetTextMapPropagator (
184
191
propagation .NewCompositeTextMapPropagator (
@@ -210,7 +217,7 @@ func runApp(ctx *cli.Context) error {
210
217
211
218
if wireguardKeyFile != "" {
212
219
_ , err = os .Stat (wireguardKeyFile )
213
- if xerrors .Is (err , os .ErrNotExist ) {
220
+ if errors .Is (err , os .ErrNotExist ) {
214
221
logger .Info (ctx .Context , "generating private key to file" , slog .F ("path" , wireguardKeyFile ))
215
222
key , err := tunnelsdk .GeneratePrivateKey ()
216
223
if err != nil {
0 commit comments