Skip to content
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

extend-monetization-phase3 #12735

Draft
wants to merge 53 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1549d48
added Graphql Operation info inside a separate analytic event.
HimanshiDeSilva May 5, 2024
7fabc7d
add return type
HimanshiDeSilva May 7, 2024
fcd4966
Remove the newly added index and published into the same previous one
HimanshiDeSilva May 15, 2024
226c49a
Add relevant http methods in graphql subscriptions
HimanshiDeSilva May 25, 2024
4ee6698
Add NonNull instance check in fields.
HimanshiDeSilva May 25, 2024
609d603
Fix exception handling
HimanshiDeSilva May 25, 2024
a4b7715
Add query name in graphql subscription events
HimanshiDeSilva May 25, 2024
59c6323
Move changes to stable git branch
Chilliwiddit Nov 4, 2024
690cf92
Add changes for reflection
Chilliwiddit Nov 8, 2024
99c0c7e
Polish code
Chilliwiddit Nov 12, 2024
9336669
Additional polishing
Chilliwiddit Nov 12, 2024
85c9fbe
Add changes for toml
Chilliwiddit Nov 13, 2024
bcd24fd
Add analytics impl
Chilliwiddit Nov 13, 2024
73b4a0f
Add default xml value
Chilliwiddit Nov 13, 2024
16f67ca
Finalize and move class
Chilliwiddit Nov 13, 2024
bd916d1
Add reading for analytics_impl
Chilliwiddit Nov 13, 2024
fde63db
Merge remote-tracking branch 'upstream/master'
Chilliwiddit Nov 14, 2024
8f1bb63
Remove AnalyticsConfigurationDto
Chilliwiddit Nov 18, 2024
d09cfb1
Change FQN
Chilliwiddit Nov 18, 2024
136770b
Remove FQN default value
Chilliwiddit Nov 18, 2024
c8c16f4
Merge pull request #12449 from HimanshiDeSilva/graphql-analytics-new
senthuran16 Nov 21, 2024
8cda8d0
Fix publishing analytics event after responseSize calculation in WebS…
senthuran16 Nov 21, 2024
26659bc
Merge pull request #12706 from senthuran16/fix-websocket-analytics-pu…
senthuran16 Nov 21, 2024
8cb9fba
Merge tag 'v9.29.135' into extend-monetization
Chilliwiddit Nov 25, 2024
1ebdd40
Move changes to stable git branch
Chilliwiddit Nov 4, 2024
1a9115d
Add changes for reflection
Chilliwiddit Nov 8, 2024
94ef63f
Polish code
Chilliwiddit Nov 12, 2024
a4efa71
Additional polishing
Chilliwiddit Nov 12, 2024
e17beef
Add changes for toml
Chilliwiddit Nov 13, 2024
aa1368f
Add analytics impl
Chilliwiddit Nov 13, 2024
cfbab9e
Add default xml value
Chilliwiddit Nov 13, 2024
0d8bac3
Finalize and move class
Chilliwiddit Nov 13, 2024
1172db5
Add reading for analytics_impl
Chilliwiddit Nov 13, 2024
3bcaf3c
Remove AnalyticsConfigurationDto
Chilliwiddit Nov 18, 2024
13a7ef6
Change FQN
Chilliwiddit Nov 18, 2024
69c37fe
Remove FQN default value
Chilliwiddit Nov 18, 2024
204e520
Remove extra QUERY variable
Chilliwiddit Nov 25, 2024
fb6eaec
Refactor sse analytics logic
Chilliwiddit Nov 25, 2024
31ce231
Implement webhook response size publishing
Chilliwiddit Nov 29, 2024
b11ce79
Update MonetizationUsageInfo
Chilliwiddit Dec 2, 2024
ae09738
Create child of subscription policy
Chilliwiddit Dec 2, 2024
d64634f
Change ExtendedSubscriptionPolicy
Chilliwiddit Dec 3, 2024
81bf319
Change SubscriptionPolicy
Chilliwiddit Dec 3, 2024
349ff16
Implement workflow refactoring (part 1)
Chilliwiddit Dec 17, 2024
e70e6bb
Create AbstractMonetization to prevent cyclic dependency
Chilliwiddit Dec 17, 2024
5ea4698
Remove delete and monetize subscription parent methods
Chilliwiddit Dec 17, 2024
d95aeb6
Remove delete and monetize subscription child methods
Chilliwiddit Dec 17, 2024
03fdfc0
Add default getMonetizationSubscriptionClass method
Chilliwiddit Dec 17, 2024
4c80029
Add execution of monetization subscription class
Chilliwiddit Dec 17, 2024
343895b
Fix remove subscription and execute flow
Chilliwiddit Jan 3, 2025
e9197c0
Merge branch 'wso2:master' into master
Chilliwiddit Jan 3, 2025
897309e
Merge with master
Chilliwiddit Jan 3, 2025
856857b
Merge with extend-monetization
Chilliwiddit Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/apimgt/org.wso2.carbon.apimgt.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<groupId>org.wso2.orbit.graphQL</groupId>
<artifactId>graphQL</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.common.analytics</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.wso2.carbon.apimgt.api.model;

import org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException;

