Skip to content

Commit a3a8daa

Browse files
committed
Revert "Bump Tessera & switch to OpenTelemetry (transparency-dev#242)"
This reverts commit 96ce8e4. # Conflicts: # internal/scti/handlers.go
1 parent 9be4255 commit a3a8daa

File tree

12 files changed

+144
-273
lines changed

12 files changed

+144
-273
lines changed

cmd/aws/main.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"time"
2929

3030
"github.com/go-sql-driver/mysql"
31+
"github.com/prometheus/client_golang/prometheus/promhttp"
3132
sctfe "github.com/transparency-dev/static-ct"
3233
"github.com/transparency-dev/static-ct/storage"
3334
awsSCTFE "github.com/transparency-dev/static-ct/storage/aws"
@@ -49,6 +50,7 @@ var (
4950
notAfterLimit timestampFlag
5051

5152
httpEndpoint = flag.String("http_endpoint", "localhost:6962", "Endpoint for HTTP (host:port).")
53+
metricsEndpoint = flag.String("metrics_endpoint", "", "Endpoint for serving metrics; if left empty, metrics will be visible on --http_endpoint.")
5254
httpDeadline = flag.Duration("http_deadline", time.Second*10, "Deadline for HTTP requests.")
5355
maskInternalErrors = flag.Bool("mask_internal_errors", false, "Don't return error strings with Internal Server Error HTTP responses.")
5456
origin = flag.String("origin", "", "Origin of the log, for checkpoints and the monitoring prefix.")
@@ -100,6 +102,25 @@ func main() {
100102
klog.Info("**** CT HTTP Server Starting ****")
101103
http.Handle("/", logHandler)
102104

105+
metricsAt := *metricsEndpoint
106+
if metricsAt == "" {
107+
metricsAt = *httpEndpoint
108+
}
109+
110+
if metricsAt != *httpEndpoint {
111+
// Run a separate handler for metrics.
112+
go func() {
113+
mux := http.NewServeMux()
114+
mux.Handle("/metrics", promhttp.Handler())
115+
metricsServer := http.Server{Addr: metricsAt, Handler: mux}
116+
err := metricsServer.ListenAndServe()
117+
klog.Warningf("Metrics server exited: %v", err)
118+
}()
119+
} else {
120+
// Handle metrics on the DefaultServeMux.
121+
http.Handle("/metrics", promhttp.Handler())
122+
}
123+
103124
// Bring up the HTTP server and serve until we get a signal not to.
104125
srv := http.Server{Addr: *httpEndpoint}
105126
shutdownWG := new(sync.WaitGroup)

cmd/gcp/main.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"syscall"
2929
"time"
3030

31+
"github.com/prometheus/client_golang/prometheus/promhttp"
3132
sctfe "github.com/transparency-dev/static-ct"
3233
"github.com/transparency-dev/static-ct/storage"
3334
gcpSCTFE "github.com/transparency-dev/static-ct/storage/gcp"
@@ -48,6 +49,7 @@ var (
4849
notAfterLimit timestampFlag
4950

5051
httpEndpoint = flag.String("http_endpoint", "localhost:6962", "Endpoint for HTTP (host:port).")
52+
metricsEndpoint = flag.String("metrics_endpoint", "", "Endpoint for serving metrics; if left empty, metrics will be visible on --http_endpoint.")
5153
httpDeadline = flag.Duration("http_deadline", time.Second*10, "Deadline for HTTP requests.")
5254
maskInternalErrors = flag.Bool("mask_internal_errors", false, "Don't return error strings with Internal Server Error HTTP responses.")
5355
origin = flag.String("origin", "", "Origin of the log, for checkpoints and the monitoring prefix.")
@@ -61,7 +63,6 @@ var (
6163
rejectExtensions = flag.String("reject_extension", "", "A list of X.509 extension OIDs, in dotted string form (e.g. '2.3.4.5') which, if present, should cause submissions to be rejected.")
6264
signerPublicKeySecretName = flag.String("signer_public_key_secret_name", "", "Public key secret name for checkpoints and SCTs signer. Format: projects/{projectId}/secrets/{secretName}/versions/{secretVersion}.")
6365
signerPrivateKeySecretName = flag.String("signer_private_key_secret_name", "", "Private key secret name for checkpoints and SCTs signer. Format: projects/{projectId}/secrets/{secretName}/versions/{secretVersion}.")
64-
traceFraction = flag.Float64("trace_fraction", 0, "Fraction of open-telemetry span traces to sample")
6566
)
6667

6768
// nolint:staticcheck
@@ -70,9 +71,6 @@ func main() {
7071
flag.Parse()
7172
ctx := context.Background()
7273

73-
shutdownOTel := initOTel(ctx, *traceFraction)
74-
defer shutdownOTel(ctx)
75-
7674
signer, err := NewSecretManagerSigner(ctx, *signerPublicKeySecretName, *signerPrivateKeySecretName)
7775
if err != nil {
7876
klog.Exitf("Can't create secret manager signer: %v", err)
@@ -97,6 +95,25 @@ func main() {
9795
klog.Info("**** CT HTTP Server Starting ****")
9896
http.Handle("/", logHandler)
9997

98+
metricsAt := *metricsEndpoint
99+
if metricsAt == "" {
100+
metricsAt = *httpEndpoint
101+
}
102+
103+
if metricsAt != *httpEndpoint {
104+
// Run a separate handler for metrics.
105+
go func() {
106+
mux := http.NewServeMux()
107+
mux.Handle("/metrics", promhttp.Handler())
108+
metricsServer := http.Server{Addr: metricsAt, Handler: mux}
109+
err := metricsServer.ListenAndServe()
110+
klog.Warningf("Metrics server exited: %v", err)
111+
}()
112+
} else {
113+
// Handle metrics on the DefaultServeMux.
114+
http.Handle("/metrics", promhttp.Handler())
115+
}
116+
100117
// Bring up the HTTP server and serve until we get a signal not to.
101118
srv := http.Server{Addr: *httpEndpoint}
102119
shutdownWG := new(sync.WaitGroup)

cmd/gcp/otel.go

Lines changed: 0 additions & 75 deletions
This file was deleted.

ctlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func NewLogHandler(ctx context.Context, origin string, signer crypto.Signer, cfg
138138
TimeSource: sysTimeSource,
139139
}
140140

141-
handlers := scti.NewPathHandlers(ctx, opts, log)
141+
handlers := scti.NewPathHandlers(opts, log)
142142
mux := http.NewServeMux()
143143
// Register handlers for all the configured logs.
144144
for path, handler := range handlers {

go.mod

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,27 @@ go 1.24.0
44

55
require (
66
cloud.google.com/go/secretmanager v1.14.6
7-
cloud.google.com/go/spanner v1.79.0
7+
cloud.google.com/go/spanner v1.78.0
88
cloud.google.com/go/storage v1.51.0
9-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0
10-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.27.0
119
github.com/RobinUS2/golang-moving-average v1.0.0
1210
github.com/aws/aws-sdk-go-v2 v1.36.3
1311
github.com/aws/aws-sdk-go-v2/config v1.29.13
1412
github.com/aws/aws-sdk-go-v2/service/s3 v1.79.1
1513
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.35.3
1614
github.com/aws/smithy-go v1.22.3
1715
github.com/gdamore/tcell/v2 v2.8.1
18-
github.com/go-sql-driver/mysql v1.9.2
16+
github.com/go-sql-driver/mysql v1.9.1
1917
github.com/google/go-cmp v0.7.0
2018
github.com/kylelemons/godebug v1.1.0
19+
github.com/prometheus/client_golang v1.21.1
2120
github.com/rivo/tview v0.0.0-20240625185742-b0a7293b8130
2221
github.com/transparency-dev/formats v0.0.0-20250127084410-134797944be6
2322
github.com/transparency-dev/merkle v0.0.2
24-
github.com/transparency-dev/trillian-tessera v0.1.2-0.20250408153912-a650aa01f2a4
23+
github.com/transparency-dev/trillian-tessera v0.1.2-0.20250320160837-ae724376e1ac
2524
go.etcd.io/bbolt v1.4.0
26-
go.opentelemetry.io/otel v1.35.0
27-
go.opentelemetry.io/otel/metric v1.35.0
28-
go.opentelemetry.io/otel/sdk v1.35.0
29-
go.opentelemetry.io/otel/sdk/metric v1.35.0
3025
golang.org/x/crypto v0.37.0
3126
golang.org/x/mod v0.24.0
32-
golang.org/x/net v0.39.0
27+
golang.org/x/net v0.38.0
3328
google.golang.org/api v0.228.0
3429
google.golang.org/grpc v1.71.1
3530
k8s.io/klog/v2 v2.130.1
@@ -44,10 +39,10 @@ require (
4439
cloud.google.com/go/iam v1.4.2 // indirect
4540
cloud.google.com/go/longrunning v0.6.6 // indirect
4641
cloud.google.com/go/monitoring v1.24.1 // indirect
47-
cloud.google.com/go/trace v1.11.3 // indirect
4842
filippo.io/edwards25519 v1.1.0 // indirect
4943
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.2 // indirect
5044
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
45+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
5146
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
5247
github.com/avast/retry-go/v4 v4.6.1 // indirect
5348
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect
@@ -64,6 +59,7 @@ require (
6459
github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect
6560
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 // indirect
6661
github.com/aws/aws-sdk-go-v2/service/sts v1.33.18 // indirect
62+
github.com/beorn7/perks v1.0.1 // indirect
6763
github.com/cespare/xxhash/v2 v2.3.0 // indirect
6864
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 // indirect
6965
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
@@ -79,15 +75,24 @@ require (
7975
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
8076
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
8177
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
78+
github.com/klauspost/compress v1.17.11 // indirect
8279
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
8380
github.com/mattn/go-runewidth v0.0.16 // indirect
81+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
8482
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
83+
github.com/prometheus/client_model v0.6.1 // indirect
84+
github.com/prometheus/common v0.62.0 // indirect
85+
github.com/prometheus/procfs v0.15.1 // indirect
8586
github.com/rivo/uniseg v0.4.7 // indirect
8687
go.opencensus.io v0.24.0 // indirect
8788
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
8889
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
8990
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
9091
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
92+
go.opentelemetry.io/otel v1.35.0 // indirect
93+
go.opentelemetry.io/otel/metric v1.35.0 // indirect
94+
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
95+
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
9196
go.opentelemetry.io/otel/trace v1.35.0 // indirect
9297
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
9398
golang.org/x/oauth2 v0.28.0 // indirect

0 commit comments

Comments
 (0)