-
Notifications
You must be signed in to change notification settings - Fork 83
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-9873 Fix prometheus tracking path #716
Conversation
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.
looks good, only fix the typo
pumps/prometheus.go
Outdated
@@ -42,6 +42,9 @@ type PrometheusConf struct { | |||
AggregateObservations bool `json:"aggregate_observations" mapstructure:"aggregate_observations"` | |||
// Metrics to exclude from exposition. Currently, excludes only the base metrics. | |||
DisabledMetrics []string `json:"disabled_metrics" mapstructure:"disabled_metrics"` | |||
// Specifies if it should expose aggregated metrics for all the endpoints. By default, `false` | |||
// which means that all APIs endpoints will be counted as 'uknown' unless the API use track endpoint plugin. |
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.
fix typo unknown
pumps/prometheus.go
Outdated
@@ -245,6 +248,11 @@ func (p *PrometheusPump) WriteData(ctx context.Context, data []interface{}) erro | |||
default: | |||
} | |||
record := item.(analytics.AnalyticsRecord) | |||
|
|||
if !(p.conf.TrackAllPaths || record.TrackPath) { | |||
record.Path = "unknown" |
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.
Just a small comment: Setting a const here will make it easier to read and avoid typos if we need to work on this again in the future. I'd set a UnknowPath const and use it here and in the unit test, wdyt?
/release to release-1.8 |
Working on it! Note that it can take a few minutes. |
* Fix prometheus tracking path * suggested fixes (cherry picked from commit 69f5f4a)
@tbuchaillot Succesfully merged PR |
TT-9873 Fix prometheus tracking path (#716) * Fix prometheus tracking path * suggested fixes
Description
This PR change fixes the tracking path behavior of Prometheus pump. It was tracking all the paths by default, ignoring if the API/analytic record has TrackPath enabled.
Now, when you don't have TrackPath enabled ( aka you are using Track Endpoint plugin), it will log the path as
unknown
.This also adds a new configuration for prometheus pump
track_all_paths
- that enables the path tracking for ALL the APIs (similar to Mongo/SQL aggregate pumps) - but this can cause Tyk Pump malfunctioning and OOM.Related Issue
https://tyktech.atlassian.net/browse/TT-9873
Motivation and Context
https://tyktech.atlassian.net/browse/TT-9873
How This Has Been Tested
Added tests
Screenshots (if appropriate)
Types of changes
Checklist
fork, don't request your
master
!master
branch (left side). Also, you should startyour branch off our latest
master
.go mod tidy && go mod vendor
go fmt -s
go vet