Skip to content

Commit

Permalink
OATs build fixes, better HTTP error test (grafana#79)
Browse files Browse the repository at this point in the history
* update to build on net8.0
* improve OATs HTTP test
  • Loading branch information
matt-hensley authored Jan 23, 2024
1 parent a196041 commit a6323da
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
17 changes: 17 additions & 0 deletions docker/docker-compose-aspnetcore/http/oats.http-get.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
docker-compose:
generator: lgtm
files:
- ../docker-compose.oats.yml
input:
- path: /api/HttpClient/Get
interval: 500ms
expected:
traces:
- traceql: '{ name =~ "api/HttpClient/Get" }'
spans:
- name: 'GET'
attributes:
http.request.method: GET
metrics:
- promql: http_client_request_duration_count{http_request_method="GET", http_response_status_code="200"}
value: '>= 0'
18 changes: 18 additions & 0 deletions docker/docker-compose-aspnetcore/http/oats.http-geterror.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
docker-compose:
generator: lgtm
files:
- ../docker-compose.oats.yml
input:
- path: /api/HttpClient/GetError
interval: 500ms
expected:
traces:
- traceql: '{ name =~ "api/HttpClient/GetError" }'
spans:
- name: 'GET'
attributes:
error.type: '500'
http.request.method: GET
metrics:
- promql: http_client_request_duration_count{}
value: '>= 0'
16 changes: 0 additions & 16 deletions docker/docker-compose-aspnetcore/oats.http-get.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<ActionResult<IEnumerable<string>>> Get()
public async Task<ActionResult<IEnumerable<string>>> GetError()
{
var client = new HttpClient();
var response = await client.GetAsync("http://example.com");
var response = await client.GetAsync("http://postman-echo.com/status/500");
var content = await response.Content.ReadAsStringAsync();
return Ok(content);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/net6.0/aspnetcore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["examples/net6.0/aspnetcore/aspnetcore.csproj", "examples/net6.0/aspnetcore/"]
RUN dotnet restore "examples/net6.0/aspnetcore/aspnetcore.csproj"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestFeature",
"version": "8.0.100-rc.2.23502.2"
"version": "8.0.101"
}
}

0 comments on commit a6323da

Please sign in to comment.