diff options
author | 2019-10-17 20:21:21 +0300 | |
---|---|---|
committer | 2019-10-23 15:01:37 +0000 | |
commit | 94f6b1b726958471e2103c65f1330d17b7dec28a (patch) | |
tree | b1054889e00f5a0698bef99bc6fd2d1bee2c2676 /vid-app-common/src/main/java/org | |
parent | e8d29ab5e3775472f59a4997fa3a5df9319de306 (diff) |
register MSO Client to MetricLogClientFilter
Issue-ID: VID-253
Change-Id: Id0e3f13e62170da41981d74dbb5b92e8d3d1b69c
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java index 91b288998..0585a4736 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java @@ -20,10 +20,6 @@ package org.onap.vid.mso; -import static org.onap.vid.logging.Headers.INVOCATION_ID; -import static org.onap.vid.logging.Headers.PARTNER_NAME; -import static org.onap.vid.utils.Logging.ONAP_REQUEST_ID_HEADER_KEY; -import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY; import static org.onap.vid.utils.Logging.getMethodCallerName; import static org.onap.vid.utils.Logging.getMethodName; @@ -40,6 +36,7 @@ import javax.ws.rs.core.Response; import org.apache.commons.codec.binary.Base64; import org.eclipse.jetty.util.security.Password; import org.glassfish.jersey.client.ClientProperties; +import org.onap.logging.filter.base.MetricLogClientFilter; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.vid.aai.util.HttpClientMode; import org.onap.vid.aai.util.HttpsAuthClient; @@ -107,12 +104,8 @@ public class RestMsoImplementation { MultivaluedHashMap<String, Object> commonHeaders = new MultivaluedHashMap(); commonHeaders.put("Authorization", Collections.singletonList(("Basic " + authStringEnc))); - commonHeaders.put(PARTNER_NAME.getHeaderName(), Collections.singletonList(PARTNER_NAME.getHeaderValue())); String requestIdValue = Logging.extractOrGenerateRequestId(); - commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue)); - commonHeaders.put(ONAP_REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue)); - commonHeaders.put(INVOCATION_ID.getHeaderName(), Collections.singletonList(INVOCATION_ID.getHeaderValue())); boolean useSsl = true; if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) { @@ -121,11 +114,13 @@ public class RestMsoImplementation { if (client == null) { try { - if ( useSsl ) { - client = httpsAuthClient.getClient(HttpClientMode.WITHOUT_KEYSTORE); - } + if ( useSsl ) { + client = httpsAuthClient.getClient(HttpClientMode.WITHOUT_KEYSTORE); + registerClientToMetricLogClientFilter(client); + } else { client = HttpBasicClient.getClient(); + registerClientToMetricLogClientFilter(client); } } catch (Exception e) { logger.info(EELFLoggerDelegate.errorLogger,methodname + " Unable to get the SSL client"); @@ -135,6 +130,11 @@ public class RestMsoImplementation { return commonHeaders; } + private void registerClientToMetricLogClientFilter(Client client) { + MetricLogClientFilter metricLogClientFilter = new MetricLogClientFilter(); + client.register(metricLogClientFilter); + } + public <T> RestObject<T> GetForObject(String path, Class<T> clazz) { final String methodName = getMethodName(); logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {})", getMethodCallerName(), methodName, path, clazz); |