Capture LLM Observability to Open Telemetry compatible tools. #1

Merged
stefano merged 10 commits from opentelemetry-llm into main 2025-07-16 01:20:27 +00:00
4 changed files with 11 additions and 6 deletions
Showing only changes of commit fef71122cf - Show all commits

View File

@@ -21,7 +21,6 @@
"test:coverage": "jest --coverage",
"lint": "eslint src --ext .ts --config eslint.config.mjs",
"format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
"cli": "npm run build && node dist/index.js",
"mcp:stdio": "TRANSPORT_MODE=stdio npm run build && node dist/index.js",
"mcp:http": "TRANSPORT_MODE=http npm run build && node dist/index.js",
"mcp:inspect": "TRANSPORT_MODE=http npm run build && (node dist/index.js &) && sleep 2 && npx @modelcontextprotocol/inspector http://localhost:3000/mcp",

View File

@@ -7,7 +7,15 @@ export const CommonConfigSchema = z.object({
serviceName: z.string().default('llm-observability-mcp'),
serviceVersion: z.string().default('1.0.0'),
environment: z.string().default('development'),
debug: z.boolean().default(false),
debug: z
.preprocess((val) => {
if (typeof val === 'string') {
if (val.toLowerCase() === 'false') return false;
if (val.toLowerCase() === 'true') return true;
}
return val;
}, z.boolean())
.default(false),
logLevel: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
});

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env node
import { Logger } from './utils/logger.util.js';
import configLoader from './config/config-loader.js';
import { stdioTransport } from './server/stdio.js';
import { streamableHttpTransport } from './server/streamableHttp.js';
@@ -42,9 +41,6 @@ export async function startServer(): Promise<void> {
* Main entry point
*/
async function main() {
// Load configuration
configLoader.load();
// Server mode - determine transport and start server
await startServer();
}

View File

@@ -98,6 +98,8 @@ export class OpenTelemetryService {
[ATTR_SERVICE_NAME]: this.config.serviceName,
[ATTR_SERVICE_VERSION]: this.config.serviceVersion,
[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: this.config.environment,
debug: this.config.debug,
logLevel: this.config.logLevel,
});
// Configure metric exporter