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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.ignite.lang.IgniteExperimental;
import org.apache.ignite.mxbean.MetricsMxBean;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.tracing.FilePerformanceStatisticsWriter;
import org.apache.ignite.stream.StreamTransformer;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -137,6 +138,10 @@
import static org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.DFLT_DISCO_FAILED_CLIENT_RECONNECT_DELAY;
import static org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.DFLT_NODE_IDS_HISTORY_SIZE;
import static org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.DFLT_THROTTLE_RECONNECT_RESET_TIMEOUT_INTERVAL;
import static org.apache.ignite.spi.tracing.FilePerformanceStatisticsWriter.DFLT_BUFFER_SIZE;
import static org.apache.ignite.spi.tracing.FilePerformanceStatisticsWriter.DFLT_CACHED_STRINGS_THRESHOLD;
import static org.apache.ignite.spi.tracing.FilePerformanceStatisticsWriter.DFLT_FILE_MAX_SIZE;
import static org.apache.ignite.spi.tracing.FilePerformanceStatisticsWriter.DFLT_FLUSH_SIZE;
import static org.apache.ignite.startup.cmdline.CommandLineStartup.DFLT_PROG_NAME;

/**
Expand Down Expand Up @@ -1935,6 +1940,38 @@ public final class IgniteSystemProperties {
defaults = "" + DFLT_DUMP_TX_COLLISIONS_INTERVAL)
public static final String IGNITE_DUMP_TX_COLLISIONS_INTERVAL = "IGNITE_DUMP_TX_COLLISIONS_INTERVAL";

/**
* Performance statistics maximum file size in bytes. Performance statistics will be stopped when the size exceeded.
* The default value is {@link FilePerformanceStatisticsWriter#DFLT_FILE_MAX_SIZE}.
*/
@SystemProperty(value = "Performance statistics maximum file size in bytes. Performance statistics will be " +
"stopped when the size exceeded", type = Long.class, defaults = "" + DFLT_FILE_MAX_SIZE)
public static final String IGNITE_PERF_STAT_FILE_MAX_SIZE = "IGNITE_PERF_STAT_FILE_MAX_SIZE";

/**
* Performance statistics off heap buffer size in bytes. The default value is
* {@link FilePerformanceStatisticsWriter#DFLT_BUFFER_SIZE}.
*/
@SystemProperty(value = "Performance statistics off heap buffer size in bytes", type = Integer.class,
defaults = "" + DFLT_BUFFER_SIZE)
public static final String IGNITE_PERF_STAT_BUFFER_SIZE = "IGNITE_PERF_STAT_BUFFER_SIZE";

/**
* Performance statistics minimal batch size to flush in bytes. The default value is
* {@link FilePerformanceStatisticsWriter#DFLT_FLUSH_SIZE}.
*/
@SystemProperty(value = "Performance statistics minimal batch size to flush in bytes", type = Integer.class,
defaults = "" + DFLT_FLUSH_SIZE)
public static final String IGNITE_PERF_STAT_FLUSH_SIZE = "IGNITE_PERF_STAT_FLUSH_SIZE";

/**
* Performance statistics maximum cached strings threshold. String caching will stop on threshold excess.
* The default value is {@link FilePerformanceStatisticsWriter#DFLT_CACHED_STRINGS_THRESHOLD}.
*/
@SystemProperty(value = "Performance statistics maximum cached strings threshold. String caching will stop on " +
"threshold excess", type = Integer.class, defaults = "" + DFLT_CACHED_STRINGS_THRESHOLD)
public static final String IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD = "IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD";

