Skip to content
Merged
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
8 changes: 6 additions & 2 deletions TournamentAPI/Configuration/Extensions/TelemetryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ internal static IServiceCollection AddApplicationTelemetry(this IServiceCollecti
tracing.AddHttpClientInstrumentation();
tracing.AddAspNetCoreInstrumentation();
tracing.AddHotChocolateInstrumentation();
tracing.AddConsoleExporter();
tracing.AddOtlpExporter(o =>
{
o.Endpoint = new Uri("http://localhost:4318/v1/traces");
o.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.HttpProtobuf;
});
})
.WithMetrics(metrics =>
{
metrics.AddMeter(MetricConstants.TournamentMeterName);
metrics.AddAspNetCoreInstrumentation();
metrics.AddOtlpExporter(o =>
{
o.Endpoint = new Uri("http://localhost:5431/api/v1/otlp/v1/metrics");
o.Endpoint = new Uri("http://localhost:4318/v1/metrics");
o.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.HttpProtobuf;
});
});
Expand Down
2 changes: 1 addition & 1 deletion TournamentAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
.WriteTo.Console()
.WriteTo.OpenTelemetry(opt =>
{
opt.Endpoint = new Uri("http://localhost:3100/otlp").ToString();
opt.Endpoint = new Uri("http://localhost:4318").ToString();
opt.Protocol = OtlpProtocol.HttpProtobuf;
opt.ResourceAttributes = new Dictionary<string, object>
{
Expand Down
26 changes: 24 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
services:
jaeger:
image: jaegertracing/all-in-one:latest
container_name: jaeger
ports:
- 16686:16686

otel-collector:
image: otel/opentelemetry-collector-contrib:latest
container_name: otel-collector
command:
- '--config=/etc/otel-collector-config.yml'
ports:
- 4317:4317
- 4318:4318
volumes:
- ./otel-collector/otel-collector-config.yml:/etc/otel-collector-config.yml
depends_on:
- jaeger
- loki
- prometheus

prometheus:
image: prom/prometheus:latest
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--web.enable-otlp-receiver'
ports:
- 5431:9090
volumes:
Expand All @@ -29,8 +49,10 @@ services:
- 3000:3000
volumes:
- grafana:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/

volumes:
prometheus:
grafana:
loki:
loki:
jaeger:
23 changes: 23 additions & 0 deletions grafana/provisioning/datasources/datasource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: true

- name: Loki
type: loki
access: proxy
url: http://loki:3100
isDefault: false
editable: true

- name: Jaeger
type: jaeger
access: proxy
url: http://jaeger:16686
isDefault: false
editable: true
35 changes: 35 additions & 0 deletions otel-collector/otel-collector-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

processors:
batch: {}

exporters:
otlp/jaeger:
endpoint: jaeger:4317
tls:
insecure: true
otlphttp/loki:
endpoint: http://loki:3100/otlp
prometheus:
endpoint: 0.0.0.0:8889

service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp/jaeger]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/loki]
9 changes: 8 additions & 1 deletion prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ scrape_configs:
scrape_interval: 10s
scrape_timeout: 5s
static_configs:
- targets: ['localhost:9090']
- targets: ['localhost:9090']

- job_name: 'otel-collector'
scheme: 'http'
scrape_interval: 10s
scrape_timeout: 5s
static_configs:
- targets: ['otel-collector:8889']
Loading