diff options
author | Mohannad Farrag <aymanm@google.com> | 2023-10-16 16:51:14 +0000 |
---|---|---|
committer | Mohannad Farrag <aymanm@google.com> | 2023-11-08 13:41:12 +0000 |
commit | ed9328293b2439f0b5ac78ce4876a83102b9c1d2 (patch) | |
tree | 4bac5d1b7e0aeb58c0168ceb264ed61908ab24a1 | |
parent | 5647d8d8ace54b5fcd7e2c5e4e12ab5270fa3fb0 (diff) | |
download | cronet-ed9328293b2439f0b5ac78ce4876a83102b9c1d2.tar.gz |
[Cherry-pick] Refactor CronetLoggerImpl to send default values
This needs to be cherry-picked into udc-mainline-prod because I'm trying to submit two CLs in the same topic, one from frameworks/proto_logging which does not automerge into udc-mainline-prod and one from external/cronet which automerges into udc-mainline-prod. So I'm doing a manual cherry-pick first.
----- Original CL ------
* This is needed in order for framework-tethering to not break the moment we change the atoms structure. The newly reported values are useless, they will
be changed once the implementation for the atoms reporting is there.
Test: m framework-tethering
Ignore-AOSP-First: This must be merged downstream first because frameworks/proto_logging does not merge into udc-mainline-prod but external/cronet does.
Change-Id: I328d79c389753c48aa0f851220c783642cb0cba4
Merged-In: I328d79c389753c48aa0f851220c783642cb0cba4
-rw-r--r-- | android/java/src/android/net/http/CronetLoggerImpl.java | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/android/java/src/android/net/http/CronetLoggerImpl.java b/android/java/src/android/net/http/CronetLoggerImpl.java index 26421fb63..142bcc46d 100644 --- a/android/java/src/android/net/http/CronetLoggerImpl.java +++ b/android/java/src/android/net/http/CronetLoggerImpl.java @@ -19,26 +19,17 @@ package android.net.http; import static java.nio.charset.StandardCharsets.UTF_8; import android.util.Log; - import androidx.annotation.VisibleForTesting; - import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; import org.chromium.net.impl.CronetLogger; -import org.chromium.net.impl.CronetLogger.CronetEngineBuilderInfo; -import org.chromium.net.impl.CronetLogger.CronetSource; -import org.chromium.net.impl.CronetLogger.CronetTrafficInfo; -import org.chromium.net.impl.CronetLogger.CronetVersion; /** Logger for logging cronet's telemetry */ public class CronetLoggerImpl extends CronetLogger { private static final String TAG = CronetLoggerImpl.class.getSimpleName(); - private static final long ENGINE_CREATED_ENGINE_ID_NOT_LOGGED = Long.MAX_VALUE; - private static final long TRAFFIC_REPORTED_ENGINE_ID_NOT_LOGGED = Long.MIN_VALUE; - private static final MessageDigest MD5_MESSAGE_DIGEST; static { @@ -76,7 +67,6 @@ public class CronetLoggerImpl extends CronetLogger { return; } - writeCronetEngineCreation(cronetEngineId, builder, version, source); } @@ -108,8 +98,7 @@ public class CronetLoggerImpl extends CronetLogger { CronetStatsLog.write( CronetStatsLog.CRONET_ENGINE_CREATED, - // TODO(b/248214707): Start logging the engine ID again. - ENGINE_CREATED_ENGINE_ID_NOT_LOGGED, + cronetEngineId, version.getMajorVersion(), version.getMinorVersion(), version.getBuildVersion(), @@ -146,7 +135,8 @@ public class CronetLoggerImpl extends CronetLogger { experimentalOptions.getStaleDnsPersistToDiskOption().getValue(), experimentalOptions.getStaleDnsPersistDelayMillisOption(), experimentalOptions.getStaleDnsUseStaleOnNameNotResolvedOption().getValue(), - experimentalOptions.getDisableIpv6OnWifiOption().getValue()); + experimentalOptions.getDisableIpv6OnWifiOption().getValue(), + /* cronet_initialization_ref = */ -1); } catch (Exception e) { // catching all exceptions since we don't want to crash the client Log.d( TAG, @@ -162,8 +152,7 @@ public class CronetLoggerImpl extends CronetLogger { try { CronetStatsLog.write( CronetStatsLog.CRONET_TRAFFIC_REPORTED, - // TODO(b/248214707): Start logging the engine ID again. - TRAFFIC_REPORTED_ENGINE_ID_NOT_LOGGED, + cronetEngineId, SizeBuckets.calcRequestHeadersSizeBucket(trafficInfo.getRequestHeaderSizeInBytes()), SizeBuckets.calcRequestBodySizeBucket(trafficInfo.getRequestBodySizeInBytes()), SizeBuckets.calcResponseHeadersSizeBucket(trafficInfo.getResponseHeaderSizeInBytes()), @@ -174,7 +163,14 @@ public class CronetLoggerImpl extends CronetLogger { (int) trafficInfo.getTotalLatency().toMillis(), trafficInfo.wasConnectionMigrationAttempted(), trafficInfo.didConnectionMigrationSucceed(), - samplesRateLimitedCount); + samplesRateLimitedCount, + /* terminal_state = */ CronetStatsLog.CRONET_TRAFFIC_REPORTED__TERMINAL_STATE__STATE_UNKNOWN, + /* user_callback_exception_count = */ -1, + /* total_idle_time_millis = */ -1, + /* total_user_executor_execute_latency_millis = */ -1, + /* read_count = */ -1, + /* on_upload_read_count = */ -1, + /* is_bidi_stream = */ CronetStatsLog.CRONET_TRAFFIC_REPORTED__IS_BIDI_STREAM__UNSET); // 0 maps to UNKNOWN } catch (Exception e) { // using addAndGet because another thread might have modified samplesRateLimited's value samplesRateLimited.addAndGet(samplesRateLimitedCount); @@ -224,4 +220,3 @@ public class CronetLoggerImpl extends CronetLogger { return ByteBuffer.wrap(md).getLong(); } } - |