-
Notifications
You must be signed in to change notification settings - Fork 20
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
Update header for logs search endpoints #2173
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Search logs (GET) returns "OK" response with pagination | ||
|
||
require "datadog_api_client" | ||
api_instance = DatadogAPIClient::V2::LogsAPI.new | ||
api_instance.list_logs_get_with_pagination() { |item| puts item } | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Search logs returns "OK" response | ||
|
||
require "datadog_api_client" | ||
api_instance = DatadogAPIClient::V2::LogsAPI.new | ||
|
||
body = DatadogAPIClient::V2::LogsListRequest.new({ | ||
filter: DatadogAPIClient::V2::LogsQueryFilter.new({ | ||
query: "datadog-agent", | ||
indexes: [ | ||
"main", | ||
], | ||
Comment on lines
+9
to
+11
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. ⚪ Code Quality ViolationConsider using the %W syntax instead (...read more)The rule "Prefer This rule is important because it helps to keep the code concise and easy to read. The To follow this rule, replace the traditional array syntax with the |
||
from: "2020-09-17T11:48:36+01:00", | ||
to: "2020-09-17T12:48:36+01:00", | ||
}), | ||
sort: DatadogAPIClient::V2::LogsSort::TIMESTAMP_ASCENDING, | ||
page: DatadogAPIClient::V2::LogsListRequestPage.new({ | ||
limit: 5, | ||
}), | ||
}) | ||
opts = { | ||
body: body, | ||
} | ||
p api_instance.list_logs(opts) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Search logs (POST) returns "OK" response with pagination | ||
|
||
require "datadog_api_client" | ||
api_instance = DatadogAPIClient::V2::LogsAPI.new | ||
|
||
body = DatadogAPIClient::V2::LogsListRequest.new({ | ||
filter: DatadogAPIClient::V2::LogsQueryFilter.new({ | ||
from: "now-15m", | ||
indexes: [ | ||
"main", | ||
"web", | ||
], | ||
Comment on lines
+9
to
+12
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. ⚪ Code Quality ViolationConsider using the %W syntax instead (...read more)The rule "Prefer This rule is important because it helps to keep the code concise and easy to read. The To follow this rule, replace the traditional array syntax with the |
||
query: "service:web* AND @http.status_code:[200 TO 299]", | ||
storage_tier: DatadogAPIClient::V2::LogsStorageTier::INDEXES, | ||
to: "now", | ||
}), | ||
options: DatadogAPIClient::V2::LogsQueryOptions.new({ | ||
timezone: "GMT", | ||
}), | ||
page: DatadogAPIClient::V2::LogsListRequestPage.new({ | ||
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", | ||
limit: 25, | ||
}), | ||
sort: DatadogAPIClient::V2::LogsSort::TIMESTAMP_ASCENDING, | ||
}) | ||
opts = { | ||
body: body, | ||
} | ||
api_instance.list_logs_with_pagination(opts) { |item| puts item } |
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.
⚪ Code Quality Violation
Do not use parentheses with methods that take no arguments (...read more)
The rule "Avoid parentheses when methods take no arguments" is part of the Ruby style guide. It suggests that when a method takes no arguments, you should not use parentheses. This is because the use of parentheses in such a case is redundant and unnecessary, and it can make your code more difficult to read and understand.
This rule is important because it promotes cleaner, more readable code. In Ruby, clean and readable code is highly valued. By following this rule, you can ensure your code is easier to understand and maintain, which is crucial for long-term project success.
To adhere to this rule, remove the parentheses when calling a method that does not require any arguments. For example, instead of writing
'test'.upcase()
, you should write'test'.upcase
. Similarly, instead ofKernel.exit!()
, writeKernel.exit!
. However, note that there is an exception forsuper
-super
by itself is different fromsuper()
, so in this case, parentheses may be necessary.