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 - log the same header from both request and response #3524

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

Comments

@Manasha11
Copy link

Description

When using a custom Data Provider and a custom Reporter to publish analytics data in Choreo Connect 1.2.0, if the same header from the request and response is configured to be printed, the request header value is not getting printed and getting replaced by response header value.

Steps to Reproduce

  1. Create a Custom Analytics Data Provider JAR.
  2. Mount the above Jar to <CC_HOME>/resources/enforcer/dropins folder.
  3. Create a Custom Reporter JAR.
  4. Mount the above Jar to <CC_HOME>/resources/enforcer/dropins folder.
  5. Add new loggers to the Enforcer.
    Ex:
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.
    Ex:
[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-type"]
[analytics.enforcer]
    [analytics.enforcer.configProperties]
    "publisher.reporter.class" = "org.wso2.am.analytics.publisher.sample.reporter.CustomMetricReporter"
    "publisher.custom.data.provider.class" = "org.wso2.carbon.apimgt.gateway.sample.publisher.CustomDataProvider"

Here, I have added content-type in both requestHeaders and responseHeaders.
8. 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