From 38ecee2b6e4813212bfce7b57964ed17d9bf6a30 Mon Sep 17 00:00:00 2001 From: Iliyan Velichkov Date: Thu, 21 Nov 2024 12:36:31 +0200 Subject: [PATCH] more details in js and ts endpoints Signed-off-by: Iliyan Velichkov --- .../endpoint/JavascriptEndpoint.java | 29 ++++++++++++------- .../engine/typescript/TypeScriptEndpoint.java | 29 ++++++++++++------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/components/engine/engine-javascript/src/main/java/org/eclipse/dirigible/components/engine/javascript/endpoint/JavascriptEndpoint.java b/components/engine/engine-javascript/src/main/java/org/eclipse/dirigible/components/engine/javascript/endpoint/JavascriptEndpoint.java index 69248e5666..5a0b318cca 100644 --- a/components/engine/engine-javascript/src/main/java/org/eclipse/dirigible/components/engine/javascript/endpoint/JavascriptEndpoint.java +++ b/components/engine/engine-javascript/src/main/java/org/eclipse/dirigible/components/engine/javascript/endpoint/JavascriptEndpoint.java @@ -145,7 +145,7 @@ public List getDTS() throws IOException { * @param params the params * @return the response */ - @WithSpan("java_script_endpoint") + @WithSpan("java_script_endpoint_get") @GetMapping(HTTP_PATH_MATCHER) public ResponseEntity get(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @@ -302,8 +302,10 @@ protected String normalizePath(String path) { * @param params the params * @return the response */ + @WithSpan("java_script_endpoint_post") @PostMapping(HTTP_PATH_MATCHER) - public ResponseEntity post(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity post(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return executeJavaScript(projectName, projectFilePath, params, null); } @@ -317,9 +319,10 @@ public ResponseEntity post(@PathVariable("projectName") String projectName, @ * @param file the file * @return the response */ + @WithSpan("java_script_endpoint_post_file") @PostMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data") - public ResponseEntity postFile(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity postFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params, @Validated @RequestParam("file") MultipartFile[] file) { return executeJavaScript(projectName, projectFilePath, params, file); @@ -333,8 +336,10 @@ public ResponseEntity postFile(@PathVariable("projectName") String projectNam * @param params the params * @return the response */ + @WithSpan("java_script_endpoint_put") @PutMapping(HTTP_PATH_MATCHER) - public ResponseEntity put(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity put(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return executeJavaScript(projectName, projectFilePath, params, null); } @@ -348,9 +353,10 @@ public ResponseEntity put(@PathVariable("projectName") String projectName, @P * @param file the file * @return the response */ + @WithSpan("java_script_endpoint_put_file") @PutMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data") - public ResponseEntity putFile(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity putFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params, @Validated @RequestParam("file") MultipartFile file) { return executeJavaScript(projectName, projectFilePath, params, new MultipartFile[] {file}); @@ -365,7 +371,9 @@ public ResponseEntity putFile(@PathVariable("projectName") String projectName * @return the response */ @PatchMapping(HTTP_PATH_MATCHER) - public ResponseEntity patch(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + @WithSpan("java_script_endpoint_patch") + public ResponseEntity patch(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return executeJavaScript(projectName, projectFilePath, params, null); } @@ -378,9 +386,10 @@ public ResponseEntity patch(@PathVariable("projectName") String projectName, * @param params the params * @return the response */ + @WithSpan("java_script_endpoint_delete") @DeleteMapping(HTTP_PATH_MATCHER) - public ResponseEntity delete(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity delete(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return executeJavaScript(projectName, projectFilePath, params, null); } diff --git a/components/engine/engine-typescript/src/main/java/org/eclipse/dirigible/components/engine/typescript/TypeScriptEndpoint.java b/components/engine/engine-typescript/src/main/java/org/eclipse/dirigible/components/engine/typescript/TypeScriptEndpoint.java index 871f046d24..2de9b1afb8 100644 --- a/components/engine/engine-typescript/src/main/java/org/eclipse/dirigible/components/engine/typescript/TypeScriptEndpoint.java +++ b/components/engine/engine-typescript/src/main/java/org/eclipse/dirigible/components/engine/typescript/TypeScriptEndpoint.java @@ -52,7 +52,7 @@ public TypeScriptEndpoint(JavascriptEndpoint javascriptEndpoint) { * @param params the params * @return the response entity */ - @WithSpan("type_script_endpoint") + @WithSpan("type_script_endpoint_get") @GetMapping(HTTP_PATH_MATCHER) public ResponseEntity get(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @@ -86,8 +86,10 @@ private String replaceTSWithJSExtension(String projectFilePath) { * @param params the params * @return the response entity */ + @WithSpan("type_script_endpoint_post") @PostMapping(HTTP_PATH_MATCHER) - public ResponseEntity post(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity post(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return javascriptEndpoint.post(projectName, replaceTSWithJSExtension(projectFilePath), params); } @@ -101,9 +103,10 @@ public ResponseEntity post(@PathVariable("projectName") String projectName, @ * @param file the file * @return the response entity */ + @WithSpan("type_script_endpoint_post_file") @PostMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data") - public ResponseEntity postFile(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity postFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params, @Validated @RequestParam("file") MultipartFile[] file) { return javascriptEndpoint.postFile(projectName, replaceTSWithJSExtension(projectFilePath), params, file); @@ -117,8 +120,10 @@ public ResponseEntity postFile(@PathVariable("projectName") String projectNam * @param params the params * @return the response entity */ + @WithSpan("type_script_endpoint_put") @PutMapping(HTTP_PATH_MATCHER) - public ResponseEntity put(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity put(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return javascriptEndpoint.put(projectName, replaceTSWithJSExtension(projectFilePath), params); } @@ -132,9 +137,10 @@ public ResponseEntity put(@PathVariable("projectName") String projectName, @P * @param file the file * @return the response entity */ + @WithSpan("type_script_endpoint_put_file") @PutMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data") - public ResponseEntity putFile(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity putFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params, @Validated @RequestParam("file") MultipartFile file) { return javascriptEndpoint.putFile(projectName, replaceTSWithJSExtension(projectFilePath), params, file); @@ -148,8 +154,10 @@ public ResponseEntity putFile(@PathVariable("projectName") String projectName * @param params the params * @return the response entity */ + @WithSpan("type_script_endpoint_patch") @PatchMapping(HTTP_PATH_MATCHER) - public ResponseEntity patch(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity patch(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return javascriptEndpoint.patch(projectName, replaceTSWithJSExtension(projectFilePath), params); } @@ -162,9 +170,10 @@ public ResponseEntity patch(@PathVariable("projectName") String projectName, * @param params the params * @return the response entity */ + @WithSpan("type_script_endpoint_delete") @DeleteMapping(HTTP_PATH_MATCHER) - public ResponseEntity delete(@PathVariable("projectName") String projectName, - @PathVariable("projectFilePath") String projectFilePath, + public ResponseEntity delete(@SpanAttribute("projectName") @PathVariable("projectName") String projectName, + @SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath, @Nullable @RequestParam(required = false) MultiValueMap params) { return javascriptEndpoint.delete(projectName, replaceTSWithJSExtension(projectFilePath), params); }