-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(plugins)(datadog): add a datadog tag for the route name to each metric #13494
Open
tysoekong
wants to merge
3
commits into
master
Choose a base branch
from
feat/datadog-plugin-route-tag
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+104
−3
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
9afb491
feat(plugins)(datadog): add a datadog tag for the route name to each …
tysoekong 22f9497
feat(plugins)(datadog): add a datadog tag for the route name to each …
tysoekong dd625a6
feat(plugins)(datadog): add a datadog tag for the route name to each …
tysoekong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
message: | | ||
Added the route name to a built-in tag in the Datadog plugin, | ||
to each of the output metrics. | ||
type: feature | ||
scope: Plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,11 @@ local get_consumer_id = { | |
} | ||
|
||
|
||
local function compose_tags(service_name, status, consumer_id, tags, conf) | ||
local function compose_tags(service_name, status, consumer_id, tags, conf, route_name) | ||
local result = { | ||
(conf.service_name_tag or "name") .. ":" .. service_name, | ||
(conf.status_tag or "status") .. ":" .. status | ||
(conf.status_tag or "status") .. ":" .. status, | ||
route_name and route_name ~= "" and ((conf.route_name_tag or "route") .. ":" .. route_name) | ||
} | ||
|
||
if consumer_id ~= nil then | ||
|
@@ -86,7 +87,10 @@ local function send_entries_to_datadog(conf, messages) | |
message.service and gsub(message.service.name ~= null and | ||
message.service.name or message.service.host, "%.", "_") or "", | ||
message.response and message.response.status or "-", | ||
consumer_id, metric_config.tags, conf) | ||
consumer_id, metric_config.tags, | ||
conf, | ||
message.route and (message.route.name and gsub(message.route.name ~= null and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this passing |
||
message.route.name, "%.", "_") or message.route.id) or "") | ||
|
||
logger:send_statsd(stat_name, stat_value, | ||
logger.stat_types[metric_config.stat_type], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think the checks
route_name and route_name ~= ""
can be omitted right? We know it'll either have a value or be""
, and in case it's""
we probably want to just use it like that, or else this evaluation will returnfalse
, am I right?