Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/core/src/main/java/org/apache/ignite/Ignite.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationManager;
import org.apache.ignite.lang.IgniteExperimental;
import org.apache.ignite.spi.tracing.TracingConfigurationManager;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.plugin.IgnitePlugin;
Expand Down Expand Up @@ -755,5 +756,6 @@ public <T> IgniteQueue<T> queue(String name, int cap, @Nullable CollectionConfig
* </ul>
* @return {@link TracingConfigurationManager} instance.
*/
@IgniteExperimental
public @NotNull TracingConfigurationManager tracingConfiguration();
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import org.apache.ignite.failure.FailureHandler;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
import org.apache.ignite.spi.tracing.TracingSpi;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.processors.tracing.TracingSpi;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteAsyncCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
import org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor;
import org.apache.ignite.internal.processors.task.GridTaskProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationManager;
import org.apache.ignite.spi.tracing.TracingConfigurationManager;
import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.suggestions.JvmConfigurationSuggestions;
import org.apache.ignite.internal.suggestions.OsConfigurationSuggestions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import org.apache.ignite.internal.processors.igfs.IgfsThreadFactory;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.processors.tracing.NoopTracingSpi;
import org.apache.ignite.spi.tracing.NoopTracingSpi;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.StripedExecutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.ignite.internal.commandline.cache.argument.TracingConfigurationCommandArg;
import org.apache.ignite.internal.commandline.tracing.configuration.TracingConfigurationArguments;
import org.apache.ignite.internal.commandline.tracing.configuration.TracingConfigurationSubcommand;
import org.apache.ignite.internal.processors.tracing.Scope;
import org.apache.ignite.spi.tracing.Scope;
import org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTask;
import org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskArg;
import org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult;
Expand All @@ -46,8 +46,8 @@
import static org.apache.ignite.internal.commandline.tracing.configuration.TracingConfigurationSubcommand.GET_ALL;
import static org.apache.ignite.internal.commandline.tracing.configuration.TracingConfigurationSubcommand.RESET_ALL;
import static org.apache.ignite.internal.commandline.tracing.configuration.TracingConfigurationSubcommand.of;
import static org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS;
import static org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationParameters.SAMPLING_RATE_NEVER;
import static org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS;
import static org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER;

/**
* Commands associated with tracing configuration functionality.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

import org.apache.ignite.internal.commandline.CommandList;
import org.apache.ignite.internal.commandline.argument.CommandArg;
import org.apache.ignite.internal.processors.tracing.Scope;
import org.apache.ignite.spi.tracing.Scope;
import org.apache.ignite.internal.processors.tracing.Span;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
Expand All @@ -48,7 +47,7 @@ public enum TracingConfigurationCommandArg implements CommandArg {
* Set of {@link Scope} that defines which sub-traces will be included in given trace. In other words, if child's
* span scope is equals to parent's scope or it belongs to the parent's span included scopes, then given child span
* will be attached to the current trace, otherwise it'll be skipped. See {@link
* Span#isChainable(org.apache.ignite.internal.processors.tracing.Scope)} for more details.
* Span#isChainable(Scope)} for more details.
*/
INCLUDED_SCOPES("--included-scopes");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.Collections;
import java.util.Set;
import org.apache.ignite.internal.processors.tracing.Scope;
import org.apache.ignite.spi.tracing.Scope;
import org.apache.ignite.internal.processors.tracing.Span;
import org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationItem;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -55,7 +55,7 @@ public TracingConfigurationArguments() {
* In other words, if child's span scope is equals to parent's scope
* or it belongs to the parent's span included scopes, then given child span will be attached to the current trace,
* otherwise it'll be skipped.
* See {@link Span#isChainable(org.apache.ignite.internal.processors.tracing.Scope)} for more details.
* See {@link Span#isChainable(Scope)} for more details.
*/
private TracingConfigurationArguments(
TracingConfigurationSubcommand cmd,
Expand Down Expand Up @@ -153,7 +153,7 @@ public Builder(TracingConfigurationSubcommand cmd) {
* In other words, if child's span scope is equals to parent's scope
* or it belongs to the parent's span included scopes, then given child span will be attached to the current trace,
* otherwise it'll be skipped.
* See {@link Span#isChainable(org.apache.ignite.internal.processors.tracing.Scope)} for more details.
* See {@link Span#isChainable(Scope)} for more details.
* @return Builder
*/
@SuppressWarnings("UnusedReturnValue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ private void processRegularMessage(
Runnable c = new TraceRunnable(ctx.tracing(), COMMUNICATION_REGULAR_PROCESS) {
@Override public void execute() {
try {
MTC.span().addTag(SpanTags.MESSAGE, traceName(msg));
MTC.span().addTag(SpanTags.MESSAGE, () -> traceName(msg));

threadProcessingMessage(true, msgC);

Expand All @@ -1387,7 +1387,7 @@ private void processRegularMessage(
}
};

MTC.span().addLog("Regular process queued");
MTC.span().addLog(() -> "Regular process queued");

if (msg.topicOrdinal() == TOPIC_IO_TEST.ordinal()) {
IgniteIoTestMessage msg0 = (IgniteIoTestMessage)msg.message();
Expand Down Expand Up @@ -1790,7 +1790,7 @@ else if (log.isDebugEnabled()) {
};

try {
MTC.span().addLog("Ordered process queued");
MTC.span().addLog(() -> "Ordered process queued");

pools.poolForPolicy(plc).execute(c);
}
Expand Down Expand Up @@ -1847,7 +1847,7 @@ private void unwindMessageSet(GridCommunicationMessageSet msgSet, GridMessageLis
* @param secSubjId Security subject that will be used to open a security session.
*/
private void invokeListener(Byte plc, GridMessageListener lsnr, UUID nodeId, Object msg, UUID secSubjId) {
MTC.span().addLog("Invoke listener");
MTC.span().addLog(() -> "Invoke listener");

Byte oldPlc = CUR_PLC.get();

Expand Down Expand Up @@ -2022,7 +2022,7 @@ private void send(
assert topicOrd >= 0 || !(topic instanceof GridTopic) : msg;

try (TraceSurroundings ignored = support(null)) {
MTC.span().addLog("Create communication msg - " + traceName(msg));
MTC.span().addLog(() -> "Create communication msg - " + traceName(msg));

GridIoMessage ioMsg = createGridIoMessage(topic, topicOrd, msg, plc, ordered, timeout, skipOnTimeout);

Expand Down Expand Up @@ -3852,7 +3852,9 @@ void unwind(GridMessageListener lsnr) {
try (TraceSurroundings ignore = support(ctx.tracing().create(
COMMUNICATION_ORDERED_PROCESS, mc.parentSpan))) {
try {
MTC.span().addTag(SpanTags.MESSAGE, traceName(mc.message));
OrderedMessageContainer fmc = mc;

MTC.span().addTag(SpanTags.MESSAGE, () -> traceName(fmc.message));

invokeListener(plc, lsnr, nodeId, mc.message.message(), secSubjId(mc.message));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,26 @@
import org.apache.ignite.internal.processors.tracing.SpanImpl;
import org.apache.ignite.internal.processors.tracing.configuration.GridTracingConfigurationManager;
import org.apache.ignite.internal.processors.tracing.NoopSpan;
import org.apache.ignite.internal.processors.tracing.NoopTracingSpi;
import org.apache.ignite.internal.processors.tracing.Scope;
import org.apache.ignite.spi.tracing.NoopTracingSpi;
import org.apache.ignite.spi.tracing.Scope;
import org.apache.ignite.internal.processors.tracing.Span;
import org.apache.ignite.internal.processors.tracing.SpanTags;
import org.apache.ignite.internal.processors.tracing.SpanType;
import org.apache.ignite.internal.processors.tracing.Tracing;
import org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationCoordinates;
import org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationManager;
import org.apache.ignite.internal.processors.tracing.TracingSpi;
import org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationParameters;
import org.apache.ignite.spi.tracing.TracingConfigurationCoordinates;
import org.apache.ignite.spi.tracing.TracingConfigurationManager;
import org.apache.ignite.spi.tracing.TracingSpi;
import org.apache.ignite.spi.tracing.TracingConfigurationParameters;
import org.apache.ignite.internal.processors.tracing.messages.TraceableMessagesHandler;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.logger.NullLogger;
import org.apache.ignite.spi.IgniteSpiException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.internal.processors.tracing.SpanTags.NODE;
import static org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS;
import static org.apache.ignite.internal.processors.tracing.configuration.TracingConfigurationParameters.SAMPLING_RATE_NEVER;
import static org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS;
import static org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER;
import static org.apache.ignite.internal.util.GridClientByteUtils.bytesToInt;
import static org.apache.ignite.internal.util.GridClientByteUtils.bytesToShort;
import static org.apache.ignite.internal.util.GridClientByteUtils.intToBytes;
Expand Down Expand Up @@ -102,6 +103,13 @@ public class GridTracingManager extends GridManagerAdapter<TracingSpi> implement
/** Minor span serialization protocol version. */
private static final byte MINOR_PROTOCOL_VERSION = 0;

/** Noop traceable message handler. */
private static final TraceableMessagesHandler NOOP_TRACEABLE_MSG_HANDLER =
new TraceableMessagesHandler(new NoopTracing(), new NullLogger());

/** Flag that indicates that noop tracing spi is used. */
private boolean noop = true;

/**
* Constructor.
*
Expand All @@ -124,6 +132,8 @@ public GridTracingManager(GridKernalContext ctx, boolean useNoopTracingSpi) {
@Override public void start() throws IgniteCheckedException {
try {
startSpi();

noop = getSpi() instanceof NoopTracingSpi;
}
catch (IgniteSpiException e) {
log.warning("Failed to start tracing processor with spi: " + getSpi().getName()
Expand Down Expand Up @@ -156,18 +166,21 @@ private Span enrichWithLocalNodeParameters(@Nullable Span span) {
if (span == null)
return null;

span.addTag(SpanTags.NODE_ID, ctx.localNodeId().toString());
span.addTag(SpanTags.tag(NODE, SpanTags.NAME), ctx.igniteInstanceName());
span.addTag(SpanTags.NODE_ID, () -> ctx.localNodeId().toString());
span.addTag(SpanTags.tag(NODE, SpanTags.NAME), ctx::igniteInstanceName);

ClusterNode locNode = ctx.discovery().localNode();
if (locNode != null && locNode.consistentId() != null)
span.addTag(SpanTags.tag(NODE, SpanTags.CONSISTENT_ID), locNode.consistentId().toString());
span.addTag(SpanTags.tag(NODE, SpanTags.CONSISTENT_ID), () -> locNode.consistentId().toString());

return span;
}

/** {@inheritDoc} */
@Override public Span create(@NotNull SpanType spanType, @Nullable Span parentSpan) {
if (noop)
return NoopSpan.INSTANCE;

return enrichWithLocalNodeParameters(
generateSpan(
parentSpan,
Expand All @@ -177,6 +190,9 @@ private Span enrichWithLocalNodeParameters(@Nullable Span span) {

/** {@inheritDoc} */
@Override public Span create(@NotNull SpanType spanType, @Nullable byte[] serializedParentSpan) {
if (noop)
return NoopSpan.INSTANCE;

// 1 byte: special flags;
// 1 bytes: spi type;
// 2 bytes: major protocol version;
Expand Down Expand Up @@ -305,14 +321,21 @@ private Span enrichWithLocalNodeParameters(@Nullable Span span) {
@Nullable Span parentSpan,
@Nullable String lb
) {
return enrichWithLocalNodeParameters(generateSpan(
parentSpan,
spanType,
lb));
if (noop)
return NoopSpan.INSTANCE;

return enrichWithLocalNodeParameters(
generateSpan(
parentSpan,
spanType,
lb));
}

/** {@inheritDoc} */
@Override public byte[] serialize(@NotNull Span span) {
if (noop)
return NoopTracing.NOOP_SERIALIZED_SPAN;

// 1 byte: special flags;
// 1 bytes: spi type;
// 2 bytes: major protocol version;
Expand Down Expand Up @@ -465,6 +488,9 @@ private Span enrichWithLocalNodeParameters(@Nullable Span span) {

/** {@inheritDoc} */
@Override public TraceableMessagesHandler messages() {
if (noop)
return NOOP_TRACEABLE_MSG_HANDLER;

return msgHnd;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,7 @@ private void initAffinityOnNodeJoin(final GridDhtPartitionsExchangeFuture fut, b
return;

Span affCalcSpan = cctx.kernalContext().tracing().create(AFFINITY_CALCULATION, fut.span())
.addTag("cache.group", desc.cacheOrGroupName());
.addTag("cache.group", desc::cacheOrGroupName);

boolean latePrimary = cache.rebalanceEnabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,21 @@ else if (customMsg instanceof WalStateAbstractMessage
Span span = cctx.kernalContext().tracing().create(EXCHANGE_FUTURE, evt.span());

if (exchId != null) {
span.addTag(SpanTags.tag(SpanTags.EVENT_NODE, SpanTags.ID), evt.eventNode().id().toString());
GridDhtPartitionExchangeId exchIdf = exchId;

span.addTag(SpanTags.tag(SpanTags.EVENT_NODE, SpanTags.ID), () -> evt.eventNode().id().toString());
span.addTag(SpanTags.tag(SpanTags.EVENT_NODE, SpanTags.CONSISTENT_ID),
evt.eventNode().consistentId().toString());
span.addTag(SpanTags.tag(SpanTags.EVENT, SpanTags.TYPE), evt.type());
span.addTag(SpanTags.tag(SpanTags.EXCHANGE, SpanTags.ID), exchId.toString());
() -> evt.eventNode().consistentId().toString());
span.addTag(SpanTags.tag(SpanTags.EVENT, SpanTags.TYPE), () -> String.valueOf(evt.type()));
span.addTag(SpanTags.tag(SpanTags.EXCHANGE, SpanTags.ID), () -> String.valueOf(exchIdf.toString()));
span.addTag(SpanTags.tag(SpanTags.INITIAL, SpanTags.TOPOLOGY_VERSION, SpanTags.MAJOR),
exchId.topologyVersion().topologyVersion());
() -> String.valueOf(exchIdf.topologyVersion().topologyVersion()));
span.addTag(SpanTags.tag(SpanTags.INITIAL, SpanTags.TOPOLOGY_VERSION, SpanTags.MINOR),
exchId.topologyVersion().minorTopologyVersion());
() -> String.valueOf(exchIdf.topologyVersion().minorTopologyVersion()));
}

span.addTag(SpanTags.NODE_ID, cctx.localNodeId().toString());
span.addLog("Created");
span.addTag(SpanTags.NODE_ID, () -> cctx.localNodeId().toString());
span.addLog(() -> "Created");

exchFut.span(span);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ public void init(boolean newCrd) throws IgniteInterruptedCheckedException {
", exchangeFreeSwitch=" + exchCtx.exchangeFreeSwitch() + ']');
}

span.addLog("Exchange parameters initialization");
span.addLog(() -> "Exchange parameters initialization");

timeBag.finishGlobalStage("Exchange parameters initialization");

Expand Down Expand Up @@ -2375,13 +2375,16 @@ private String exchangeTimingsLogMessage(String header, List<String> timings) {

if (res != null) {
span.addTag(SpanTags.tag(SpanTags.RESULT, SpanTags.TOPOLOGY_VERSION, SpanTags.MAJOR),
res.topologyVersion());
() -> String.valueOf(res.topologyVersion()));
span.addTag(SpanTags.tag(SpanTags.RESULT, SpanTags.TOPOLOGY_VERSION, SpanTags.MINOR),
res.minorTopologyVersion());
() -> String.valueOf(res.minorTopologyVersion()));
}

if (err != null)
span.addTag(SpanTags.ERROR, err.toString());
if (err != null) {
Throwable errf = err;

span.addTag(SpanTags.ERROR, errf::toString);
}

try {
waitUntilNewCachesAreRegistered();
Expand Down Expand Up @@ -2527,7 +2530,7 @@ private String exchangeTimingsLogMessage(String header, List<String> timings) {
if (super.onDone(res, err)) {
afterLsnrCompleteFut.onDone();

span.addLog("Completed partition exchange");
span.addLog(() -> "Completed partition exchange");

span.end();

Expand Down Expand Up @@ -3604,7 +3607,7 @@ private void onAllReceived(@Nullable Collection<ClusterNode> sndResNodes) {
try {
initFut.get();

span.addLog("Waiting for all single messages");
span.addLog(() -> "Waiting for all single messages");

timeBag.finishGlobalStage("Waiting for all single messages");

Expand Down Expand Up @@ -3722,7 +3725,7 @@ private void finishExchangeOnCoordinator(@Nullable Collection<ClusterNode> sndRe
});
}

span.addLog("Affinity recalculation (crd)");
span.addLog(() -> "Affinity recalculation (crd)");

timeBag.finishGlobalStage("Affinity recalculation (crd)");

Expand Down
Loading