-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[DataUsage][Serverless] Fix auto ops URL path suffix #200192
Merged
neptunian
merged 26 commits into
elastic:main
from
ashokaditya:task/fix-data-usage-autoops-api-integration-path
Nov 18, 2024
+133
−82
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5ce1b98
url path suffix
ashokaditya 1d84582
redundant
ashokaditya 3b0bde9
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine 7b76372
fixed the appContext setup
YulNaumenko eacba27
fixed logs factory
YulNaumenko 8a88b7b
fix types/params
ashokaditya d01c2bb
Merge branch 'main' into task/fix-data-usage-autoops-api-integration-…
ashokaditya 8213f5a
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine 590e978
fix logger
ashokaditya 23d06d1
fix tests
ashokaditya 0c99b66
-
YulNaumenko 6781f2f
fix text project id
neptunian 8e22e4a
Merge branch 'main' into task/fix-data-usage-autoops-api-integration-…
neptunian c234a1b
fixed schema for AutoOps API request
YulNaumenko 7e266b2
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 0373154
date format to be ISO
YulNaumenko d1e52db
-
YulNaumenko 445f9d4
removed logs
YulNaumenko 14aab01
fixed expected response
YulNaumenko 5dc1143
fixed test
YulNaumenko 5185ed6
cleanup
ashokaditya ed2e693
Merge branch 'main' into task/fix-data-usage-autoops-api-integration-…
ashokaditya f8e86b5
abort requests
ashokaditya e3c6aa7
add traceparent
ashokaditya c661d0d
add a traceparent
ashokaditya 9cc5aa9
review changes
ashokaditya 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
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
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
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
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
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 |
---|---|---|
|
@@ -12,23 +12,23 @@ import { | |
UsageMetricsRequestBody, | ||
UsageMetricsResponseSchemaBody, | ||
} from '../../../common/rest_types'; | ||
import { DataUsageRequestHandlerContext } from '../../types'; | ||
import { DataUsageService } from '../../services'; | ||
import { DataUsageContext, DataUsageRequestHandlerContext } from '../../types'; | ||
|
||
import { errorHandler } from '../error_handler'; | ||
import { CustomHttpRequestError } from '../../utils'; | ||
import { DataUsageService } from '../../services'; | ||
|
||
const formatStringParams = <T extends string>(value: T | T[]): T[] | MetricTypes[] => | ||
typeof value === 'string' ? [value] : value; | ||
|
||
export const getUsageMetricsHandler = ( | ||
dataUsageService: DataUsageService | ||
dataUsageContext: DataUsageContext | ||
): RequestHandler<never, unknown, UsageMetricsRequestBody, DataUsageRequestHandlerContext> => { | ||
const logger = dataUsageService.getLogger('usageMetricsRoute'); | ||
|
||
return async (context, request, response) => { | ||
const logger = dataUsageContext.logFactory.get('usageMetricsRoute'); | ||
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. same here, please move it to the handler level. 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. fixed |
||
try { | ||
const core = await context.core; | ||
|
||
const esClient = core.elasticsearch.client.asCurrentUser; | ||
|
||
logger.debug(`Retrieving usage metrics`); | ||
|
@@ -59,6 +59,8 @@ export const getUsageMetricsHandler = ( | |
new CustomHttpRequestError('Failed to retrieve data streams', 400) | ||
); | ||
} | ||
|
||
const dataUsageService = new DataUsageService(logger); | ||
const metrics = await dataUsageService.getMetrics({ | ||
from, | ||
to, | ||
|
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.
It could be moved to the handler now as it was before (line 17)