Skip to content

TT-17154 Clarify config struct comments for docs generation#69

Merged
mativm02 merged 4 commits into
mainfrom
TT-17154/improve-config-comments
May 21, 2026
Merged

TT-17154 Clarify config struct comments for docs generation#69
mativm02 merged 4 commits into
mainfrom
TT-17154/improve-config-comments

Conversation

@mativm02

@mativm02 mativm02 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Description

Improves user-facing documentation generated from comments on the config structs. Changes are documentation-only — no behavior, signatures, or defaults are modified.

Field-by-field changes:

  • ExporterConfig.Exporter — Fixed broken grammar ("to sending data in OTLP protocol") and described the field as the OTLP transport that must match the collector's protocol.
  • ExporterConfig.ResourceName — Replaced the circular description ("Name of the resource that will be used to identify the resource") with concrete meaning: the service name reported as the OpenTelemetry resource, identifying the Gateway in backends.
  • OpenTelemetry.Enabled and TLS.Enable — Adopted Tyk's standard "Set this to true to enable..." phrasing for consistency with the rest of the gateway config.
  • TLS.CAFile — Clarified that only filesystem paths are accepted; certificate IDs from the Tyk certificate store are not supported here (reviewer asked whether it accepts cert IDs).

Motivation and Context

PR review feedback on the gateway-side OpenTelemetry config documentation noted that several generated doc entries were unclear, used inconsistent phrasing, or had grammar issues. Because the docs are generated from these struct comments, the fixes belong in this library.

Out of scope

One review comment asked why TLS settings here are not part of ExternalServiceConfig (the centralized external-service config in the gateway). That's an architectural question — folding the library's TLS struct into ExternalServiceConfig would require coordination with other consumers of this library and isn't a doc-only fix. Tracking that separately.

The Traces field comment fix (replacing "non-nil" with "when set") lives in the tyk repo and is being handled as a separate change there.

Test Coverage For This Change

Comment-only change. Verified locally:

  • go build ./... — compiles clean.
  • gofmt -l config/config.go — no formatting issues.

Types of changes

  • Documentation updates or improvements.

Checklist

  • I have reviewed the guidelines for contributing to this repository.
  • Pull request is from a topic branch, not main.
  • PR targets main.
  • Lint checks pass (gofmt -s -w ., go vet ./...).

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.
Comment thread config/config.go
// This should be set to the same type of the OpenTelemetry collector.
// Valid values are "grpc", or "http".
// Defaults to "grpc".
// Transport used to send telemetry data to the OpenTelemetry collector

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/config.go
// Timeout for establishing a connection to the collector.
// Defaults to 1 second.
ConnectionTimeout int `json:"connection_timeout"`
// Name of the resource that will be used to identify the resource.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/config.go
}

type OpenTelemetry struct {
// A flag that can be used to enable or disable the trace exporter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/config.go
}

type TLS struct {
// Flag that can be used to enable TLS. Defaults to false (disabled).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/config.go
// Flag that can be used to skip TLS verification if TLS is enabled.
// Defaults to false.
InsecureSkipVerify bool `json:"insecure_skip_verify"`
// Path to the CA file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/config.go
CertFile string `json:"cert_file"`
// Path to the key file.
KeyFile string `json:"key_file"`
// Maximum TLS version that is supported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mativm02 added 2 commits May 19, 2026 11:30
Drop the Tyk-vs-Go-crypto/tls parenthetical from the version defaults
comments; the simpler "Defaults to" form matches the rest of the file.
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.

@andyo-tyk andyo-tyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed changes to the comments

Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Co-authored-by: andyo-tyk <99968932+andyo-tyk@users.noreply.github.com>
@mativm02
mativm02 requested a review from andyo-tyk May 21, 2026 01:15
@mativm02
mativm02 merged commit 3b0d024 into main May 21, 2026
7 checks passed
mativm02 added a commit to TykTechnologies/tyk that referenced this pull request May 26, 2026
## Summary

- Bumps `github.com/TykTechnologies/opentelemetry` from `v0.0.25` to
`v0.0.26-0.20260521112223-3b0d024e6090`, pulling in
[opentelemetry#69](TykTechnologies/opentelemetry#69)
(merge commit `3b0d024e`).
- That PR is a documentation-only change: it clarifies the config struct
comments that drive user-facing OpenTelemetry docs generation
(`ExporterConfig.Exporter`, `ResourceName`, `OpenTelemetry.Enabled`,
`TLS.Enable`, `TLS.CAFile`). No behavior, API, or default changes.
- Pinned via Go pseudo-version because no new tag was cut after
`v0.0.25` for this commit.

## Motivation

PR review feedback on the gateway-side OpenTelemetry config docs noted
unclear/inconsistent wording and grammar issues. Since the docs are
generated from the upstream library's struct comments, the fixes live in
`TykTechnologies/opentelemetry`. This PR brings those fixes into the
gateway.

## Test plan

- [x] `go build ./...` — OTel-touching packages (`./internal/otel/...`,
`./internal/graphql/...`, `./gateway/...`) compile clean. The only build
noise (`test/goplugins` "main undeclared", linker duplicate `-ldl`
warning) is pre-existing on master and unrelated.
- [x] `go vet ./internal/otel/...` — passes.
- [x] `go mod tidy` — clean, no unrelated module churn.
- [ ] CI green on this branch.

## Notes for reviewers

- Since the upstream change is comment-only, the diff here is minimal (2
lines in `go.mod`, 4 in `go.sum`).
- Once a `v0.0.26` tag is cut on the opentelemetry repo, a follow-up can
replace the pseudo-version with the clean tag — but functionally
identical.
<!---TykTechnologies/jira-linter starts here-->

### Ticket Details

<details>
<summary>
<a href="https://tyktech.atlassian.net/browse/TT-17154" title="TT-17154"
target="_blank">TT-17154</a>
</summary>

|         |    |
|---------|----|
| Status  | In Code Review |
| Summary | Gateway API + config 5.13.0 |

Generated at: 2026-05-21 11:53:06

</details>

<!---TykTechnologies/jira-linter ends here-->
mativm02 added a commit to TykTechnologies/tyk that referenced this pull request May 28, 2026
…5 doc-comment fixes (#8240) (#8249)

## Summary

Cherry-pick of #8240 onto `release-5.13`.

Bumps `github.com/TykTechnologies/opentelemetry` from `v0.0.25` to
`v0.0.26-0.20260521112223-3b0d024e6090`, pulling in doc-comment fixes
(TykTechnologies/opentelemetry#69). Documentation-only upstream change —
no behavior, API, or default changes.

- Original PR: #8240
- Original commit: 8a9a180
- Files changed: `go.mod` (2 lines), `go.sum` (4 lines)

## Test plan

- [ ] CI green on this branch
mativm02 added a commit to TykTechnologies/tyk that referenced this pull request May 28, 2026
….25 doc-comment fixes (#8240) (#8250)

## Summary

Cherry-pick of #8240 onto `release-5.13.0`.

Bumps `github.com/TykTechnologies/opentelemetry` from `v0.0.25` to
`v0.0.26-0.20260521112223-3b0d024e6090`, pulling in doc-comment fixes
(TykTechnologies/opentelemetry#69). Documentation-only upstream change —
no behavior, API, or default changes.

Follow-up to #8235 (the docs update that already landed on
`release-5.13.0`), bringing the matching gateway-side library bump.

- Original PR: #8240
- Original commit: 8a9a180
- Files changed: `go.mod` (2 lines), `go.sum` (4 lines)

## Test plan

- [ ] CI green on this branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants