Skip to content

Commit 3b0d024

Browse files
mativm02andyo-tyk
andauthored
TT-17154 Clarify config struct comments for docs generation (#69)
* TT-17154 Clarify config struct comments for docs generation Improve user-facing documentation generated from struct comments based on PR review feedback: - Exporter: fix grammar; describe it as the OTLP transport that must match the collector's protocol. - ResourceName: replace circular wording with concrete meaning (service name reported as the OpenTelemetry resource that identifies the Gateway in backends). - OpenTelemetry.Enabled and TLS.Enable: adopt Tyk's standard "Set this to true to enable..." phrasing for consistency with the rest of gateway config. - TLS.CAFile: clarify that only filesystem paths are accepted; certificate store IDs are not supported here. - TLS.MaxVersion/MinVersion: clarify that the "1.3"/"1.2" defaults are enforced by the library, not inherited from Go's crypto/tls. * TT-17154 Simplify TLS MinVersion/MaxVersion default wording Drop the Tyk-vs-Go-crypto/tls parenthetical from the version defaults comments; the simpler "Defaults to" form matches the rest of the file. * TT-17154 Revert TLS MinVersion/MaxVersion comments to original form The original wording is already aligned with the tyk-docs version (tyk-docs PR #2018), so there's no docs-consistency reason to change it. * Apply suggestions from code review Co-authored-by: andyo-tyk <99968932+andyo-tyk@users.noreply.github.com> --------- Co-authored-by: andyo-tyk <99968932+andyo-tyk@users.noreply.github.com>
1 parent 91eb9e9 commit 3b0d024

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

config/config.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ package config
44
// It is embedded by both OpenTelemetry (traces) and MetricsConfig (metrics)
55
// so each can target a different collector independently.
66
type ExporterConfig struct {
7-
// The type of the exporter to sending data in OTLP protocol.
8-
// This should be set to the same type of the OpenTelemetry collector.
9-
// Valid values are "grpc", or "http".
10-
// Defaults to "grpc".
7+
// Transport used to send telemetry data to the OpenTelemetry collector
8+
// over OTLP. Must match the protocol the collector is configured to accept.
9+
// Valid values are "grpc" or "http". Defaults to "grpc".
1110
Exporter string `json:"exporter"`
1211
// OpenTelemetry collector endpoint to connect to.
1312
// Defaults to "localhost:4317".
@@ -17,15 +16,20 @@ type ExporterConfig struct {
1716
// Timeout for establishing a connection to the collector.
1817
// Defaults to 1 second.
1918
ConnectionTimeout int `json:"connection_timeout"`
20-
// Name of the resource that will be used to identify the resource.
19+
// The "Resource" or "Service" Name that will be assigned to the Gateway in
20+
// traces and metrics. This is used to identify OpenTelemetry data generated
21+
// by Tyk Gateway. It typically appears as `service.name` in backends
22+
// such as Jaeger, Tempo or Prometheus.
2123
// Defaults to "tyk".
2224
ResourceName string `json:"resource_name"`
23-
// TLS configuration for the exporter.
25+
// TLS configuration used by the exporter to authenticate the OpenTelemetry collector
2426
TLS TLS `json:"tls"`
2527
}
2628

2729
type OpenTelemetry struct {
28-
// A flag that can be used to enable or disable the trace exporter.
30+
// Set this to `true` to enable OpenTelemetry tracing on the Gateway.
31+
// When enabled, the Gateway exports spans to the configured OpenTelemetry
32+
// collector. Defaults to false.
2933
Enabled bool `json:"enabled"`
3034
// Shared exporter/transport configuration.
3135
ExporterConfig `json:",inline"`
@@ -121,12 +125,16 @@ type MetricsRetryConfig struct {
121125
}
122126

123127
type TLS struct {
124-
// Flag that can be used to enable TLS. Defaults to false (disabled).
128+
// Set this to `true` to enable TLS for the connection to the OpenTelemetry
129+
// collector. Defaults to false.
125130
Enable bool `json:"enable"`
126-
// Flag that can be used to skip TLS verification if TLS is enabled.
131+
// Set to `true` to disable verification of the server’s certificate chain. Not recommended for production environments.
127132
// Defaults to false.
128133
InsecureSkipVerify bool `json:"insecure_skip_verify"`
129-
// Path to the CA file.
134+
// Filesystem path to a PEM-encoded CA certificate used to verify the
135+
// OpenTelemetry collector's TLS certificate. Only filesystem paths are
136+
// accepted; certificate IDs from the Tyk Certificate Store are not
137+
// supported.
130138
CAFile string `json:"ca_file"`
131139
// Path to the cert file.
132140
CertFile string `json:"cert_file"`

0 commit comments

Comments
 (0)