Skip to content

Commit 7724789

Browse files
committed
Register certificate expiry metrics for Dirk and tracing TLS
Threads the metrics monitor and a stable certificate name into both certificate manager call sites via go-certmanager's WithMonitor/WithName options: - Dirk-comms client cert: name="dirk" (the concern being the Dirk coordination channel). - Tracing TLS client cert: name="tracing" (the OTel collector coordination channel). To make the monitor available at tracing-init time, startMonitor is hoisted out of startBasicServices and called from main() before initTracing; the resulting bootstrap monitor is threaded down into startBasicServices, which continues to upgrade it later with chainTime and the HTTP server once they're ready. The Prometheus default registry is global so gauge registration survives the upgrade. Adds unit tests exercising both wiring sites with a prometheus-presenter stub monitor and asserting the gauges appear in the default registry under the expected name/role labels. Bumps go-certmanager to pull in the metrics.Service interface plus Prometheus gauges.
1 parent 977a6c9 commit 7724789

8 files changed

Lines changed: 228 additions & 35 deletions

File tree

commands.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ func proposerConfigCheck(ctx context.Context, majordomo majordomo.Service) bool
4242

4343
// Force disable metrics.
4444
viper.Set("metrics.prometheus.listen-address", "")
45-
consensusClient, chainTime, monitor, err := startBasicServices(ctx)
45+
// Create a bootstrap monitor to satisfy the startBasicServices signature; metrics are suppressed above.
46+
bootstrapMonitor, err := startMonitor(ctx, nil, false)
47+
if err != nil {
48+
fmt.Fprintf(os.Stderr, "Failed to start metrics service: %v\n", err)
49+
return true
50+
}
51+
consensusClient, chainTime, monitor, err := startBasicServices(ctx, bootstrapMonitor)
4652
if err != nil {
4753
fmt.Fprintf(os.Stderr, "Failed to start basic services: %v\n", err)
4854
return true

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ require (
66
github.com/OffchainLabs/go-bitfield v0.0.0-20251031151322-f427d04d8506
77
github.com/attestantio/go-block-relay v0.5.1
88
github.com/attestantio/go-builder-client v0.7.2
9-
github.com/attestantio/go-certmanager v0.1.1
9+
github.com/attestantio/go-certmanager v0.2.0
1010
github.com/attestantio/go-eth2-client v0.28.0
1111
github.com/aws/aws-sdk-go v1.55.6
12+
github.com/google/uuid v1.6.0
1213
github.com/holiman/uint256 v1.3.2
1314
github.com/mitchellh/go-homedir v1.1.0
1415
github.com/pkg/errors v0.9.1
15-
github.com/prometheus/client_golang v1.21.1
16+
github.com/prometheus/client_golang v1.23.2
1617
github.com/rs/zerolog v1.35.0
1718
github.com/sasha-s/go-deadlock v0.3.6
1819
github.com/shopspring/decimal v1.4.0
@@ -69,7 +70,6 @@ require (
6970
github.com/goccy/go-yaml v1.17.1 // indirect
7071
github.com/google/go-cmp v0.7.0 // indirect
7172
github.com/google/s2a-go v0.1.9 // indirect
72-
github.com/google/uuid v1.6.0 // indirect
7373
github.com/googleapis/enterprise-certificate-proxy v0.3.5 // indirect
7474
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
7575
github.com/gorilla/mux v1.8.1 // indirect
@@ -80,7 +80,6 @@ require (
8080
github.com/jackc/puddle/v2 v2.2.2 // indirect
8181
github.com/jmespath/go-jmespath v0.4.0 // indirect
8282
github.com/json-iterator/go v1.1.12 // indirect
83-
github.com/klauspost/compress v1.18.0 // indirect
8483
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
8584
github.com/leodido/go-urn v1.4.0 // indirect
8685
github.com/magiconair/properties v1.8.9 // indirect
@@ -95,9 +94,9 @@ require (
9594
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe // indirect
9695
github.com/pk910/dynamic-ssz v0.0.6 // indirect
9796
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
98-
github.com/prometheus/client_model v0.6.1 // indirect
99-
github.com/prometheus/common v0.63.0 // indirect
100-
github.com/prometheus/procfs v0.16.0 // indirect
97+
github.com/prometheus/client_model v0.6.2 // indirect
98+
github.com/prometheus/common v0.66.1 // indirect
99+
github.com/prometheus/procfs v0.16.1 // indirect
101100
github.com/r3labs/sse/v2 v2.10.0 // indirect
102101
github.com/sagikazarmark/locafero v0.7.0 // indirect
103102
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
@@ -122,6 +121,7 @@ require (
122121
go.opentelemetry.io/otel/metric v1.43.0 // indirect
123122
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
124123
go.uber.org/multierr v1.11.0 // indirect
124+
go.yaml.in/yaml/v2 v2.4.2 // indirect
125125
golang.org/x/arch v0.15.0 // indirect
126126
golang.org/x/crypto v0.49.0 // indirect
127127
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect

go.sum

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ github.com/attestantio/go-block-relay v0.5.1 h1:VQk8oPBXWy41msIAfM/Ee4UomdroBIo5
8080
github.com/attestantio/go-block-relay v0.5.1/go.mod h1:T9VAtjQKNsRie69++TsG46aMe4HEoEhlbcymhDz7G08=
8181
github.com/attestantio/go-builder-client v0.7.2 h1:bOrtysEIZd9bEM+mAeT6OtAo6LSAft/qylBLwFoFwZ0=
8282
github.com/attestantio/go-builder-client v0.7.2/go.mod h1:+NADxbaknI5yxl+0mCkMa/VciVsesxRMGNP/poDfV08=
83-
github.com/attestantio/go-certmanager v0.1.1 h1:N56XLU/LohaQPB1HPSHZirAPd692lOrIpKqcnj2/lic=
84-
github.com/attestantio/go-certmanager v0.1.1/go.mod h1://OeWLAivtO7WYm2SdBwvE02OKcAnE1gK1OXhCKyPIs=
83+
github.com/attestantio/go-certmanager v0.2.0 h1:Hzj12L5fofK7b281uohMBN0HQuSx+8RfU2UA9eHl84k=
84+
github.com/attestantio/go-certmanager v0.2.0/go.mod h1:Dn+C/okccD+2RugizT1ryrjX65cBMZl55fNYtmaVYAg=
8585
github.com/attestantio/go-eth2-client v0.28.0 h1:2zIIIMPvSD+g6h3TgVXsoda/Yw3e+wjo1e8CZEanORU=
8686
github.com/attestantio/go-eth2-client v0.28.0/go.mod h1:PO9sHFCq+1RiG+Eh3eOR2GYvYV64Qzg7idM3kLgCs5k=
8787
github.com/aws/aws-sdk-go v1.44.81/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
@@ -355,15 +355,15 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1
355355
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
356356
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
357357
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
358-
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
359-
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
358+
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
359+
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
360360
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
361-
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
362-
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
363-
github.com/prometheus/common v0.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k=
364-
github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18=
365-
github.com/prometheus/procfs v0.16.0 h1:xh6oHhKwnOJKMYiYBDWmkHqQPyiY40sny36Cmx2bbsM=
366-
github.com/prometheus/procfs v0.16.0/go.mod h1:8veyXUu3nGP7oaCxhX6yeaM5u4stL2FeMXnCqhDthZg=
361+
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
362+
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
363+
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
364+
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
365+
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
366+
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
367367
github.com/prysmaticlabs/gohashtree v0.0.4-beta h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4=
368368
github.com/prysmaticlabs/gohashtree v0.0.4-beta/go.mod h1:BFdtALS+Ffhg3lGQIHv9HDWuHS8cTvHZzrHWxwOtGOs=
369369
github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0=
@@ -498,6 +498,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
498498
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
499499
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
500500
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
501+
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
502+
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
501503
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
502504
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
503505
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -691,7 +693,6 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc
691693
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
692694
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
693695
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
694-
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
695696
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
696697
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
697698
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

main.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,16 @@ func main2() int {
156156

157157
initProfiling()
158158

159-
if err := initTracing(ctx, majordomo); err != nil {
159+
// Start a bootstrap monitor before tracing so the tracing TLS certificate
160+
// manager can register expiry metrics against it. The monitor is later
161+
// upgraded inside startBasicServices to include chainTime + the HTTP server.
162+
bootstrapMonitor, err := startMonitor(ctx, nil, false)
163+
if err != nil {
164+
log.Error().Err(err).Msg("Failed to start metrics service")
165+
return 1
166+
}
167+
168+
if err := initTracing(ctx, majordomo, bootstrapMonitor); err != nil {
160169
log.Error().Err(err).Msg("Failed to initialise tracing")
161170
return 1
162171
}
@@ -168,7 +177,7 @@ func main2() int {
168177
return 1
169178
}
170179

171-
chainTime, controller, err := startServices(ctx, majordomo)
180+
chainTime, controller, err := startServices(ctx, majordomo, bootstrapMonitor)
172181
if err != nil {
173182
log.Error().Err(err).Msg("Failed to initialise services")
174183
return 1
@@ -320,12 +329,13 @@ func startClient(ctx context.Context, monitor metrics.Service) (eth2client.Servi
320329

321330
func startServices(ctx context.Context,
322331
majordomo majordomo.Service,
332+
bootstrapMonitor metrics.Service,
323333
) (
324334
chaintime.Service,
325335
*standardcontroller.Service,
326336
error,
327337
) {
328-
eth2Client, chainTime, monitor, err := startBasicServices(ctx)
338+
eth2Client, chainTime, monitor, err := startBasicServices(ctx, bootstrapMonitor)
329339
if err != nil {
330340
return nil, nil, err
331341
}
@@ -569,19 +579,13 @@ func startProviderServices(ctx context.Context, monitor metrics.Service) (eth2cl
569579
}
570580

571581
func startBasicServices(ctx context.Context,
582+
monitor metrics.Service,
572583
) (
573584
eth2client.Service,
574585
chaintime.Service,
575586
metrics.Service,
576587
error,
577588
) {
578-
// Initialise monitor without chainTime service and server for now, so the
579-
// client can provide metrics.
580-
monitor, err := startMonitor(ctx, nil, false)
581-
if err != nil {
582-
return nil, nil, nil, errors.Wrap(err, "failed to start metrics service")
583-
}
584-
585589
eth2Client, err := startClient(ctx, monitor)
586590
if err != nil {
587591
return nil, nil, nil, err

services/accountmanager/dirk/service.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ func loadClientCertificates(ctx context.Context, parameters *parameters) (creden
145145
standardclientcert.WithMajordomo(parameters.majordomo),
146146
standardclientcert.WithCertPEMURI(parameters.clientCertURI),
147147
standardclientcert.WithCertKeyURI(parameters.clientKeyURI),
148+
standardclientcert.WithMonitor(parameters.monitor),
149+
standardclientcert.WithName("dirk"),
148150
}
149151
if parameters.caCertURI != "" {
150152
clientCertOpts = append(clientCertOpts, standardclientcert.WithCACertURI(parameters.caCertURI))

services/accountmanager/dirk/service_test.go

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package dirk_test
1616
import (
1717
"context"
1818
"crypto/tls"
19+
"strings"
1920
"testing"
2021
"time"
2122

@@ -25,12 +26,23 @@ import (
2526
"github.com/attestantio/vouch/mock"
2627
"github.com/attestantio/vouch/services/accountmanager/dirk"
2728
standardchaintime "github.com/attestantio/vouch/services/chaintime/standard"
29+
"github.com/attestantio/vouch/services/metrics"
2830
nullmetrics "github.com/attestantio/vouch/services/metrics/null"
2931
"github.com/attestantio/vouch/testing/logger"
32+
"github.com/prometheus/client_golang/prometheus"
3033
"github.com/rs/zerolog"
3134
"github.com/stretchr/testify/require"
3235
)
3336

37+
// stubMonitor is a monitor that reports a fixed presenter; used to opt into
38+
// go-certmanager metric registration during tests.
39+
// Mirrors tracingStubMonitor in tracing_test.go.
40+
type stubMonitor struct{ presenter string }
41+
42+
func (s stubMonitor) Presenter() string { return s.presenter }
43+
44+
var _ metrics.Service = stubMonitor{}
45+
3446
// newTestMajordomo creates a mock majordomo with matching test certificates.
3547
func newTestMajordomo() *certmock.Majordomo {
3648
return certmock.NewMajordomo(map[string][]byte{
@@ -583,6 +595,88 @@ func TestDirkTLSCAOptional(t *testing.T) {
583595
})
584596
}
585597

598+
func TestDirkTLSWiringWithPrometheusMonitor(t *testing.T) {
599+
// Passing a monitor whose presenter is "prometheus" opts into go-certmanager's
600+
// metric registration. Asserts the client certificate expiry gauges are
601+
// registered under name="dirk", role="client". Guards both the WithMonitor
602+
// and WithName wiring — missing either would cause the series to be absent
603+
// (WithMonitor) or construction to fail with ErrNoNameWithMonitor (WithName).
604+
ctx := context.Background()
605+
606+
genesisTime := time.Now()
607+
chainTime, err := standardchaintime.New(ctx,
608+
standardchaintime.WithLogLevel(zerolog.Disabled),
609+
standardchaintime.WithGenesisProvider(mock.NewGenesisProvider(genesisTime)),
610+
standardchaintime.WithSpecProvider(mock.NewSpecProvider()),
611+
)
612+
require.NoError(t, err)
613+
614+
svc, err := dirk.New(ctx,
615+
dirk.WithLogLevel(zerolog.Disabled),
616+
dirk.WithMonitor(stubMonitor{presenter: "prometheus"}),
617+
dirk.WithClientMonitor(nullmetrics.New()),
618+
dirk.WithProcessConcurrency(1),
619+
dirk.WithEndpoints([]string{"localhost:12345"}),
620+
dirk.WithAccountPaths([]string{"wallet1"}),
621+
dirk.WithMajordomo(newTestMajordomo()),
622+
dirk.WithClientCertURI("client-cert"),
623+
dirk.WithClientKeyURI("client-key"),
624+
dirk.WithCACertURI("ca-cert"),
625+
dirk.WithValidatorsManager(mock.NewValidatorsManager()),
626+
dirk.WithDomainProvider(mock.NewDomainProvider()),
627+
dirk.WithFarFutureEpochProvider(mock.NewFarFutureEpochProvider(0xffffffffffffffff)),
628+
dirk.WithCurrentEpochProvider(chainTime),
629+
)
630+
require.NoError(t, err)
631+
require.NotNil(t, svc)
632+
633+
requireCertMetric(t, "certmanager_certificate_not_after_seconds", "dirk", "client")
634+
requireCertMetric(t, "certmanager_certificate_not_before_seconds", "dirk", "client")
635+
}
636+
637+
// requireCertMetric asserts the go-certmanager gauge series with the given
638+
// name/role labels is present in the default Prometheus registry and has a
639+
// positive value (i.e. SetCertificateExpiry was invoked).
640+
func requireCertMetric(t *testing.T, metricName, name, role string) {
641+
t.Helper()
642+
643+
families, err := prometheus.DefaultGatherer.Gather()
644+
require.NoError(t, err)
645+
646+
for _, mf := range families {
647+
if mf.GetName() != metricName {
648+
continue
649+
}
650+
for _, m := range mf.GetMetric() {
651+
var matchName, matchRole bool
652+
for _, l := range m.GetLabel() {
653+
switch l.GetName() {
654+
case "name":
655+
matchName = l.GetValue() == name
656+
case "role":
657+
matchRole = l.GetValue() == role
658+
}
659+
}
660+
if matchName && matchRole {
661+
require.Greater(t, m.GetGauge().GetValue(), float64(0),
662+
"metric %s{name=%q,role=%q} should have a positive value", metricName, name, role)
663+
return
664+
}
665+
}
666+
}
667+
668+
var found []string
669+
for _, mf := range families {
670+
if strings.HasPrefix(mf.GetName(), "certmanager_") {
671+
for _, m := range mf.GetMetric() {
672+
found = append(found, m.String())
673+
}
674+
}
675+
}
676+
t.Fatalf("metric %s{name=%q,role=%q} not registered (saw certmanager_ series: %v)",
677+
metricName, name, role, found)
678+
}
679+
586680
func TestDirkTLSMinVersion(t *testing.T) {
587681
ctx := context.Background()
588682

tracing.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"time"
2323

2424
standardclientcert "github.com/attestantio/go-certmanager/client/standard"
25+
"github.com/attestantio/vouch/services/metrics"
2526
"github.com/pkg/errors"
2627
"github.com/spf13/viper"
2728
majordomo "github.com/wealdtech/go-majordomo"
@@ -37,7 +38,7 @@ import (
3738
)
3839

3940
// initTracing initialises the tracing system.
40-
func initTracing(ctx context.Context, majordomo majordomo.Service) error {
41+
func initTracing(ctx context.Context, majordomo majordomo.Service, monitor metrics.Service) error {
4142
if viper.GetString("tracing.address") == "" {
4243
log.Debug().Msg("No tracing endpoint supplied; tracing not enabled")
4344
return nil
@@ -49,7 +50,7 @@ func initTracing(ctx context.Context, majordomo majordomo.Service) error {
4950
}
5051
if viper.GetString("tracing.client-cert") != "" {
5152
log.Trace().Msg("Using TLS tracing connection")
52-
creds, err := loadTracingClientCertificates(ctx, majordomo)
53+
creds, err := loadTracingClientCertificates(ctx, majordomo, monitor)
5354
if err != nil {
5455
return err
5556
}
@@ -113,14 +114,16 @@ func initTracing(ctx context.Context, majordomo majordomo.Service) error {
113114

114115
// loadTracingClientCertificates returns gRPC TLS credentials for the tracing client
115116
// from the cert/key/CA URIs configured in viper, resolved via majordomo.
116-
func loadTracingClientCertificates(ctx context.Context, majordomo majordomo.Service) (credentials.TransportCredentials, error) {
117+
func loadTracingClientCertificates(ctx context.Context, majordomo majordomo.Service, monitor metrics.Service) (credentials.TransportCredentials, error) {
117118
ctx, span := otel.Tracer("attestantio.vouch").Start(ctx, "loadTracingClientCertificates")
118119
defer span.End()
119120

120121
clientCertOpts := []standardclientcert.Parameter{
121122
standardclientcert.WithMajordomo(majordomo),
122123
standardclientcert.WithCertPEMURI(viper.GetString("tracing.client-cert")),
123124
standardclientcert.WithCertKeyURI(viper.GetString("tracing.client-key")),
125+
standardclientcert.WithMonitor(monitor),
126+
standardclientcert.WithName("tracing"),
124127
}
125128
// CA cert is optional; when omitted the system cert pool is used.
126129
if viper.GetString("tracing.ca-cert") != "" {

0 commit comments

Comments
 (0)