-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-11909]: fix oas bug and add respect expiry #6842
base: master
Are you sure you want to change the base?
Conversation
Knock Knock! 🔍 Just thought I'd let you know that your PR title and story title look quite different. PR titles that closely resemble the story title make it easier for reviewers to understand the context of the PR. An easy-to-understand PR title a day makes the reviewer review away! 😛⚡️
Check out this guide to learn more about PR best-practices. |
API Changes --- prev.txt 2025-01-23 08:27:06.743705236 +0000
+++ current.txt 2025-01-23 08:27:01.962678002 +0000
@@ -3083,6 +3083,9 @@
//
// Tyk classic API definition: `expire_analytics_after`.
Value ReadableDuration `bson:"value" json:"value"`
+ // RespectExpiry ensures that Tyk respects the expiry configured in the key when the API level configuration grants a shorter lifetime.
+ // That is, Redis waits until the the key has expired before deleting it.
+ RespectExpiry bool `bson:"respectExpiry,omitempty" json:"respectExpiry,omitempty"`
}
KeyRetentionPeriod contains configuration for key retention.
@@ -4904,33 +4907,6 @@
TYPES
-type AccessLogsConfig struct {
- // Enabled controls enabling the transaction logs. Default: false.
- Enabled bool `json:"enabled"`
-
- // Template configures which fields to log into the access log.
- // If unconfigured, all fields listed will be logged.
- //
- // Example: ["client_ip", "path"].
- //
- // Template Options:
- //
- // - `api_key` will include they obfuscated or hashed key.
- // - `client_ip` will include the ip of the request.
- // - `host` will include the host of the request.
- // - `method` will include the request method.
- // - `path` will include the path of the request.
- // - `protocol` will include the protocol of the request.
- // - `remote_addr` will include the remote address of the request.
- // - `upstream_address` will include the upstream address (scheme, host and path)
- // - `upstream_latency` will include the upstream latency of the request.
- // - `latency_total` will include the total latency of the request.
- // - `user_agent` will include the user agent of the request.
- // - `status` will include the response status code.
- Template []string `json:"template"`
-}
- AccessLogsConfig defines the type of transactions logs printed to stdout.
-
type AnalyticsConfigConfig struct {
// Set empty for a Self-Managed installation or `rpc` for multi-cloud.
Type string `json:"type"`
@@ -5383,10 +5359,6 @@
// If not set or left empty, it will default to `standard`.
LogFormat string `json:"log_format"`
- // AccessLogs configures the output for access logs.
- // If not configured, the access log is disabled.
- AccessLogs AccessLogsConfig `json:"access_logs"`
-
// Section for configuring OpenTracing support
// Deprecated: use OpenTelemetry instead.
Tracer Tracer `json:"tracing"`
@@ -8243,10 +8215,6 @@
func (t *BaseMiddleware) OrgSessionExpiry(orgid string) int64
-func (t *BaseMiddleware) RecordAccessLog(req *http.Request, resp *http.Response, latency analytics.Latency)
- RecordAccessLog is used for Success/Error handler logging. It emits a log
- entry with populated access log fields.
-
func (t *BaseMiddleware) SetName(name string)
func (t *BaseMiddleware) SetOrgExpiry(orgid string, expiry int64)
@@ -12642,8 +12610,6 @@
manipulate
func MyPluginReturningError(rw http.ResponseWriter, r *http.Request)
-# Package: ./tests/accesslog
-
# Package: ./tests/coprocess
package coprocess // import "github.com/TykTechnologies/tyk/tests/coprocess" |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested improvements to the GoDocs
Co-authored-by: andyo-tyk <[email protected]>
Co-authored-by: andyo-tyk <[email protected]>
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to approve the change made to the comment, but I can't review the code changes.
User description
TT-11909
Description
TT-11909
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
Bug fix, Tests, Enhancement
Description
Added
RespectExpiry
field toKeyRetentionPeriod
for session lifetime handling.Updated logic to respect key expiration in
Fill
andExtractTo
methods.Introduced unit tests for
KeyRetentionPeriod
to validate new functionality.Enhanced OpenAPI schema with
respectExpiry
property forkeyRetentionPeriod
.Changes walkthrough 📝
authentication.go
Add `RespectExpiry` field and update logic
apidef/oas/authentication.go
RespectExpiry
field toKeyRetentionPeriod
struct.Fill
andExtractTo
methods to handleRespectExpiry
.Value
logic to align withSessionLifetime
.x-tyk-api-gateway.json
Update OpenAPI schema with `respectExpiry`
apidef/oas/schema/x-tyk-api-gateway.json
respectExpiry
property tokeyRetentionPeriod
schema.authentication_test.go
Add tests for `KeyRetentionPeriod` and `RespectExpiry`
apidef/oas/authentication_test.go
KeyRetentionPeriod
functionality.RespectExpiry
behavior inExtractTo
andFill
methods.oas_test.go
Remove redundant test case
apidef/oas/oas_test.go
SessionLifetimeRespectsKeyExpiration
.