mirror of
https://github.com/farcasclaudiu/LearnCollectInst.git
synced 2026-06-22 03:01:07 +03:00
init commit
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
@@ -0,0 +1,5 @@
|
||||
**/obj
|
||||
**/bin
|
||||
*.suo
|
||||
*.user
|
||||
.vs/**
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Docker .NET Core Launch",
|
||||
"type": "docker",
|
||||
"request": "attach",
|
||||
"platform": "netCore",
|
||||
"sourceFileMap": {
|
||||
"/src": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/LearnCollectInst.Api/bin/Debug/net6.0/LearnCollectInst.Api.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/LearnCollectInst.Api",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/LearnCollectInst.Api/LearnCollectInst.Api.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/LearnCollectInst.Api/LearnCollectInst.Api.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/LearnCollectInst.Api/LearnCollectInst.Api.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32901.215
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LearnCollectInst.Api", "LearnCollectInst.Api\LearnCollectInst.Api.csproj", "{354C8FF9-6E02-453A-9E4E-B3E5DA10EAD2}"
|
||||
EndProject
|
||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{D62D5AEA-CF65-48FE-9F64-09AD58D39118}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{332AE074-3713-4709-AD1C-BAE8AE96886F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
otel-collector-config.yaml = otel-collector-config.yaml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{354C8FF9-6E02-453A-9E4E-B3E5DA10EAD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{354C8FF9-6E02-453A-9E4E-B3E5DA10EAD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{354C8FF9-6E02-453A-9E4E-B3E5DA10EAD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{354C8FF9-6E02-453A-9E4E-B3E5DA10EAD2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D62D5AEA-CF65-48FE-9F64-09AD58D39118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D62D5AEA-CF65-48FE-9F64-09AD58D39118}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D62D5AEA-CF65-48FE-9F64-09AD58D39118}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D62D5AEA-CF65-48FE-9F64-09AD58D39118}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B34BFD9D-9918-488B-B186-A858E627C6AA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,42 @@
|
||||
using LearnCollectInst.Api.Model;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LearnCollectInst.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
_logger.LogInformation("Weather forecast list started");
|
||||
|
||||
var result = Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
// PLAYGROUND:
|
||||
//throw new ArgumentException("some induced error");
|
||||
|
||||
_logger.LogWarning("Weather forecast list was generated", result.Length);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["LearnCollectInst.Api/LearnCollectInst.Api.csproj", "LearnCollectInst.Api/"]
|
||||
RUN dotnet restore "LearnCollectInst.Api/LearnCollectInst.Api.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/LearnCollectInst.Api"
|
||||
RUN dotnet build "LearnCollectInst.Api.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "LearnCollectInst.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "LearnCollectInst.Api.dll"]
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>7d6d27cc-c904-4577-8fa3-cbcb1c306626</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
|
||||
<PackageReference Include="OpenTelemetry" Version="1.4.0-beta.1" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.4.0-beta.1" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.4.0-beta.1" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs" Version="1.4.0-beta.1" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.7" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.7" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.7" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.0.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.0.0-rc9.7" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace LearnCollectInst.Api.Model
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Instrumentation.AspNetCore;
|
||||
using OpenTelemetry.Logs;
|
||||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
using System.Diagnostics;
|
||||
|
||||
// Define some important constants to initialize tracing with
|
||||
var serviceName = "LearnCollectInst.Api";
|
||||
var serviceVersion = "1.0.0";
|
||||
|
||||
var resBuilder = ResourceBuilder.CreateDefault()
|
||||
.AddService(serviceName: serviceName, serviceVersion: serviceVersion);
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
|
||||
// OLTP tracing
|
||||
builder.Services.AddOpenTelemetryTracing(tracerProviderBuilder =>
|
||||
{
|
||||
tracerProviderBuilder
|
||||
.AddConsoleExporter()
|
||||
.AddSource(serviceName)
|
||||
.SetResourceBuilder(resBuilder)
|
||||
.AddHttpClientInstrumentation()
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddSqlClientInstrumentation()
|
||||
.AddOtlpExporter(config =>
|
||||
{
|
||||
config.Endpoint = new Uri("http://otel-collector:4317");
|
||||
})
|
||||
.AddConsoleExporter();
|
||||
});
|
||||
|
||||
// OTPL metrics
|
||||
builder.Services.AddOpenTelemetryMetrics(config =>
|
||||
{
|
||||
config.SetResourceBuilder(resBuilder);
|
||||
config.AddRuntimeInstrumentation()
|
||||
.AddHttpClientInstrumentation()
|
||||
.AddAspNetCoreInstrumentation();
|
||||
config.AddOtlpExporter(otlpOptions =>
|
||||
{
|
||||
otlpOptions.Endpoint = new Uri("http://otel-collector:4317");
|
||||
}).AddConsoleExporter();
|
||||
});
|
||||
|
||||
// OTLP logger
|
||||
builder.Host.ConfigureLogging(logging =>
|
||||
logging.ClearProviders()
|
||||
.AddOpenTelemetry(options =>
|
||||
{
|
||||
options.SetResourceBuilder(resBuilder);
|
||||
// Export the body of the message
|
||||
options.IncludeFormattedMessage = true;
|
||||
options.IncludeScopes = true;
|
||||
options.ParseStateValues = true;
|
||||
// exporters
|
||||
options.AddOtlpExporter(otlpOptions =>
|
||||
{
|
||||
otlpOptions.Endpoint = new Uri("http://otel-collector:4317");
|
||||
})
|
||||
.AddConsoleExporter();
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
// if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
//app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
// app.UseHttpLogging();
|
||||
|
||||
var MyActivitySource = new ActivitySource(serviceName);
|
||||
|
||||
app.Run();
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"profiles": {
|
||||
"LearnCollectInst.Api": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7090;http://localhost:5090"
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:20591",
|
||||
"sslPort": 44330
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>d62d5aea-cf65-48fe-9f64-09ad58d39118</ProjectGuid>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
|
||||
<DockerServiceName>learncollectinst.api</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="docker-compose.override.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.yml" />
|
||||
<None Include=".dockerignore" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
learncollectinst.api:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:443;http://+:80
|
||||
ports:
|
||||
- "80"
|
||||
- "443"
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
Executable
+99
@@ -0,0 +1,99 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
learncollectinst.api:
|
||||
image: ${DOCKER_REGISTRY-}learncollectinstapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: LearnCollectInst.Api/Dockerfile
|
||||
ports:
|
||||
- "5100:80"
|
||||
depends_on:
|
||||
- otel-collector
|
||||
|
||||
# Jaeger
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:latest
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "14268"
|
||||
- "14250"
|
||||
|
||||
# Zipkin
|
||||
zipkin-learn:
|
||||
image: openzipkin/zipkin:latest
|
||||
ports:
|
||||
- "9422:9411" #default 9411
|
||||
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:0.61.0
|
||||
command: [ "--config=/etc/otel-collector-config.yaml" ]
|
||||
restart: on-failure
|
||||
user: '0:0' # required for logs
|
||||
volumes:
|
||||
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
|
||||
- ./otelcol_data.log:/tmp/otelcol_data.log
|
||||
ports:
|
||||
- "13133:13133" # health_check extension
|
||||
- '4317:4317' # OLTP gRPC receiver
|
||||
- '4318:4318' # OLTP HTTP receiver
|
||||
- '55679:55679' # zPages
|
||||
depends_on:
|
||||
- jaeger
|
||||
- zipkin-learn
|
||||
# Prometheus
|
||||
#prometheus:
|
||||
# container_name: prometheus
|
||||
# image: prom/prometheus:latest
|
||||
# volumes:
|
||||
# - ./prometheus.yaml:/etc/prometheus/prometheus.yml
|
||||
# ports:
|
||||
# - "9090:9090"
|
||||
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:22.9
|
||||
restart: on-failure
|
||||
environment:
|
||||
CLICKHOUSE_DB: uptrace
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'wget',
|
||||
'--spider',
|
||||
'-q',
|
||||
'localhost:8123/ping'
|
||||
]
|
||||
interval: 1s
|
||||
timeout: 1s
|
||||
retries: 30
|
||||
volumes:
|
||||
- ch_data:/var/lib/clickhouse
|
||||
ports:
|
||||
- '8123:8123'
|
||||
- '9000:9000'
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
|
||||
uptrace:
|
||||
image: 'uptrace/uptrace:latest'
|
||||
#image: 'uptrace/uptrace-dev:latest'
|
||||
volumes:
|
||||
- uptrace_data:/var/lib/uptrace
|
||||
- ./uptrace.yml:/etc/uptrace/uptrace.yml
|
||||
#environment:
|
||||
# - DEBUG=2
|
||||
ports:
|
||||
- '14317:14317'
|
||||
- '14318:14318'
|
||||
depends_on:
|
||||
clickhouse:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
uptrace_data:
|
||||
driver: local
|
||||
ch_data:
|
||||
driver: local
|
||||
alertmanager_data:
|
||||
driver: local
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
hostmetrics:
|
||||
collection_interval: 10s
|
||||
scrapers:
|
||||
cpu:
|
||||
disk:
|
||||
load:
|
||||
filesystem:
|
||||
memory:
|
||||
network:
|
||||
paging:
|
||||
|
||||
exporters:
|
||||
jaeger:
|
||||
endpoint: jaeger:14250
|
||||
tls:
|
||||
insecure: true
|
||||
logging:
|
||||
logLevel: debug
|
||||
zipkin:
|
||||
endpoint: "http://zipkin-learn:9411/api/v2/spans"
|
||||
file:
|
||||
path: /tmp/otelcol_data.log
|
||||
format: json
|
||||
otlp:
|
||||
endpoint: uptrace:14317
|
||||
tls:
|
||||
insecure: true
|
||||
headers: { "uptrace-dsn": "http://project2_secret_token@localhost:14317/2" }
|
||||
|
||||
processors:
|
||||
batch:
|
||||
|
||||
extensions:
|
||||
health_check:
|
||||
pprof:
|
||||
endpoint: 0.0.0.0:1777
|
||||
zpages:
|
||||
endpoint: 0.0.0.0:55679
|
||||
|
||||
service:
|
||||
extensions: [health_check, pprof, zpages]
|
||||
telemetry:
|
||||
logs:
|
||||
level: debug
|
||||
# metrics:
|
||||
# level: detailed
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
exporters: [otlp, zipkin, jaeger, logging]
|
||||
processors: [batch]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp, logging] #prometheus
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: []
|
||||
exporters: [otlp, logging, file]
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
##
|
||||
## Uptrace configuration file.
|
||||
## See https://uptrace.dev/get/config.html for details.
|
||||
##
|
||||
## You can use environment variables anywhere in this file, for example:
|
||||
##
|
||||
## foo: $FOO
|
||||
## bar: ${BAR}
|
||||
## baz: ${BAZ:default}
|
||||
##
|
||||
## To escape `$`, use `$$`, for example:
|
||||
##
|
||||
## foo: $$FOO_BAR
|
||||
##
|
||||
|
||||
##
|
||||
## A list of pre-configured projects. Each project is fully isolated.
|
||||
##
|
||||
projects:
|
||||
# Conventionally, the first project is used to monitor Uptrace itself.
|
||||
- id: 1
|
||||
name: Uptrace
|
||||
# Token grants write access to the project. Keep a secret.
|
||||
token: project1_secret_token
|
||||
pinned_attrs:
|
||||
- service.name
|
||||
- host.name
|
||||
- deployment.environment
|
||||
|
||||
# Other projects can be used to monitor your applications.
|
||||
# To monitor micro-services or multiple related services, use a single project.
|
||||
- id: 2
|
||||
name: LearnCollectInst.Api
|
||||
token: project2_secret_token
|
||||
pinned_attrs:
|
||||
- service.name
|
||||
- host.name
|
||||
- deployment.environment
|
||||
|
||||
##
|
||||
## To require authentication, uncomment the following section.
|
||||
##
|
||||
auth:
|
||||
# users:
|
||||
# - username: uptrace
|
||||
# password: uptrace
|
||||
# - username: admin
|
||||
# password: admin
|
||||
|
||||
# # Cloudflare user provider: uses Cloudflare Zero Trust Access (Identity)
|
||||
# # See https://developers.cloudflare.com/cloudflare-one/identity/ for more info.
|
||||
# cloudflare:
|
||||
# # The base URL of the Cloudflare Zero Trust team.
|
||||
# - team_url: https://myteam.cloudflareaccess.com
|
||||
# # The Application Audience (AUD) Tag for this application.
|
||||
# # You can retrieve this from the Cloudflare Zero Trust 'Access' Dashboard.
|
||||
# audience: bea6df23b944e4a0cd178609ba1bb64dc98dfe1f66ae7b918e563f6cf28b37e0
|
||||
|
||||
# # OpenID Connect (Single Sign-On)
|
||||
# oidc:
|
||||
# # The ID is used in API endpoints, for example, in redirect URL
|
||||
# # `http://<uptrace-host>/api/v1/sso/<oidc-id>/callback`.
|
||||
# - id: keycloak
|
||||
# # Display name for the button in the login form.
|
||||
# # Default to 'OpenID Connect'
|
||||
# display_name: Keycloak
|
||||
# # The base URL for the OIDC provider.
|
||||
# issuer_url: http://localhost:8080/realms/uptrace
|
||||
# # The OAuth 2.0 Client ID
|
||||
# client_id: uptrace
|
||||
# # The OAuth 2.0 Client Secret
|
||||
# client_secret: ogbhd8Q0X0e5AZFGSG3m9oirPvnetqkA
|
||||
# # Additional OAuth 2.0 scopes to request from the OIDC provider.
|
||||
# # Defaults to 'profile'. 'openid' is requested by default and need not be specified.
|
||||
# scopes:
|
||||
# - profile
|
||||
# # The OIDC UserInfo claim to use as the user's username.
|
||||
# # Defaults to 'preferred_username'.
|
||||
# claim: preferred_username
|
||||
|
||||
##
|
||||
## ClickHouse database credentials.
|
||||
##
|
||||
ch:
|
||||
# Connection string for ClickHouse database. For example:
|
||||
# clickhouse://<user>:<password>@<host>:<port>/<database>?sslmode=disable
|
||||
#
|
||||
# See https://clickhouse.uptrace.dev/guide/golang-clickhouse.html#options
|
||||
dsn: "clickhouse://default:@clickhouse:9000/uptrace?sslmode=disable"
|
||||
|
||||
##
|
||||
## Alerting rules for monitoring metrics.
|
||||
##
|
||||
## See https://uptrace.dev/get/alerting.html for details.
|
||||
##
|
||||
alerting:
|
||||
rules:
|
||||
- name: Network errors
|
||||
metrics:
|
||||
- system.network.errors as $net_errors
|
||||
query:
|
||||
- $net_errors > 0 group by host.name
|
||||
# for the last 5 minutes
|
||||
for: 5m
|
||||
# in the project id=1
|
||||
projects: [1]
|
||||
|
||||
- name: Filesystem usage >= 90%
|
||||
metrics:
|
||||
- system.filesystem.usage as $fs_usage
|
||||
query:
|
||||
- group by host.name
|
||||
- group by device
|
||||
- where device !~ "loop"
|
||||
- $fs_usage{state="used"} / $fs_usage >= 0.9
|
||||
for: 5m
|
||||
projects: [1]
|
||||
|
||||
- name: Uptrace is dropping spans
|
||||
metrics:
|
||||
- uptrace.projects.spans as $spans
|
||||
query:
|
||||
- $spans{type=dropped} > 0
|
||||
for: 1m
|
||||
projects: [1]
|
||||
|
||||
- name: Always firing (for fun and testing)
|
||||
metrics:
|
||||
- process.runtime.go.goroutines as $goroutines
|
||||
query:
|
||||
- $goroutines >= 0 group by host.name
|
||||
for: 1m
|
||||
projects: [1]
|
||||
|
||||
# Create alerts from error logs and span events.
|
||||
create_alerts_from_spans:
|
||||
enabled: true
|
||||
labels:
|
||||
alert_kind: error
|
||||
|
||||
##
|
||||
## AlertManager client configuration.
|
||||
## See https://uptrace.dev/get/alerting.html for details.
|
||||
##
|
||||
## Note that this is NOT an AlertManager config and you need to configure AlertManager separately.
|
||||
## See https://prometheus.io/docs/alerting/latest/configuration/ for details.
|
||||
##
|
||||
alertmanager_client:
|
||||
# AlertManager API endpoints that Uptrace uses to manage alerts.
|
||||
urls:
|
||||
- "http://alertmanager:9093/api/v2/alerts"
|
||||
|
||||
##
|
||||
## Various options to tweak ClickHouse schema.
|
||||
## For changes to take effect, you need reset the ClickHouse database with `ch reset`.
|
||||
##
|
||||
ch_schema:
|
||||
# Compression codec, for example, LZ4, ZSTD(3), or Default.
|
||||
compression: ZSTD(3)
|
||||
|
||||
# Whether to use ReplicatedMergeTree instead of MergeTree.
|
||||
replicated: false
|
||||
|
||||
# Cluster name for Distributed tables and ON CLUSTER clause.
|
||||
#cluster: uptrace1
|
||||
|
||||
spans:
|
||||
storage_policy: "default"
|
||||
# Delete spans data after 30 days.
|
||||
ttl_delete: 30 DAY
|
||||
|
||||
metrics:
|
||||
storage_policy: "default"
|
||||
# Delete metrics data after 90 days.
|
||||
ttl_delete: 90 DAY
|
||||
|
||||
##
|
||||
## Addresses on which Uptrace receives gRPC and HTTP requests.
|
||||
##
|
||||
listen:
|
||||
# OTLP/gRPC API.
|
||||
grpc:
|
||||
addr: ":14317"
|
||||
# tls:
|
||||
# cert_file: config/tls/uptrace.crt
|
||||
# key_file: config/tls/uptrace.key
|
||||
|
||||
# OTLP/HTTP API and Uptrace API with UI.
|
||||
http:
|
||||
addr: ":14318"
|
||||
# tls:
|
||||
# cert_file: config/tls/uptrace.crt
|
||||
# key_file: config/tls/uptrace.key
|
||||
|
||||
##
|
||||
## Various options for Uptrace UI.
|
||||
##
|
||||
site:
|
||||
# Overrides public URL for Vue-powered UI in case you put Uptrace behind a proxy.
|
||||
#addr: 'https://uptrace.mydomain.com'
|
||||
|
||||
##
|
||||
## Spans processing options.
|
||||
##
|
||||
spans:
|
||||
# The size of the Go chan used to buffer incoming spans.
|
||||
# If the buffer is full, Uptrace starts to drop spans.
|
||||
#buffer_size: 100000
|
||||
|
||||
# The number of spans to insert in a single query.
|
||||
#batch_size: 10000
|
||||
|
||||
##
|
||||
## Metrics processing options.
|
||||
##
|
||||
metrics:
|
||||
# List of attributes to drop for being noisy.
|
||||
drop_attrs:
|
||||
- telemetry.sdk.language
|
||||
- telemetry.sdk.name
|
||||
- telemetry.sdk.version
|
||||
|
||||
# The size of the Go chan used to buffer incoming measures.
|
||||
# If the buffer is full, Uptrace starts to drop measures.
|
||||
#buffer_size: 100000
|
||||
|
||||
# The number of measures to insert in a single query.
|
||||
#batch_size: 10000
|
||||
|
||||
##
|
||||
## SQLite/PostgreSQL db that is used to store metadata such us metric names, dashboards, alerts,
|
||||
## and so on.
|
||||
##
|
||||
db:
|
||||
# Either sqlite or postgres.
|
||||
driver: sqlite
|
||||
# Database connection string.
|
||||
#
|
||||
# Uptrace automatically creates SQLite database file in the current working directory.
|
||||
# Make sure the directory is writable by Uptrace process.
|
||||
dsn: "file:uptrace.sqlite3?_pragma=foreign_keys(1)&_pragma=busy_timeout(1000)"
|
||||
|
||||
# Secret key that is used to sign JWT tokens etc.
|
||||
secret_key: 102c1a557c314fc28198acd017960843
|
||||
|
||||
# Enable to log HTTP requests and database queries.
|
||||
debug: false
|
||||
Reference in New Issue
Block a user