Skip to content

Commit

Permalink
Merge pull request #342 from newrelic/fix/trace-id-reporting/NR-321827
Browse files Browse the repository at this point in the history
Report trace.id and span.id in all JSONs
  • Loading branch information
lovesh-ap authored Nov 6, 2024
2 parents d62f25e + 814ce7a commit 3d94339
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.newrelic.agent.security.AgentInfo;
import com.newrelic.agent.security.instrumentator.utils.AgentUtils;
import com.newrelic.agent.security.instrumentator.utils.INRSettingsKey;
import com.newrelic.api.agent.NewRelic;
import com.newrelic.api.agent.TraceMetadata;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
Expand Down Expand Up @@ -80,6 +82,9 @@ public AgentBasicInfo() {
setGroupName(AgentConfig.getInstance().getGroupName());
setNodeId(AgentInfo.getInstance().getLinkingMetadata().getOrDefault(INRSettingsKey.NR_ENTITY_GUID, StringUtils.EMPTY));
setLinkingMetadata(new HashMap<>(AgentInfo.getInstance().getLinkingMetadata()));
TraceMetadata traceMetadata = NewRelic.getAgent().getTraceMetadata();
linkingMetadata.put(NR_APM_TRACE_ID, traceMetadata.getTraceId());
linkingMetadata.put(NR_APM_SPAN_ID, traceMetadata.getSpanId());
setAppEntityGuid(AgentInfo.getInstance().getLinkingMetadata().getOrDefault(INRSettingsKey.NR_ENTITY_GUID, StringUtils.EMPTY));
setAppAccountId(AgentConfig.getInstance().getConfig().getCustomerInfo().getAccountId());
setApplicationUUID(AgentInfo.getInstance().getApplicationUUID());
Expand Down

0 comments on commit 3d94339

Please sign in to comment.