diff --git a/netlify/functions/nerdgraph/nerdgraph.ts b/netlify/functions/nerdgraph/nerdgraph.ts new file mode 100644 index 0000000..9f7e371 --- /dev/null +++ b/netlify/functions/nerdgraph/nerdgraph.ts @@ -0,0 +1,24 @@ +import {Handler, HandlerContext, HandlerEvent} from "@netlify/functions"; +import axios from 'axios'; + +export const handler: Handler = async (event: HandlerEvent, context: HandlerContext) => { + try { + const apiKey = event.headers['Api-Key']; + const query = event.body; + const response = await axios.post('https://api.newrelic.com/graphql', // use account token to get a temp user token + query, + {headers: {'Api-Key': apiKey, 'Content-Type': 'application/json'}}); + + const data = await response.data; + return { + headers: {'Content-Type': 'application/json'}, + statusCode: 200, + body: JSON.stringify(data) + } + } catch (error) { + return { + statusCode: 500, + body: JSON.stringify(error) + } + } +}; \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 787c037..7f3068a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -25,7 +25,7 @@ export class App { constructor() { const config = AppConfig.config; const logger = log.getLogger('App'); - log.enableAll(true); + //log.enableAll(true); log.setDefaultLevel('info'); //log.getLogger('App').setLevel('info'); diff --git a/src/controllers/right.ts b/src/controllers/right.ts index ec468b8..b77b763 100644 --- a/src/controllers/right.ts +++ b/src/controllers/right.ts @@ -3,6 +3,7 @@ import {Scene, Vector3, WebXRControllerComponent, WebXRDefaultExperience, WebXRI import {Controllers} from "./controllers"; import log from "loglevel"; import {DiagramManager} from "../diagram/diagramManager"; +import {NewRelicData} from "../integration/newRelic/newRelicData"; export class Right extends Base { constructor(controller: @@ -21,6 +22,8 @@ export class Right extends Base { if (bbutton) { bbutton.onButtonStateChangedObservable.add((button) => { if (button.pressed) { + const newRelic = new NewRelicData(); + newRelic.getNewRelicData(); this.controllers.controllerObserver.notifyObservers({type: 'b-button', value: button.value}); } }); diff --git a/src/integration/newRelic/newRelicData.ts b/src/integration/newRelic/newRelicData.ts new file mode 100644 index 0000000..c0b03b3 --- /dev/null +++ b/src/integration/newRelic/newRelicData.ts @@ -0,0 +1,18 @@ +export class NewRelicData { + private readonly key: string; + private readonly account: string; + + constructor() { + + } + + public async getNewRelicData() { + try { + + } catch (err) { + console.log(err); + } + + } + +} \ No newline at end of file