Skip to content

Commit d323e85

Browse files
authored
fix(core): remove duplicate root-level trace configuration (#2944)
### Proposed Changes The Config struct had two places where tracing.Config was embedded: - config.Config.Trace (root level) - UNUSED - server.Config.Trace (under server) - ACTUALLY USED Only cfg.Server.Trace was ever passed to tracing.InitTracer in start.go, making the root-level Trace field dead code. Changes: - Remove unused Trace field from config.Config struct - Remove unused tracing package import from config.go - Fix docs to use correct server.trace.* paths instead of trace.* - Move Tracing Configuration section under Server Configuration in docs - Add YAML example showing correct configuration structure ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent d45a34b commit d323e85

File tree

2 files changed

+38
-26
lines changed

2 files changed

+38
-26
lines changed

docs/Configuring.md

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ The platform leverages [viper](https://github.com/spf13/viper) to help load conf
1414
- [Additive Configuration](#additive-configuration)
1515
- [Programmatic Configuration](#programmatic-configuration)
1616
- [Crypto Provider](#crypto-provider)
17-
- [Database Configuration](#database-configuration)
1817
- [Tracing Configuration](#tracing-configuration)
18+
- [Database Configuration](#database-configuration)
1919
- [Security Configuration](#security-configuration)
2020
- [Services Configuration](#services-configuration)
2121
- [Key Access Server (KAS)](#key-access-server-kas)
@@ -252,6 +252,43 @@ Environment Variable: `OPENTDF_SERVER_CRYPTOPROVIDER_STANDARD='[{"alg":"rsa:2048
252252
| `cryptoProvider.standard.*.private` | Path to the private key as a PEM file. | |
253253
| `cryptoProvider.standard.*.cert` | (Optional) Path to a public cert for the keypair. | |
254254

255+
### Tracing Configuration
256+
257+
Root level key `server.trace`
258+
259+
| Field | Description | Default | Environment Variable |
260+
| ---------------------------- | ------------------------------- | ------- | ---------------------------------- |
261+
| `server.trace.enabled` | Enable distributed tracing | `false` | OPENTDF_SERVER_TRACE_ENABLED |
262+
| `server.trace.provider.name` | Tracing provider (file or otlp) | `otlp` | OPENTDF_SERVER_TRACE_PROVIDER_NAME |
263+
264+
For file provider:
265+
- `server.trace.provider.file.path`: Path to trace file output
266+
- `server.trace.provider.file.prettyPrint`: Enable pretty-printed JSON
267+
- `server.trace.provider.file.maxSize`: Maximum file size in MB
268+
- `server.trace.provider.file.maxBackups`: Maximum number of backup files
269+
- `server.trace.provider.file.maxAge`: Maximum age of files in days
270+
- `server.trace.provider.file.compress`: Enable compression of trace files
271+
272+
For OTLP provider:
273+
- `server.trace.provider.otlp.protocol`: Protocol to use (grpc or http/protobuf)
274+
- `server.trace.provider.otlp.endpoint`: Endpoint URL for the collector
275+
- `server.trace.provider.otlp.insecure`: Whether to use an insecure connection
276+
- `server.trace.provider.otlp.headers`: Headers to include in OTLP requests
277+
278+
Example:
279+
280+
```yaml
281+
server:
282+
trace:
283+
enabled: true
284+
provider:
285+
name: otlp
286+
otlp:
287+
protocol: grpc
288+
endpoint: "localhost:4317"
289+
insecure: true
290+
```
291+
255292
## Database Configuration
256293

257294
The database configuration is used to define how the application connects to its database.
@@ -302,27 +339,6 @@ db:
302339
health_check_period_seconds: 60
303340
```
304341

305-
### Tracing Configuration
306-
307-
| Field | Description | Default | Environment Variable |
308-
| --------------------- | ------------------------------- | ------- | ---------------------------------- |
309-
| `trace.enabled` | Enable distributed tracing | `false` | OPENTDF_SERVER_TRACE_ENABLED |
310-
| `trace.provider.name` | Tracing provider (file or otlp) | `otlp` | OPENTDF_SERVER_TRACE_PROVIDER_NAME |
311-
312-
For file provider:
313-
- `trace.provider.file.path`: Path to trace file output
314-
- `trace.provider.file.prettyPrint`: Enable pretty-printed JSON
315-
- `trace.provider.file.maxSize`: Maximum file size in MB
316-
- `trace.provider.file.maxBackups`: Maximum number of backup files
317-
- `trace.provider.file.maxAge`: Maximum age of files in days
318-
- `trace.provider.file.compress`: Enable compression of trace files
319-
320-
For OTLP provider:
321-
- `trace.provider.otlp.protocol`: Protocol to use (grpc or http/protobuf)
322-
- `trace.provider.otlp.endpoint`: Endpoint URL for the collector
323-
- `trace.provider.otlp.insecure`: Whether to use an insecure connection
324-
- `trace.provider.otlp.headers`: Headers to include in OTLP requests
325-
326342
## Security Configuration
327343

328344
Root level key `security`

service/pkg/config/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/opentdf/platform/service/internal/server"
1212
"github.com/opentdf/platform/service/logger"
1313
"github.com/opentdf/platform/service/pkg/db"
14-
"github.com/opentdf/platform/service/tracing"
1514
"github.com/spf13/viper"
1615
)
1716

@@ -90,9 +89,6 @@ type Config struct {
9089
// Services represents the configuration settings for the services.
9190
Services ServicesMap `mapstructure:"services" json:"services"`
9291

93-
// Trace is for configuring open telemetry based tracing.
94-
Trace tracing.Config `mapstructure:"trace" json:"trace"`
95-
9692
// onConfigChangeHooks is a list of functions to call when the configuration changes.
9793
onConfigChangeHooks []ChangeHook
9894
// loaders is a list of configuration loaders.

0 commit comments

Comments
 (0)