/**
* Enforces singleton.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
import org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.processors.tracing.MTC;
import org.apache.ignite.internal.processors.tracing.Span;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
Expand Down Expand Up @@ -169,6 +171,8 @@
import static org.apache.ignite.internal.processors.metric.impl.MetricUtils.cacheMetricsRegistryName;
import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_NO_FAILOVER;
import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBGRID;
import static org.apache.ignite.internal.processors.tracing.SpanType.CACHE_GET;
import static org.apache.ignite.internal.processors.tracing.SpanType.CACHE_PUT;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
Expand Down Expand Up @@ -1467,27 +1471,33 @@ private boolean evictx(K key, GridCacheVersion ver,
@Nullable @Override public V get(K key) throws IgniteCheckedException {
A.notNull(key, "key");

boolean statsEnabled = ctx.statisticsEnabled();
Span span = ctx.kernalContext().tracing().create(CACHE_GET, MTC.span());

long start = statsEnabled ? System.nanoTime() : 0L;
try (MTC.TraceSurroundings ignored = MTC.support(span)) {
span.addTag("cacheId", () -> String.valueOf(ctx.cacheId()));

boolean keepBinary = ctx.keepBinary();
boolean statsEnabled = ctx.statisticsEnabled();

if (keepBinary)
key = (K)ctx.toCacheKeyObject(key);
long start = statsEnabled ? System.nanoTime() : 0L;

V val = repairableGet(key, !keepBinary, false);
boolean keepBinary = ctx.keepBinary();

if (ctx.config().getInterceptor() != null) {
key = keepBinary ? (K)ctx.unwrapBinaryIfNeeded(key, true, false) : key;
if (keepBinary)
key = (K)ctx.toCacheKeyObject(key);

val = (V)ctx.config().getInterceptor().onGet(key, val);
}
V val = repairableGet(key, !keepBinary, false);

if (statsEnabled)
metrics0().addGetTimeNanos(System.nanoTime() - start);
if (ctx.config().getInterceptor() != null) {
key = keepBinary ? (K)ctx.unwrapBinaryIfNeeded(key, true, false) : key;

return val;
val = (V)ctx.config().getInterceptor().onGet(key, val);
}

if (statsEnabled)
metrics0().addGetTimeNanos(System.nanoTime() - start);

return val;
}
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -2565,21 +2575,27 @@ public IgniteInternalFuture<V> getAndPutAsync0(final K key,
*/
public boolean put(final K key, final V val, final CacheEntryPredicate filter)
throws IgniteCheckedException {
boolean statsEnabled = ctx.statisticsEnabled();
Span span = ctx.kernalContext().tracing().create(CACHE_PUT, MTC.span());

long start = statsEnabled ? System.nanoTime() : 0L;
try (MTC.TraceSurroundings ignored = MTC.support(span)) {
span.addTag("cacheId", () -> String.valueOf(ctx.cacheId()));

A.notNull(key, "key", val, "val");
boolean statsEnabled = ctx.statisticsEnabled();

if (keyCheck)
validateCacheKey(key);
long start = statsEnabled ? System.nanoTime() : 0L;

boolean stored = put0(key, val, filter);
A.notNull(key, "key", val, "val");

if (statsEnabled && stored)
metrics0().addPutTimeNanos(System.nanoTime() - start);
if (keyCheck)
validateCacheKey(key);

return stored;
boolean stored = put0(key, val, filter);

if (statsEnabled && stored)
metrics0().addPutTimeNanos(System.nanoTime() - start);

return stored;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ private void leave() {
@Override public void close() {
Span span = MTC.span();

span.addTag("commited", () -> String.valueOf(!tx.isRollbackOnly()));
span.addTag("cacheIds", () -> tx.txState().cacheIds().toString());

try (TraceSurroundings ignored =
MTC.support(cctx.kernalContext().tracing().create(TX_CLOSE, span))) {
enter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,13 @@ public enum SpanType {
SQL_CACHE_UPDATE(Scope.SQL, "sql.cache.update", 69),

/** Processing of incoming batch. */
SQL_BATCH_PROCESS(Scope.SQL, "sql.batch.process", 70);
SQL_BATCH_PROCESS(Scope.SQL, "sql.batch.process", 70),

/** */
CACHE_GET(Scope.CACHE_API, "cache.get", 71, true),

/** */
CACHE_PUT(Scope.CACHE_API, "cache.put", 72, true);

/** Scope */
private Scope scope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public class GridTracingConfigurationManager implements TracingConfigurationMana
new TracingConfigurationCoordinates.Builder(Scope.SQL).build(),
TracingConfigurationManager.DEFAULT_SQL_CONFIGURATION);

tmpDfltConfigurationMap.put(
new TracingConfigurationCoordinates.Builder(Scope.CACHE_API).build(),
TracingConfigurationManager.DEFAULT_CACHE_API_CONFIGURATION);

DEFAULT_CONFIGURATION_MAP = Collections.unmodifiableMap(tmpDfltConfigurationMap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public enum TracingSpiType {
NOOP_TRACING_SPI((byte)0),

/** */
OPEN_CENSUS_TRACING_SPI((byte)1);
OPEN_CENSUS_TRACING_SPI((byte)1),

/** */
PERFORMANCE_STATISTICS_TRACING_SPI((byte)2);

/** Byte index of a tracing spi instance. */
private final byte idx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ public GridNioServer<Message> resetNioServer() throws IgniteCheckedException {

List<GridNioFilter> filters = new ArrayList<>();

if (tracing instanceof GridTracingManager && ((GridManager)tracing).enabled())
if (tracing instanceof GridTracingManager && ((GridManager)tracing).enabled() && false)
filters.add(new GridNioTracerFilter(log, tracing));

filters.add(new GridNioCodecFilter(parser, log, true));
Expand Down
Loading