Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Trigger config Id migration support
Browse files Browse the repository at this point in the history
Reviewed By: yukonfb

Differential Revision: D36331575

fbshipit-source-id: a2b18fe44449ef27a9c94ee746b478b8189181f7
  • Loading branch information
aandreyeu authored and facebook-github-bot committed Jun 3, 2022
1 parent 67c41c4 commit 485398d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions java/main/com/facebook/profilo/core/ProfiloConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public final class ProfiloConstants {
public static final String TIME_SOURCE_PARAM = "provider.stack_trace.time_source";
public static final String TRACE_CONFIG_COINFLIP_SAMPLE_RATE =
"trace_config.coinflip_sample_rate";
public static final String TRACE_CONFIG_TRACE_CONFIG_ID_SWITCH =
"trace_config.trace_config_id_switch";
public static final String TRACE_CONFIG_ID = "trace_config.id";

public static int packRemoteAbortReason(int abortReason) {
return (abortReason | REMOTE_PROCESS_BIT);
Expand Down
17 changes: 16 additions & 1 deletion java/main/com/facebook/profilo/core/TraceOrchestrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package com.facebook.profilo.core;

import static com.facebook.profilo.core.ProfiloConstants.TRACE_CONFIG_ID;
import static com.facebook.profilo.core.ProfiloConstants.TRACE_CONFIG_TRACE_CONFIG_ID_SWITCH;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Process;
Expand Down Expand Up @@ -394,6 +397,18 @@ public void onTraceStop(TraceContext context) {
syncProviders = mSyncTraceProviders;
}
if (mIsMainProcess) {
boolean useTraceConfigId =
context.mTraceConfigExtras.getBoolParam(TRACE_CONFIG_TRACE_CONFIG_ID_SWITCH, false);
long configId = 0;
if (useTraceConfigId) {
String configIdStr = context.mTraceConfigExtras.getStringParam(TRACE_CONFIG_ID, null);
if (configIdStr != null) {
configId = Long.parseLong(configIdStr);
}
}
if (configId == 0 && context.config != null) {
configId = context.config.getID();
}
BufferLogger.writeStandardEntry(
context.mainBuffer,
Logger.FILL_TIMESTAMP | Logger.FILL_TID,
Expand All @@ -402,7 +417,7 @@ public void onTraceStop(TraceContext context) {
ProfiloConstants.NONE,
Identifiers.CONFIG_ID,
ProfiloConstants.NONE,
context.config == null ? 0 : context.config.getID());
configId);
}

int tracingProviders = 0;
Expand Down

0 comments on commit 485398d

Please sign in to comment.