This repository was archived by the owner on Mar 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Use Datadog reserved Status field, send error messages if no added fields #19
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2fc279a
use the datadog status field and add error message for non plugin errors
ewucc 98dbc56
Merge branch 'main' of https://github.com/klothoplatform/klotho into …
ewucc ea09cef
Adding send entry field to send message unsanitized
ewucc dbb51aa
simplify func
ewucc 53cdbe3
add godoc
ewucc 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 hidden or 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 |
---|---|---|
|
@@ -34,6 +34,7 @@ var ( | |
) | ||
|
||
var datadogLogLevel = "_logLevel" | ||
var datadogStatus = "status" | ||
|
||
func NewClient(properties map[string]interface{}) (*Client, error) { | ||
result, err := getTrackingFileContents(analyticsFile) | ||
|
@@ -81,16 +82,20 @@ func (t *Client) Debug(event string) { | |
|
||
func (t *Client) Warn(event string) { | ||
t.Properties[datadogLogLevel] = Warn | ||
t.Properties[datadogStatus] = Warn | ||
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. were we always sending the logs, just classifying them as Info? I thought we send the "klotho compiling failed" as info, but also with the error logs and thats what was also missing |
||
t.track(event) | ||
} | ||
|
||
func (t *Client) Error(event string) { | ||
t.Properties[datadogLogLevel] = Error | ||
t.Properties[datadogStatus] = Error | ||
t.track(event) | ||
} | ||
|
||
func (t *Client) Panic(event string) { | ||
t.Properties[datadogLogLevel] = Panic | ||
// Using error since datadog does not support panic for the reserved status field | ||
t.Properties[datadogStatus] = Error | ||
t.track(event) | ||
} | ||
|
||
|
This file contains hidden or 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 hidden or 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 hidden or 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
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.
So how does
status
differ from_logLevel
? From the docs, it seems like `status is the correct one to use so why send both?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.
yeh I was confused by this in their docs initially also. So _loglevel allows you to specify whatever level you want and you can filter on it from the DD console. The status one though only allows the pre-defined (info, warn, error) and we can't modify that, but that causes the colorized fields in DD

So it's not entirely necessary since we filter on the _loglevel, but it gives you a quicker at a glance view since it will color the actual log entries instead of treating everything as info and blue by default.
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.
Can we switch our usage of
_loglevel
tostatus
? I don't think we really care about the levels it doesn't support.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.
we could, but it doesn't have things like debug/panic which currently i set to the closest relevant so debug -> info and panic -> error. If we're ok with losing granularity I can change that to just use status, but it didn't seem like we needed to consolidate and afaik it doesnt change costs in any way either so i left both.