<commit_before>/*
 * Copyright 2016 DiffPlug
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.diffplug.common.rx;

import java.util.List;
import java.util.function.BiPredicate;

import rx.Observable;

import com.diffplug.common.base.DurianPlugins;
import com.diffplug.common.base.Errors;
import com.diffplug.common.base.StackDumper;
import com.diffplug.common.util.concurrent.ListenableFuture;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * Plugin which gets notified of every call to {@link Rx#subscribe Rx.subscribe}, allowing various kinds of tracing.
 * <p>
 * By default, no tracing is done. To enable tracing, do one of the following:
 * <ul>
 * <li>Execute this at the very beginning of your application: {@code DurianPlugins.set(RxTracingPolicy.class, new MyTracingPolicy());}</li>
 * <li>Set this system property: {@code durian.plugins.com.diffplug.common.rx.RxTracingPolicy=fully.qualified.name.to.MyTracingPolicy}</li>
 * </ul>
 * {@link LogSubscriptionTrace} is a useful tracing policy for debugging errors within callbacks.
 * @see DurianPlugins
 */
public interface RxTracingPolicy {
	/**
	 * Given an observable, and an {@link Rx} which is about to be subscribed to this observable,
	 * return a (possibly instrumented) {@code Rx}.
	 * 
	 * @param observable The {@link IObservable}, {@link Observable}, or {@link ListenableFuture} which is about to be subscribed to.
	 * @param listener The {@link Rx} which is about to be subscribed.
	 * @return An {@link Rx} which may (or may not) be instrumented.  To ensure that the program's behavior<commit_msg>Moved StackDumper to durian-debug from durian-base.<commit_after>/*
 * Copyright 2016 DiffPlug
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.diffplug.common.rx;

import java.util.List;
import java.util.function.BiPredicate;

import rx.Observable;

import com.diffplug.common.base.DurianPlugins;
import com.diffplug.common.base.Errors;
import com.diffplug.common.debug.StackDumper;
import com.diffplug.common.util.concurrent.ListenableFuture;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * Plugin which gets notified of every call to {@link Rx#subscribe Rx.subscribe}, allowing various kinds of tracing.
 * <p>
 * By default, no tracing is done. To enable tracing, do one of the following:
 * <ul>
 * <li>Execute this at the very beginning of your application: {@code DurianPlugins.set(RxTracingPolicy.class, new MyTracingPolicy());}</li>
 * <li>Set this system property: {@code durian.plugins.com.diffplug.common.rx.RxTracingPolicy=fully.qualified.name.to.MyTracingPolicy}</li>
 * </ul>
 * {@link LogSubscriptionTrace} is a useful tracing policy for debugging errors within callbacks.
 * @see DurianPlugins
 */
public interface RxTracingPolicy {
	/**
	 * Given an observable, and an {@link Rx} which is about to be subscribed to this observable,
	 * return a (possibly instrumented) {@code Rx}.
	 * 
	 * @param observable The {@link IObservable}, {@link Observable}, or {@link ListenableFuture} which is about to be subscribed to.
	 * @param listener The {@link Rx} which is about to be subscribed.
	 * @return An {@link Rx} which may (or may not) be instrumented.  To ensure that the program's behavior
{'fraction_non_alphanumeric': 0.09688013136288999, 'fraction_numerical': 0.003753225428102275, 'mean_word_length': 4.4596670934699105, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4513', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1170, 'n_words': 476}