public interface AnalyticsforMonetization {
/**
* Gets Usage Data from Analytics Provider
*
* @param monetizationUsagePublishInfo monetization publish info
* @return usage data from analytics provider
* @throws AnalyticsException if the action failed
*/
Object getUsageData(MonetizationUsagePublishInfo monetizationUsagePublishInfo) throws AnalyticsException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package org.wso2.carbon.apimgt.api.model;

import java.util.HashMap;

public class MonetizationUsageInfo {

Long currentTimestamp;
String apiUuid;
String apiName;
String apiVersion;
String tenantDomain;
String applicationName;
String applicationOwner;
HashMap<String, Object> customAttributes;
Long requestCount;
Long depth;
Long complexity;
Long payloadSize;

public MonetizationUsageInfo(Long payloadSize, Long complexity, Long depth, Long requestCount, HashMap<String, Object> customAttributes, String applicationOwner, String applicationName, String tenantDomain, String apiVersion, String apiName, String apiUuid, Long currentTimestamp) {
this.payloadSize = payloadSize;
this.complexity = complexity;
this.depth = depth;
this.requestCount = requestCount;
this.customAttributes = customAttributes;
this.applicationOwner = applicationOwner;
this.applicationName = applicationName;
this.tenantDomain = tenantDomain;
this.apiVersion = apiVersion;
this.apiName = apiName;
this.apiUuid = apiUuid;
this.currentTimestamp = currentTimestamp;
}

public Long getCurrentTimestamp() {
return currentTimestamp;
}

public void setCurrentTimestamp(Long currentTimestamp) {
this.currentTimestamp = currentTimestamp;
}

public String getApiUuid() {
return apiUuid;
}

public void setApiUuid(String apiUuid) {
this.apiUuid = apiUuid;
}

public String getApiName() {
return apiName;
}

public void setApiName(String apiName) {
this.apiName = apiName;
}

public String getApiVersion() {
return apiVersion;
}

public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}

public String getTenantDomain() {
return tenantDomain;
}

public void setTenantDomain(String tenantDomain) {
this.tenantDomain = tenantDomain;
}

public String getApplicationName() {
return applicationName;
}

public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}

public String getApplicationOwner() {
return applicationOwner;
}

public void setApplicationOwner(String applicationOwner) {
this.applicationOwner = applicationOwner;
}

public HashMap<String, Object> getCustomAttributes() {
return customAttributes;
}

public void setCustomAttributes(HashMap<String, Object> customAttributes) {
this.customAttributes = customAttributes;
}

public Long getRequestCount() {
return requestCount;
}

public void setRequestCount(Long requestCount) {
this.requestCount = requestCount;
}

public Long getDepth() {
return depth;
}

public void setDepth(Long depth) {
this.depth = depth;
}

public Long getComplexity() {
return complexity;
}

public void setComplexity(Long complexity) {
this.complexity = complexity;
}

public Long getPayloadSize() {
return payloadSize;
}

public void setPayloadSize(Long payloadSize) {
this.payloadSize = payloadSize;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,20 @@ public class SubscriptionPolicy extends Policy {
private String tierQuotaType;
private int graphQLMaxDepth;
private int graphQLMaxComplexity;
private String usageMetric;

public SubscriptionPolicy(String name) {
super(name);
}

public String getUsageMetric() {
return usageMetric;
}

public void setUsageMetric(String usageMetric) {
this.usageMetric = usageMetric;
}

public int getRateLimitCount() {
return rateLimitCount;
}
Expand Down Expand Up @@ -121,12 +130,20 @@ public void setGraphQLMaxComplexity(int graphQLMaxComplexity) {

@Override
public String toString() {
return "SubscriptionPolicy [rateLimitCount=" + rateLimitCount + ", rateLimitTimeUnit=" + rateLimitTimeUnit
+ ", customAttributes=" + Arrays.toString(customAttributes) + ", stopOnQuotaReach=" + stopOnQuotaReach
+ ", billingPlan=" + billingPlan + ", monetizationPlan=" + monetizationPlan
+ ", monetizationPlanProperties=" + monetizationPlanProperties + ", tierQuotaType=" + tierQuotaType
+ ", maxDepth=" + graphQLMaxDepth + ", maxComplexity=" + graphQLMaxComplexity
+ ", subscriberCount= " + subscriberCount + "]";
return "SubscriptionPolicy{" +
"rateLimitCount=" + rateLimitCount +
", rateLimitTimeUnit='" + rateLimitTimeUnit + '\'' +
", subscriberCount=" + subscriberCount +
", customAttributes=" + Arrays.toString(customAttributes) +
", stopOnQuotaReach=" + stopOnQuotaReach +
", billingPlan='" + billingPlan + '\'' +
", monetizationPlan='" + monetizationPlan + '\'' +
", monetizationPlanProperties=" + monetizationPlanProperties +
", tierQuotaType='" + tierQuotaType + '\'' +
", graphQLMaxDepth=" + graphQLMaxDepth +
", graphQLMaxComplexity=" + graphQLMaxComplexity +
", usageMetric='" + usageMetric + '\'' +
'}';
}

public int getSubscriberCount() {
Expand Down
Loading