diff --git a/adapter/internal/oasparser/model/adapter_internal_api.go b/adapter/internal/oasparser/model/adapter_internal_api.go index 7de18d068..f5278b3c4 100644 --- a/adapter/internal/oasparser/model/adapter_internal_api.go +++ b/adapter/internal/oasparser/model/adapter_internal_api.go @@ -1164,7 +1164,7 @@ func (adapterInternalAPI *AdapterInternalAPI) SetInfoGRPCRouteCR(grpcRoute *gwap if outputAuthScheme != nil { authScheme = *outputAuthScheme } - var apiPolicy *dpv1alpha2.APIPolicy + var apiPolicy *dpv1alpha3.APIPolicy if outputAPIPolicy != nil { apiPolicy = *outputAPIPolicy } @@ -1285,7 +1285,7 @@ func (adapterInternalAPI *AdapterInternalAPI) SetInfoGRPCRouteCR(grpcRoute *gwap resourcePath := adapterInternalAPI.GetXWso2Basepath() + "." + *match.Method.Service + "/" + *match.Method.Method endPoints = append(endPoints, GetEndpoints(backendName, resourceParams.BackendMapping)...) resource := &Resource{path: resourcePath, pathMatchType: "Exact", - methods: []*Operation{{iD: uuid.New().String(), method: "post", policies: policies, + methods: []*Operation{{iD: uuid.New().String(), method: "GRPC", policies: policies, auth: apiAuth, rateLimitPolicy: parseRateLimitPolicyToInternal(resourceRatelimitPolicy), scopes: scopes}}, iD: uuid.New().String(), } diff --git a/adapter/internal/operator/utils/utils.go b/adapter/internal/operator/utils/utils.go index 1d569cbe7..9cffae7dc 100644 --- a/adapter/internal/operator/utils/utils.go +++ b/adapter/internal/operator/utils/utils.go @@ -628,7 +628,7 @@ func GetBackendJWT(ctx context.Context, client k8client.Client, namespace, // GetAIProvider reads AIProvider when aiProviderReference is given func GetAIProvider(ctx context.Context, client k8client.Client, namespace string, - aiProviderReference string, api *dpv1alpha2.API) *dpv1alpha3.AIProvider { + aiProviderReference string, api *dpv1beta1.API) *dpv1alpha3.AIProvider { aiProvider := &dpv1alpha3.AIProvider{} aiProviderRef := types.NamespacedName{ Namespace: namespace, diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/collectors/impl/SuccessRequestDataCollector.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/collectors/impl/SuccessRequestDataCollector.java index 5089b66af..db328cb7e 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/collectors/impl/SuccessRequestDataCollector.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/collectors/impl/SuccessRequestDataCollector.java @@ -32,6 +32,8 @@ import org.wso2.apk.enforcer.commons.analytics.publishers.dto.Target; import org.wso2.apk.enforcer.commons.analytics.publishers.impl.SuccessRequestDataPublisher; +import java.util.Objects; + /** * Success request data collector. */ @@ -81,6 +83,9 @@ public void collectData() throws AnalyticsException { } event.setApi(api); + if (Objects.equals(api.getApiType(), "GRPC")) { + operation.setApiMethod("GRPC"); + } event.setOperation(operation); event.setTarget(target); event.setApplication(application); @@ -91,7 +96,6 @@ public void collectData() throws AnalyticsException { event.setUserAgentHeader(userAgent); event.setUserName(userName); event.setUserIp(userIp); - this.processor.publish(event); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/ResourceConfig.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/ResourceConfig.java index 2d938a80e..e70bc8559 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/ResourceConfig.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/ResourceConfig.java @@ -42,7 +42,7 @@ public class ResourceConfig { public enum HttpMethods { GET("get"), POST("post"), PUT("put"), DELETE("delete"), HEAD("head"), PATCH("patch"), OPTIONS("options"), QUERY("query"), MUTATION("mutation"), - SUBSCRIPTION("subscription"); + SUBSCRIPTION("subscription"), GRPC("GRPC"); private String value; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java index 0eb82d008..85dc35773 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java @@ -229,7 +229,6 @@ public void handleFailureRequest(RequestContext requestContext) { analyticsSpanScope = analyticsSpan.getSpan().makeCurrent(); Utils.setTag(analyticsSpan, APIConstants.LOG_TRACE_ID, ThreadContext.get(APIConstants.LOG_TRACE_ID)); - } if (publisher == null) { logger.error("Cannot publish the failure event as analytics publisher is null.",