wso2 / product-micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
204 stars 221 forks source link

[Bug]: 404 Errors for APIs after enabling CustomObservabilityHandler #3604

Closed AselaPathirage closed 1 month ago

AselaPathirage commented 2 months ago

Description

We created a carbon app with an API that has multiple versions. We observed that '404' errors occur when invoking APIs whose versions are defined after enabling the configuration mentioned in documentation [1].

[[synapse_handlers]]
name="CustomObservabilityHandler"
class="org.wso2.micro.integrator.observability.metric.handler.MetricHandler"

[1] https://apim.docs.wso2.com/en/4.2.0/observe/micro-integrator/setting-up-cloud-native-observability-on-a-vm/#step-14-set-up-the-micro-integratorthe

Steps to Reproduce

We have created a Carbon application with APIs in multiple versions (v1, v2, and a default version).

<api context="/admin" name="adminone" xmlns="http://ws.apache.org/ns/synapse">
<api context="/admin" name="admin-v1" version="v1" version-type="url" xmlns="http://ws.apache.org/ns/synapse">
<api context="/admin" name="admin-v2" version="v2" version-type="url" xmlns="http://ws.apache.org/ns/synapse">

After adding the configurations mentioned above [1], we encountered an issue where invoking API endpoints for versions other than v1 results in a 404 error, while version v1 works correctly. Disabling the configuration resolves the issue and allows all versions to function as expected.

The above behaviour can also be seen when the APIs are created as follows,

<api context="/admintest" name="admintest" xmlns="http://ws.apache.org/ns/synapse">
<api context="/admintest/v2" name="admintest-v2" xmlns="http://ws.apache.org/ns/synapse">

Affected Version(s)

wso2mi-4.2.0

OS, DB, other environment details and versions

No response

Related issue(s) (optional)

https://github.com/wso2/micro-integrator/issues/3082

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response