0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-07-01 02:52:56 +00:00

feat: Add Kubernetes config and ef otlp

This commit is contained in:
alex289 2024-10-03 22:03:22 +02:00
parent 0f5534ffe6
commit 273a7222d7
No known key found for this signature in database
GPG Key ID: 573F77CD2D87F863
5 changed files with 60 additions and 2 deletions

View File

@ -27,6 +27,7 @@
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.12" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />

View File

@ -91,6 +91,7 @@ builder.Services
.WithTracing(tracing =>
{
tracing
.AddEntityFrameworkCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation()
.AddSource(MassTransit.Logging.DiagnosticHeaders.DefaultListenerName);

View File

@ -10,6 +10,8 @@ services:
depends_on:
db:
condition: service_started
seq:
condition: service_started
redis:
condition: service_started
rabbitmq:
@ -22,8 +24,9 @@ services:
- Kestrel__Endpoints__Grpc__Url=http://+:8080
- Kestrel__Endpoints__Grpc__Protocols=Http2
- ConnectionStrings__DefaultConnection=Server=db;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#
- OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5341/ingest/otlp/v1/traces
- OTEL_EXPORTER_OTLP_ENDPOINT=http://seq:5341/ingest/otlp/v1/traces
- OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
- Serilog__WriteTo__1__Args__serverUrl=http://seq:5341
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost/healthz"]
interval: 30s

View File

@ -42,4 +42,10 @@ spec:
- name: Kestrel__Endpoints__Grpc__Protocols
value: Http2
- name: ConnectionStrings__DefaultConnection
value: Server=sql-server;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#
value: Server=sql-server;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://seq:5341/ingest/otlp/v1/traces
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: Serilog__WriteTo__1__Args__serverUrl
value: http://seq:5341

47
k8s-deployments/seq.yml Normal file
View File

@ -0,0 +1,47 @@
apiVersion: v1
kind: Service
metadata:
name: seq
spec:
selector:
app: seq
ports:
- name: seq
protocol: TCP
port: 5341
targetPort: 5341
- name: seq-frontend
protocol: TCP
port: 8081
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: seq-deployment
spec:
replicas: 1
selector:
matchLabels:
app: seq
template:
metadata:
labels:
app: seq
spec:
containers:
- name: seq
image: datalust/seq:latest
env:
- name: ACCEPT_EULA
value: "y"
ports:
- containerPort: 5341
- containerPort: 80
volumeMounts:
- name: seq-data
mountPath: /data
volumes:
- name: seq-data
emptyDir: {}