From f851e36b68614a56930b3038e552d521ff42d402 Mon Sep 17 00:00:00 2001 From: patricklafrance Date: Fri, 17 Jan 2025 21:29:10 -0500 Subject: [PATCH] Moved Honeycomb API key to an ignore Git file --- .gitignore | 1 + CONTRIBUTING.md | 29 +++++++++++++++++++ samples/endpoints/express-server/src/index.ts | 3 +- samples/endpoints/host/src/index.tsx | 5 ++-- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3b7fb980d..71ef2ffb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules dist +apiKeys.js .pnpm-debug.log* .netlify .turbo diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38e5290c0..e98d55d0e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,6 +63,35 @@ To install the dependencies of this repository, open a terminal at the root of t pnpm install ``` +### Setup Honeycomb + +[Honeycomb](https://www.honeycomb.io/) is one of the monitoring platforms used at Workleap. The [endpoints](./samples/endpoints/) sample application of this repository is already configured to send traces to Honeycomb but needs a valid Honeycomb API key. + +First, create a file named `apikeys` at the root of [samples](./samples/) folder. + +``` !#3 +workspace +├── samples +├──── apiKeys.js +``` + +Then, retrieve a valid [Honeycomb API Key](https://docs.honeycomb.io/get-started/configure/environments/manage-api-keys/) from your Vault (or ask IT). + +Finally, open the newly created `apiKeys.js` file and export an `HoneycombApiKey` constant with the API key as value. + +```js samples/apiKeys.js +export const HoneycombApiKey = "YOUR_API_KEY"; +``` + +If you don't have access to a Honeycomb API Key but still want to run the [endpoints](./samples/endpoints/) sample, create the `apiKeys.js` file as described above and set the `HoneycombApiKey` to an empty string. + +```js samples/apiKeys.js +export const HoneycombApiKey = " "; +``` + +> [!NOTE] +> The `samples/endpoints/apiKeys.js` is ignored by Git and will not be pushed to the remote repository. + ### Setup Retype [Retype](https://retype.com/) is the documentation platform that Squide is using for its documentation. As this project is leveraging a few [Pro features](https://retype.com/pro/) of Retype. diff --git a/samples/endpoints/express-server/src/index.ts b/samples/endpoints/express-server/src/index.ts index 250089204..0385713db 100644 --- a/samples/endpoints/express-server/src/index.ts +++ b/samples/endpoints/express-server/src/index.ts @@ -5,13 +5,14 @@ import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express"; import { NodeSDK } from "@opentelemetry/sdk-node"; import cors from "cors"; import express, { type Request, type Response } from "express"; +import { HoneycombApiKey } from "../../apiKeys.js"; const sdk = new NodeSDK({ serviceName: "squide-endpoints-sample", traceExporter: new OTLPTraceExporter({ url: "https://api.honeycomb.io/v1/traces", headers: { - "x-honeycomb-team": "xSffNa6OhKeROIg9aG6uAB" + "x-honeycomb-team": HoneycombApiKey } }), instrumentations: [ diff --git a/samples/endpoints/host/src/index.tsx b/samples/endpoints/host/src/index.tsx index 68a2ce588..3b639b025 100644 --- a/samples/endpoints/host/src/index.tsx +++ b/samples/endpoints/host/src/index.tsx @@ -6,6 +6,7 @@ import { ConsoleLogger, FireflyRuntime, RuntimeContext, bootstrap } from "@squid import { registerHoneycombInstrumentation } from "@squide/firefly-honeycomb"; import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; +import { HoneycombApiKey } from "../../apiKeys.js"; import { Remotes } from "../remotes.ts"; import { App } from "./App.tsx"; import { registerHost } from "./register.tsx"; @@ -16,10 +17,8 @@ const runtime = new FireflyRuntime({ loggers: [x => new ConsoleLogger(x)] }); -console.log("TOTO!!!"); - registerHoneycombInstrumentation(runtime, "squide-endpoints-sample", [/http:\/\/localhost:1234\.*/], { - apiKey: "xSffNa6OhKeROIg9aG6uAB" + apiKey: HoneycombApiKey }); await bootstrap(runtime, {