Activities of "Denis"

How I can make APM also to catch Exceptions then? I want APM to catch exception before ABP does that. I guess APM proxies exception further

Please do these steps as well

  1. Create new Controller in HttpApi project
  2. Create some service in Application project, which throws an exception
  3. Make Controller call to call the service
  1. Create new ABP Application
  2. Integrate Elastic following instruction https://www.elastic.co/guide/en/apm/agent/dotnet/current/configuration-on-asp-net-core.html
  3. Create and endpoint which throws some exception
  4. Call this endpoint and check Elastic APM

I am not able to get Exceptions to be recorded by Elastic APM. It seems like Exception are handled by some other middleware and not released to Elastic middleware. I placed Use Elastic APM on the top of OnApplicationInitialization. That did not help. So far it seems only exceptions on EF core are caught by Elastic APM. I tested with general Exception thrown by me - even that Exception is not caught

  • ABP Framework version: v7.X.X
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): tiered
  • Exception message and stack trace: -
  • Steps to reproduce the issue:" I used this instruction https://www.elastic.co/guide/en/apm/agent/dotnet/current/configuration-on-asp-net-core.html

Sure,

Controller

[HttpGet]
[Route("by-dateTime/{utcDateTime}")]
public async Task<RecordDto> GetRecordByDateTime(DateTime utcDateTime)
        {
            return await _recordAppService.GetRecordByDateTime(utcDateTime);
        }

Application service

public async Task<RecordDto> GetRecordByDateTime([DisableDateTimeNormalization] DateTime utcDateTime)
        {
            var record = await _recordRepository.GetAsync(i => i.UtcDateTime == utcDateTime);

            return await ObjectMapper.Map<RecordDto>(record);
        }

Microservice A gets call of url path /api/records/by-dateTime/27/12/2021 10:00:00. The format of date time is default format in InvariantCulture used by HttpClient.

But the issue relates not only to DateTime. It relates to any object which has special symbols in string presentation. For example, if we replace DateTime with string parameter, which value has space symbol inside, then we get problem again, because space can not be used without encoding in url path.

Hi

I have issue with GET endpoint which accepts DateTime as parameter. I have microservices 2 A and B. The endpoint is implemented by A and called by B. For calling I use dynamic HttpApiClient. When DateTime passed to http client as parameter, the DateTime is stringified to string with ToString method. Then the string passed to url parameters pasrt without encoded to url format. That leads, when DaeTime stringified to 'dd/MM/yy hh:mm:ss' format, endpoint is not found because dd MM and yy are parsed as segments of url path.

Is that a bug in http client? I checked ClientProxyUrlBuilder and I think that it should use HttpUtility.UrlEncode for every passed value.ToString() - snippet

  • ABP Framework version: v4.4.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): separate
  • Steps to reproduce the issue:
  1. Create GET endpoint which accepts DateTime as parameter
  2. Reference HttpApiClient project/package in another application or try to use client in the same application with the endpoint
  3. Add call of the endpoint

Some details and rephrasing... The job is placed in application level of module A. The job uses app service from module B. In monotlith, app service interface is resolved to app service, which provided by B. If service has auth protection then job gets error. I would like to apply some workaround... implement internal version of service in B, which will not be exposed to controllers. Internal service implements the same interface (eg IBookAppService). Then, I would like internal version of service injected in monolith deployment. But in microservices deployment client proxy should be injected

Thus, we have 3 implementations of app service interface

  1. App service - used for controllers. Protected
  2. Internal App service - used for internal communication in monolith. Internal service implementation is reused by App service for controllers
  3. Http Client - used in microservice depployment

@gterdem Thank yor for reply. But my question is about how to make Background Worker of module A to pull data from module B in way that will work in monolith and microservice deployments

Hi,

We are developing systems which consists of several Modules. We faced with some troubles in managing of communication between them. Right now, we have only monolith deployment. That means all our Modules are referenced by single ABP Host Application (which generated by ABP Suite). We referenced all Modules accordingly architecure of layers

Application -> Application Contracts -> Contracts ...

in Host Application. We have Module A which needs to coomunicate with Module B.

  1. The first question is how to setup references and DI which fit for monolith and microservices deployment Right now, in Module B, we have Background Worker. This worker makes call to module A. For that, in Background Worker class, we reference IBookService of Module B. In monolith it is resolved to BookService, which implemented by module A. What is okay, we do not have authorization issues because authorization is disabled. But when we will place Modules in different service, what we need to do so IBookService will be resolved to HttpApiClient, so call will be made over http?
  2. The second question is what to do when we will add authorization to endpoints in IBookService? After that, we will start getting auth error, because Background Workder does not have authorization context. As solution, we are going to make InternalBookService implementing IBookService, which will implement logic of BookService. That time, BookService will just call InternalBookService. Thus, Background Worker also access to InternalBookService, instead of BookService which is remote. Question is how to manage DI? In monolith we have BookService registered first, and we will get BookService injected to our BackgroundWorker. But we would want InternalBookService injected instead and be still able to move module B to separate service
  • ABP Framework version: v4.3.0

Actually both ways work. The reasl reason is ABP comes with not default languages included into supported cultures. You need to add them into AbpLocalization yourself

Showing 1 to 10 of 46 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09