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

[Choreo Connect 1.2.0] Analytics - Optimize Custom Data Provider #3526

Open
Manasha11 opened this issue May 22, 2024 · 0 comments
Open

[Choreo Connect 1.2.0] Analytics - Optimize Custom Data Provider #3526

Manasha11 opened this issue May 22, 2024 · 0 comments

Comments

@Manasha11
Copy link

Description

If a Custom Data Provider class is implemented, the method [1] is being invoked twice at [2]. This can be optimzed.

[1] https://github.com/wso2/product-microgateway/blob/main/samples/analytics-custom-data-provider/src/main/java/org/wso2/carbon/apimgt/gateway/sample/publisher/CustomDataProvider.java#L36
[2] https://github.com/wso2/product-microgateway/blob/main/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java#L227-L228

Steps to Reproduce

  1. Create a Custom Analytics Data Provider JAR similar to [1] and add logs for tracking purposes between lines [2] and [3].
  2. Mount the above Jar to <CC_HOME>/resources/enforcer/dropins folder.
  3. Create a Custom Reporter JAR similar to [4].
  4. Mount the above Jar to <CC_HOME>/resources/enforcer/dropins folder.
  5. Add new loggers to the Enforcer by adding the following configuration.
logger.org-wso2-analytics-publisher.name = org.wso2.carbon.apimgt.gateway.sample.publisher
logger.org-wso2-analytics-publisher.level = TRACE
logger.org-wso2-analytics-publisher.appenderRef.CARBON_TRACE_LOGFILE.ref = ENFORCER_ANALYTICS

logger.org-wso2-analytics-reporter.name = org.wso2.am.analytics.publisher
logger.org-wso2-analytics-reporter.level = TRACE
logger.org-wso2-analytics-reporter.appenderRef.CARBON_TRACE_LOGFILE.ref = ENFORCER_ANALYTICS
  1. Append the newly added loggers as below.
    loggers = org-wso2-analytics-publisher, org-wso2-analytics-reporter, enforcer, io-swagger-v3, enforcer-interceptors, carbon-apimgt

  2. Update the <CC_HOME>/docker-compose/choreo-connect(-with-apim)/conf/config.toml file with the following configurations.

[analytics]
    enabled = true
    type = "ELK"
[analytics.adapter]
    bufferFlushInterval = "1s"
    bufferSizeBytes = 16384
    gRPCRequestTimeout = "20s"
[analytics.adapter.customProperties]
    enabled = true
    requestHeaders = ["host","content-type","content-length", "authorization","x-forwarded-for","x-original-forwarded-for","x-client-dn", ":path", ":authority"]
    responseHeaders = ["etag", "content-length"]
[analytics.enforcer]
    [analytics.enforcer.configProperties]
    "publisher.reporter.class" = "org.wso2.am.analytics.publisher.sample.reporter.CustomReporter"
    "publisher.custom.data.provider.class" = "org.wso2.carbon.apimgt.gateway.sample.publisher.CustomDataProvider"
  1. Deploy an API in Choreo Connect, generate a token and Invoke it.

Version

1.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant