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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.0",
"@fortawesome/react-fontawesome": "^0.1.18",
"@grpc/grpc-js": "^1.6.2",
"@opentelemetry/api": "^1.0.4",
"@opentelemetry/auto-instrumentations-node": "^0.28.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.27.0",
"@opentelemetry/sdk-node": "^0.27.0",
"@reduxjs/toolkit": "^1.7.2",
"amplitude-js": "^8.12.0",
"bootstrap": "^5.1.3",
Expand Down
53 changes: 53 additions & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,59 @@ export default class AppUpdater {
}
}

const process = require('process');
const { Metadata, credentials } = require('@grpc/grpc-js');
const { NodeSDK } = require('@opentelemetry/sdk-node');
const {
getNodeAutoInstrumentations,
} = require('@opentelemetry/auto-instrumentations-node');
const { Resource } = require('@opentelemetry/resources');
const {
SemanticResourceAttributes,
} = require('@opentelemetry/semantic-conventions');
const {
OTLPTraceExporter,
} = require('@opentelemetry/exporter-trace-otlp-grpc');

const metadata = new Metadata();
metadata.set('x-honeycomb-team', 'KEY');

// The Trace Exporter exports the data to Honeycomb and uses
// the previously-configured metadata and the Honeycomb endpoint.
const traceExporter = new OTLPTraceExporter({
url: 'grpc://api.honeycomb.io:443/',
credentials: credentials.createSsl(),
metadata,
});

// The service name is REQUIRED! It is a resource attribute,
// which means that it will be present on all observability data that your service generates.
//
// Your service name will be used as the Service Dataset in Honeycomb, which is where data is stored.
const sdk = new NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'workbench-electron',
}),
traceExporter,

// Instrumentations allow you to add auto-instrumentation packages
instrumentations: [getNodeAutoInstrumentations()],
});

sdk
.start()
.then(() => console.log('Tracing initialized'))
.catch((error: Error) => console.log('Error initializing tracing', error));

process.on('SIGTERM', () => {
// eslint-disable-next-line promise/catch-or-return
sdk
.shutdown()
.then(() => console.log('Tracing terminated'))
.catch((error: Error) => console.log('Error terminating tracing', error))
.finally(() => process.exit(0));
});

let mainWindow: BrowserWindow | null = null;
const MAX_STRING_LOG_LENGTH = 32;

Expand Down