com.newrelic.agent.attributes.AgentAttributeSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of newrelic-agent Show documentation
Show all versions of newrelic-agent Show documentation
The New Relic Java agent for full-stack observability
/*
*
* * Copyright 2020 New Relic Corporation. All rights reserved.
* * SPDX-License-Identifier: Apache-2.0
*
*/
package com.newrelic.agent.attributes;
import com.newrelic.agent.Transaction;
import java.util.Map;
public class AgentAttributeSender extends AttributeSender {
protected static String ATTRIBUTE_TYPE = "agent";
public AgentAttributeSender() {
super(new AttributeValidator(ATTRIBUTE_TYPE));
}
@Override
protected String getAttributeType() {
return ATTRIBUTE_TYPE;
}
@Override
protected Map getAttributeMap() {
Transaction currentTxn = Transaction.getTransaction(false);
if (currentTxn != null) {
return currentTxn.getAgentAttributes();
} else {
return null;
}
}
}