Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recreate examples #1708

Merged
merged 32 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2459201
Cleanup /dev
pellared Dec 5, 2022
51789f4
Remove /examples
pellared Dec 5, 2022
cc17292
Refine dev env
pellared Dec 5, 2022
811c660
Remove EOL
pellared Dec 5, 2022
8c87e33
Add new example
pellared Dec 5, 2022
0c18799
Add Prometheus
pellared Dec 5, 2022
4c8cbeb
Merge branch 'main' into new-examples
pellared Dec 5, 2022
cc045dd
sleep 1
pellared Dec 5, 2022
41a63b5
Fix makefile
pellared Dec 5, 2022
675f4be
dotnet-format
pellared Dec 5, 2022
c2adb32
sleep longer
pellared Dec 5, 2022
fb0b547
Fix lychee
pellared Dec 5, 2022
9680f3e
Fix Makefile for Ubuntu
pellared Dec 5, 2022
d9bb246
Merge branch 'new-examples' of https://github.com/pellared/openteleme…
pellared Dec 5, 2022
f754bcf
Merge branch 'main' into new-examples
pellared Dec 5, 2022
45c6d0a
Fix cspell errors
pellared Dec 5, 2022
62b2c61
Remove BuildExamples
pellared Dec 5, 2022
0714743
Try chmod 777 log
pellared Dec 5, 2022
e359328
Fix Makefile
pellared Dec 5, 2022
ef2ee5d
Format
pellared Dec 5, 2022
088f0df
Update README.md
pellared Dec 5, 2022
958b1d7
Merge branch 'main' into new-examples
pellared Dec 6, 2022
cc20430
Rename srv to Service and cli to Client
pellared Dec 6, 2022
91ed290
Update releasing
pellared Dec 6, 2022
5c4af5a
Remove url to collector's scrape endpoint
pellared Dec 6, 2022
8cae122
clarify binding redirect
pellared Dec 6, 2022
2ed7fde
Fix hyperlink
pellared Dec 6, 2022
68c866e
Merge branch 'main' into new-examples
pellared Dec 6, 2022
3c8767f
Update README.md
pellared Dec 6, 2022
71699b2
Update README.md
pellared Dec 6, 2022
a66740b
Update README.md
pellared Dec 6, 2022
3c2bb19
Apply suggestions from code review
pellared Dec 7, 2022
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
1 change: 1 addition & 0 deletions .cspell/other.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ proto
protobuf
protos
Serilog
sqlserver
TMPDIR
tracesexporter
unencrypted
Expand Down
40 changes: 2 additions & 38 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,49 +26,13 @@ updates:
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/AspNetCoreMvc
directory: /examples/cli
pellared marked this conversation as resolved.
Show resolved Hide resolved
pellared marked this conversation as resolved.
Show resolved Hide resolved
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/BindingRedirect
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/ConsoleApp
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/ConsoleApp.SelfBootstrap
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/CoreAppOldReference
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/OldReference
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/OpenTracingLibrary
schedule:
interval: "daily"
open-pull-requests-limit: 20

- package-ecosystem: nuget
directory: /examples/Vendor.Distro
directory: /examples/srv
pellared marked this conversation as resolved.
Show resolved Hide resolved
pellared marked this conversation as resolved.
Show resolved Hide resolved
schedule:
interval: "daily"
open-pull-requests-limit: 20
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: examples

on:
push:
branches: [ main ]
paths:
- 'examples/**.md'
pull_request:
branches: [ main ]
paths:
- 'examples/**.md'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.1.0
- name: Test examples
run: make all
working-directory: examples
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: script-tests
name: release-publish

on:
release:
Expand Down
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
http://localhost:8889/metrics
http://localhost:9090/graph
http://localhost:16686/search
http://localhost:13133/
1 change: 0 additions & 1 deletion OpenTelemetry.AutoInstrumentation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
integrations.json = integrations.json
LICENSE = LICENSE
docs\README.md = docs\README.md
run-example.sh = run-example.sh
stylecop.json = stylecop.json
EndProjectSection
EndProject
Expand Down
12 changes: 0 additions & 12 deletions build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,6 @@ partial class Build
.DependsOn(CompileNativeSrcLinux)
.DependsOn(CompileNativeSrcMacOs);

Target CompileExamples => _ => _
.Description("Compiles all the example projects")
.Executes(() =>
{
foreach (var exampleProject in Solution.GetProjects("Examples.*"))
{
DotNetBuild(s => s
.SetProjectFile(exampleProject)
.SetConfiguration(BuildConfiguration));
}
});

Target CompileNativeTests => _ => _
.Description("Compiles the native loader unit tests")
.DependsOn(CompileNativeTestsWindows)
Expand Down
5 changes: 0 additions & 5 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void DeleteReparsePoints(string path)
.Description("GitHub workflow entry point")
.DependsOn(Clean)
.DependsOn(BuildTracer)
.DependsOn(BuildExamples)
.DependsOn(NativeTests)
.DependsOn(ManagedTests);

Expand Down Expand Up @@ -111,10 +110,6 @@ void DeleteReparsePoints(string path)
.DependsOn(PublishIisTestApplications)
.DependsOn(RunManagedTests);

Target BuildExamples => _ => _
.Description("Build the Examples")
.DependsOn(CompileExamples);

