Add domain to tracing service to distinguish different Matrix public archive instances (#76)

This commit is contained in:
Eric Eastwood 2022-10-11 16:03:33 -05:00 committed by GitHub
parent b39d7caf31
commit ff315141fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -19,18 +19,22 @@ const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventi
const CaptureSpanProcessor = require('./capture-span-processor');
const config = require('../lib/config');
const basePath = config.get('basePath');
assert(basePath);
const jaegerTracesEndpoint = config.get('jaegerTracesEndpoint');
const packageInfo = require('../../package.json');
assert(packageInfo.name);
const basePathUrl = new URL(basePath);
// (Diagnostics) For troubleshooting, set the log level to DiagLogLevel.DEBUG.
//
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
const provider = new BasicTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: packageInfo.name,
[SemanticResourceAttributes.SERVICE_NAME]: `${packageInfo.name} - ${basePathUrl.host}`,
}),
});
// Export spans to console (useful for debugging).