project setup with core files including configuration, package management, and basic structure. Added .gitignore, README, and various TypeScript types for CMS components. Implemented initial components and layouts for the application.

This commit is contained in:
Peter Meier
2025-12-13 23:26:13 +01:00
parent ea288a5bbc
commit b1a556dc6d
167 changed files with 19057 additions and 131 deletions

View File

@@ -0,0 +1,90 @@
import { Registry, Counter, Histogram, Gauge } from 'prom-client';
/**
* Prometheus Metrics Registry
* Sammelt Metriken für Monitoring und Alerting
*/
export const register = new Registry();
// Default Metrics (CPU, Memory, etc.)
register.setDefaultLabels({
app: 'graphql-middlelayer',
});
// Query Metrics
export const queryCounter = new Counter({
name: 'graphql_queries_total',
help: 'Total number of GraphQL queries',
labelNames: ['operation', 'status'],
registers: [register],
});
export const queryDuration = new Histogram({
name: 'graphql_query_duration_seconds',
help: 'Duration of GraphQL queries in seconds',
labelNames: ['operation'],
buckets: [0.01, 0.05, 0.1, 0.5, 1, 2, 5],
registers: [register],
});
// Cache Metrics
export const cacheHits = new Counter({
name: 'cache_hits_total',
help: 'Total number of cache hits',
labelNames: ['cache_type'],
registers: [register],
});
export const cacheMisses = new Counter({
name: 'cache_misses_total',
help: 'Total number of cache misses',
labelNames: ['cache_type'],
registers: [register],
});
// DataService Metrics
export const dataServiceCalls = new Counter({
name: 'dataservice_calls_total',
help: 'Total number of DataService calls',
labelNames: ['method', 'status'],
registers: [register],
});
export const dataServiceDuration = new Histogram({
name: 'dataservice_duration_seconds',
help: 'Duration of DataService calls in seconds',
labelNames: ['method'],
buckets: [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1],
registers: [register],
});
// Error Metrics
export const errorCounter = new Counter({
name: 'errors_total',
help: 'Total number of errors',
labelNames: ['type', 'operation'],
registers: [register],
});
// Active Connections
export const activeConnections = new Gauge({
name: 'active_connections',
help: 'Number of active connections',
registers: [register],
});
// Query Complexity
export const queryComplexityGauge = new Gauge({
name: 'graphql_query_complexity',
help: 'Complexity of GraphQL queries',
labelNames: ['operation'],
registers: [register],
});
/**
* Exportiert Metriken im Prometheus-Format
*/
export async function getMetrics(): Promise<string> {
return register.metrics();
}