string ContainersFilter()
{
switch (Containers)
Expand Down
33 changes: 11 additions & 22 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,29 @@
version: "2"
services:

jaeger:
image: jaegertracing/all-in-one:1.38.1
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- "16686:16686"

prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"

otel-collector:
image: otel/opentelemetry-collector-contrib:0.61.0
volumes:
- ./otel-config.yaml:/etc/otel/config.yaml
- ./log:/log/otel
command: --config /etc/otel/config.yaml
environment:
- JAEGER_ENDPOINT=jaeger:4317
ports:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http/protobuf receiver
- "6831:6831" # Jaeger thrift compact receiver
- "6832:6832" # Jaeger thrift binary receiver
- "4318:4318" # OTLP HTTP/protobuf receiver
- "6831:6831" # Jaeger UDP/thrift-compact receiver
pellared marked this conversation as resolved.
Show resolved Hide resolved
- "8888:8888" # Prometheus metrics scrape endpoint with collector telemetry
- "8889:8889" # Prometheus metrics exporter (scrape endpoint)
- "9411:9411" # Zipkin receiver
- "13133:13133" # health_check extension
- "14250:14250" # Jaeger grpc receiver
- "14268:14268" # Jaeger thrift http receiver
- "14268:14268" # Jaeger HTTP/thrift-binary receiver
- "55679:55679" # ZPages extension
depends_on:
- jaeger
- prometheus

jaeger:
image: jaegertracing/all-in-one:1.38.1
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- "16686:16686"
10 changes: 0 additions & 10 deletions dev/instrument.sh

This file was deleted.

41 changes: 34 additions & 7 deletions dev/otel-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ receivers:
protocols:
grpc:
http:
jaeger:
protocols:
thrift_compact:
thrift_http:
zipkin:

processors:
batch:

exporters:
logging:
# logLevel: debug
file/traces:
path: /log/otel/traces.log
file/metrics:
path: /log/otel/metrics.log
file/logs:
path: /log/otel/logs.log
otlp:
endpoint: "${JAEGER_ENDPOINT}"
tls:
Expand All @@ -25,15 +36,31 @@ exporters:
service:
pipelines:
traces:
receivers: [otlp]
receivers:
- otlp
- jaeger
- zipkin
processors: [batch]
exporters: [otlp, logging]
exporters:
- logging
- file/traces
- otlp
metrics:
receivers: [otlp]
receivers:
- otlp
processors: [batch]
exporters: [prometheus, logging]
exporters:
- logging
- file/metrics
- prometheus
logs:
receivers: [otlp]
receivers:
- otlp
processors: [batch]
exporters: [logging]
extensions: [health_check, zpages]
exporters:
- logging
- file/logs
- otlp
extensions:
- health_check
- zpages
9 changes: 0 additions & 9 deletions dev/prometheus.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions dev/wait-local-port.sh

This file was deleted.

10 changes: 7 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ known as [monkey-patching](https://en.wikipedia.org/wiki/Monkey_patch). When ena
the OpenTelemetry .NET Automatic Instrumentation generates traces for libraries that
don't already generate traces using the OpenTelemetry .NET SDK.

See the [examples](../examples) for demonstrations of different instrumentation scenarios
covered by the OpenTelemetry .NET Automatic Instrumentation.

See [design.md](design.md) for an architectural overview.

## Status
Expand Down Expand Up @@ -181,6 +178,13 @@ Get-Help Install-OpenTelemetryCore -Detailed

⚠️ Register for IIS and Windows Service performs a service restart.

## Instrument a container

You can find an example using Docker Compose [here](../examples).

You can also consider using
the [Kubernetes Operator for OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-operator).

## Instrument a Windows Service running a .NET application

See [windows-service-instrumentation.md](windows-service-instrumentation.md).
Expand Down
20 changes: 6 additions & 14 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,20 @@ The following Web UI endpoints are exposed:
- <http://localhost:8889/metrics>: Collected metrics
- <http://localhost:13133>: Collector health status

You can also find the exported telemetry in `dev/log` directory.

### Instrument an application

> *Warning:* Make sure to build and prepare the test environment beforehand.

[`dev/instrument.sh`](../dev/instrument.sh) helps to run a command
with automatic instrumentation in your shell, such as bash, zsh, or git bash.

For example:

```sh
./dev/instrument.sh OTEL_DOTNET_AUTO_TRACES_ENABLED_INSTRUMENTATIONS=HttpClient dotnet run -f net6.0 --project ./examples/ConsoleApp/Examples.ConsoleApp.csproj
```

You can use [`dev/envvars.sh`](../dev/envvars.sh) to export profiler
environmental variables to your current shell session.

You must run `dev/envvars.sh` from the root of this repository. For example:
You must run it from the root of this repository.
For example:

```sh
source ./dev/envvars.sh
export OTEL_DOTNET_AUTO_TRACES_ENABLED_INSTRUMENTATIONS=HttpClient
./examples/ConsoleApp/bin/Release/net6.0/Examples.ConsoleApp
. ./dev/envvars.sh
./test/test-applications/integrations/TestApplication.Smoke/bin/x64/Release/net7.0/TestApplication.Smoke
```

### Running the examples
Expand Down
3 changes: 1 addition & 2 deletions docs/manual-instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ by setting the `OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES` environmental variab
You can set the value to either `Examples.ManualInstrumentations.Registered`
or to `Examples.ManualInstrumentations.*`, which registers the entire prefix.

You can see a sample console application with automatic (`HttpClient`) and manual
instrumentation [here](../examples/ManualInstrumentations).
You can see a sample console application with manual instrumentation [here](../examples/Service/Program.cs).

> Note that an `Activity` created for `NonRegistered.ManualInstrumentations`
`ActivitySource` is not handled by the OpenTelemetry Automatic Instrumentation.
Expand Down
Loading