Skip to content

Commit c8554fa

Browse files
authored
Make logging sample clearer (#8)
1 parent f7c7379 commit c8554fa

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This document takes a look at current options to implement observability in .NET
88

99
## Observability
1010

11-
Agile, devops, continuous delivery are terms used nowadays in modern software development practices. The idea is to change/fail fast and update constantly. In order to be able to deliver fast it is fundamental to have tools monitoring how the running system behaves. This tool(s) contain required information needed to separate a good update from a bad. Remediating a bad update usually means rolling back to previous version and working on the identified issues. Combined with progressive deployment strategies (canary, mirroring, rings, blue/green, etc.) the impact of a bad update can be minimized.
11+
Agile, devops, continuous delivery are terms used nowadays in modern software development practices. The idea is to change/fail fast and update constantly. In order to be able to deliver fast it is fundamental to have tools monitoring how the running system behaves. This tool(s) contains required information needed to separate a good update from a bad. Remediating a bad update usually means rolling back to previous version and working on the identified issues. Combined with progressive deployment strategies (canary, mirroring, rings, blue/green, etc.) the impact of a bad update can be minimized.
1212

1313
The following information can be used to identify bad updates:
1414

@@ -21,7 +21,7 @@ The following information can be used to identify bad updates:
2121
This observability is typically built by 3 pillars:
2222

2323
- Logging: collects information about events happening in the system, helping the team identifying unexpected application behavior
24-
- Tracing: collects information creating an end-to-end view of how transaction are executed in a distributed system
24+
- Tracing: collects information creating an end-to-end view of how transactions are executed in a distributed system
2525
- Metrics: provide a near real-time indication of how the system is running. As opposed to logs and traces, the amount of data collected using metrics remains constant as the system load increases
2626

2727
## Adding observability to .NET Core Stack
@@ -58,7 +58,7 @@ Simplified, [OpenTelemetry collects traces using spans](https://github.com/open-
5858

5959
Application Insights have different names for spans and their identifiers. The table below has a summary of them:
6060

61-
|Application Insights|OpenTracing|
61+
|Application Insights|OpenTelemetry|
6262
|-|-|
6363
|Request, PageView|Span with span.kind = server|
6464
|Dependency|Span with span.kind = client|

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.4'
22

33
services:
44
sample.mainapi:
5-
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-mainapi${TAG-}
5+
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-mainapi:${TAG-latest}
66
environment:
77
- SampleApp__RabbitMQHostName=rabbitmq
88
- SampleApp__TimeAPIUrl=http://sample.timeapi
@@ -25,7 +25,7 @@ services:
2525
- "9184:9184"
2626

2727
sample.rabbitmqprocessor:
28-
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-rabbitmqprocessor${TAG-}
28+
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-rabbitmqprocessor:${TAG-latest}
2929
environment:
3030
- SampleApp__RabbitMQHostName=rabbitmq
3131
- SampleApp__TimeAPIUrl=http://sample.timeapi
@@ -44,7 +44,7 @@ services:
4444
dockerfile: src/Sample.RabbitMQProcessor/Dockerfile
4545

4646
sample.timeapi:
47-
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-timeapi${TAG-}
47+
image: ${DOCKER_REGISTRY-}dotnetobservabilitysample-timeapi:${TAG-latest}
4848
environment:
4949
- SampleApp__RabbitMQHostName=rabbitmq
5050
- SampleApp__TimeAPIUrl=http://sample.timeapi

media/01-ai-getdbtime-items.png

-44.4 KB
Loading

media/01-ai-search-logs.png

197 KB
Loading

src/Sample.TimeApi/Controllers/TimeController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public async Task<DateTime> GetDbTimeAsync()
3939

4040
var result = await repository.GetTimeFromSqlAsync();
4141

42-
logger.LogInformation("Retrieved db time: delta to local is {delta}ms", Math.Abs(DateTime.UtcNow.Subtract(result).TotalMilliseconds));
42+
logger.LogInformation("{operation} result is {result}", nameof(repository.GetTimeFromSqlAsync), result);
4343

4444
return result;
4545
}

0 commit comments

Comments
 (0)