Add IO Event tracking to graylog.

This commit is contained in:
Patrick Fic
2021-12-08 09:25:55 -08:00
parent 22a5c4a12d
commit 26d22388c0
2 changed files with 30 additions and 9 deletions

View File

@@ -6,9 +6,10 @@ import { WebSocketLink } from "@apollo/client/link/ws";
import { getMainDefinition } from "@apollo/client/utilities";
//import { split } from "apollo-link";
import apolloLogger from "apollo-link-logger";
import axios from "axios";
import { auth } from "../firebase/firebase.utils";
import errorLink from "../graphql/apollo-error-handling";
import { store } from "../redux/store";
const httpLink = new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
});
@@ -47,7 +48,19 @@ const roundTripLink = new ApolloLink((operation, forward) => {
});
const TrackExecutionTime = async (operationName, time) => {
//await axios.post("/ioevent", { operationName, time, dbevent: true });
const rdxStore = store.getState();
try {
console.log("trying");
axios.post("/ioevent", {
operationName,
time,
dbevent: true,
user: rdxStore.user.currentUser.email,
imexshopid: rdxStore.user.bodyshop.imexshopid,
});
} catch (error) {
console.log("IOEvent Error", error);
}
};
const subscriptionMiddleware = {