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

[Prometheus] Split up projects based on hosting mechanism. #3430

Merged
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
93b6bcd
added 3 src projects and 3 test projects
Yun-Ting Jul 6, 2022
3ebf95a
RS0016 of the shared project exists
Yun-Ting Jul 6, 2022
d2bf46f
lint
Yun-Ting Jul 6, 2022
0677773
removed original prometheus project
Yun-Ting Jul 7, 2022
9fae7a1
fix docs links
Yun-Ting Jul 7, 2022
2e14a87
Merge branch 'main' into yunl/RefactorPrometheusExporter2
Yun-Ting Jul 7, 2022
fd111e1
partial fix
Yun-Ting Jul 7, 2022
037f697
fixes api
Yun-Ting Jul 7, 2022
735ae68
fix doc
Yun-Ting Jul 7, 2022
6671740
Merge branch 'yunl/RefactorPrometheusExporter2' of https:…
Yun-Ting Jul 7, 2022
727e557
listener api
Yun-Ting Jul 7, 2022
147fe10
comment
Yun-Ting Jul 7, 2022
0e13357
added nestandard2.0 to httpListener
Yun-Ting Jul 8, 2022
d201b24
comments
Yun-Ting Jul 9, 2022
d5391f1
changelog
Yun-Ting Jul 9, 2022
aeede5a
space
Yun-Ting Jul 9, 2022
b3213df
nits
Yun-Ting Jul 9, 2022
3d66bc3
fix link
Yun-Ting Jul 9, 2022
141b5a1
Merge branch 'main' into yunl/RefactorPrometheusExporter2
Yun-Ting Jul 9, 2022
1c8facc
Merge branch 'main' into yunl/RefactorPrometheusExporter2
Yun-Ting Jul 9, 2022
b5cbf7b
space
Yun-Ting Jul 9, 2022
7a105d1
fix test
Yun-Ting Jul 9, 2022
0d93249
Merge branch 'yunl/RefactorPrometheusExporter2' of https:…
Yun-Ting Jul 9, 2022
0416582
bookmark
Yun-Ting Jul 9, 2022
3519e37
trigger CI
Yun-Ting Jul 9, 2022
c93c9b1
Fixes to get solution building.
CodeBlanch Jul 11, 2022
011958b
access modifier of prometheusExporter and APIs
Yun-Ting Jul 11, 2022
69d0af1
Tweak targets.
CodeBlanch Jul 11, 2022
f176062
Merge branch 'yunl/RefactorPrometheusExporter2' of https:…
CodeBlanch Jul 11, 2022
608c16b
Public API for net462.
CodeBlanch Jul 11, 2022
4a5fb58
Public API update.
CodeBlanch Jul 11, 2022
e32d2eb
Public API fixes.
CodeBlanch Jul 11, 2022
17fa0b7
Dispose PrometheusHttpListener when exporter is disposed.
CodeBlanch Jul 11, 2022
2378c43
Update docs/metrics/getting-started-prometheus-grafana/getting-starte…
Yun-Ting Jul 13, 2022
64db84d
restored AspNetCore changelog
Yun-Ting Jul 13, 2022
fabc80f
make PrometheusExporter internal
Yun-Ting Jul 14, 2022
bbb50cf
comments
Yun-Ting Jul 15, 2022
82ae5ae
Merge branch 'yunl/RefactorPrometheusExporter2' of https:…
Yun-Ting Jul 15, 2022
136607c
Merge branch 'main' into yunl/RefactorPrometheusExporter2
Yun-Ting Jul 15, 2022
aa8cee1
trigger CI
Yun-Ting Jul 16, 2022
5bebc6a
Merge branch 'yunl/RefactorPrometheusExporter2' of https:…
Yun-Ting Jul 16, 2022
d62bc09
merge main
Yun-Ting Jul 18, 2022
6cb19a4
trigger CI
Yun-Ting Jul 18, 2022
76b15c8
trigger CI
Yun-Ting Jul 18, 2022
908918e
move prometheusExporterMeterProviderBuilderExtensions and test file
Yun-Ting Jul 19, 2022
f9d70bb
line ending
Yun-Ting Jul 19, 2022
7c0ca4f
namespace update when users reference AspNetCore and Listener project…
Yun-Ting Jul 20, 2022
4f6975b
LF
Yun-Ting Jul 20, 2022
a7f65a9
ditto
Yun-Ting Jul 20, 2022
233114a
ditto
Yun-Ting Jul 20, 2022
ae24e0e
Merge branch 'main' into yunl/RefactorPrometheusExporter2
cijothomas Jul 22, 2022
ee137cd
Update src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md
Yun-Ting Jul 25, 2022
da80136
Update src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md
Yun-Ting Jul 25, 2022
9bd7930
Namespace tweaks.
CodeBlanch Jul 26, 2022
5015208
rename compiler constant
Yun-Ting Jul 26, 2022
90181ce
merge main
Yun-Ting Jul 26, 2022
0f953f5
comments
Yun-Ting Jul 26, 2022
f1caae6
removed non-existing nuget urls to pass the markdown lint check
Yun-Ting Jul 26, 2022
b66a2f6
Revert "removed non-existing nuget urls to pass the markdown lint check"
Yun-Ting Jul 26, 2022
82ff0c1
fix markdown
Yun-Ting Jul 26, 2022
7ca9fd2
ditto
Yun-Ting Jul 27, 2022
cf9a910
addressed comments
Yun-Ting Jul 27, 2022
009cb7d
bug fix
Yun-Ting Jul 27, 2022
6dfc90c
removed unnecessary proj ref
Yun-Ting Jul 28, 2022
4f5449f
Merge branch 'main' into yunl/RefactorPrometheusExporter2
cijothomas Jul 28, 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
48 changes: 36 additions & 12 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "reporting-exceptions", "doc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs\trace\customizing-the-sdk\customizing-the-sdk.csproj", "{64E3D8BB-93AB-4571-93F7-ED8D64DFFD06}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{52158A12-E7EF-45A1-859F-06F9B17410CB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "learning-more-instruments", "docs\metrics\learning-more-instruments\learning-more-instruments.csproj", "{E7F491CC-C37E-4A56-9CA7-8F77F59E0614}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started", "docs\metrics\getting-started\getting-started.csproj", "{EA60B549-F712-4ABE-8E44-FCA83B78C06E}"
Expand All @@ -209,8 +207,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests.Stress", "test\OpenTelemetry.Tests.Stress\OpenTelemetry.Tests.Stress.csproj", "{2770158A-D220-414B-ABC6-179371323579}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.Tests", "test\OpenTelemetry.Exporter.Prometheus.Tests\OpenTelemetry.Exporter.Prometheus.Tests.csproj", "{380EE686-91F1-45B3-AEEB-755F0E5B068F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs", "src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj", "{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.6.0", "test\TestApp.AspNetCore.6.0\TestApp.AspNetCore.6.0.csproj", "{0076C657-564F-4787-9FFF-52D9D55166E8}"
Expand Down Expand Up @@ -239,6 +235,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Ev
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.EventSource.Tests", "test\OpenTelemetry.Extensions.EventSource.Tests\OpenTelemetry.Extensions.EventSource.Tests.csproj", "{304FCFFF-97DE-484B-8D8C-612C644426E5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.AspNetCore", "src\OpenTelemetry.Exporter.Prometheus.AspNetCore\OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj", "{921CF401-4C2F-4C6D-A750-0B5DC457C1F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.HttpListener", "src\OpenTelemetry.Exporter.Prometheus.HttpListener\OpenTelemetry.Exporter.Prometheus.HttpListener.csproj", "{6B0232B7-5F29-4FB5-B383-1AA02DFE1089}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.Shared", "src\OpenTelemetry.Exporter.Prometheus.Shared\OpenTelemetry.Exporter.Prometheus.Shared.csproj", "{4AD27517-BAFC-413B-A8F0-988C3CEDC662}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests", "test\OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests\OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj", "{FBD12B0B-6731-4DD4-9C13-86F34593E974}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.HttpListener.Tests", "test\OpenTelemetry.Exporter.Prometheus.HttpListener.Tests\OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj", "{4EF4364F-6E64-43CE-BED1-E6FE01024899}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus.Shared.Tests", "test\OpenTelemetry.Exporter.Prometheus.Shared.Tests\OpenTelemetry.Exporter.Prometheus.Shared.Tests.csproj", "{8E75AEE2-017B-474F-A96D-035DF76A1C9E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -405,10 +413,6 @@ Global
{64E3D8BB-93AB-4571-93F7-ED8D64DFFD06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64E3D8BB-93AB-4571-93F7-ED8D64DFFD06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64E3D8BB-93AB-4571-93F7-ED8D64DFFD06}.Release|Any CPU.Build.0 = Release|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52158A12-E7EF-45A1-859F-06F9B17410CB}.Release|Any CPU.Build.0 = Release|Any CPU
{E7F491CC-C37E-4A56-9CA7-8F77F59E0614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7F491CC-C37E-4A56-9CA7-8F77F59E0614}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7F491CC-C37E-4A56-9CA7-8F77F59E0614}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -433,10 +437,6 @@ Global
{2770158A-D220-414B-ABC6-179371323579}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2770158A-D220-414B-ABC6-179371323579}.Release|Any CPU.Build.0 = Release|Any CPU
{380EE686-91F1-45B3-AEEB-755F0E5B068F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{380EE686-91F1-45B3-AEEB-755F0E5B068F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{380EE686-91F1-45B3-AEEB-755F0E5B068F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{380EE686-91F1-45B3-AEEB-755F0E5B068F}.Release|Any CPU.Build.0 = Release|Any CPU
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E1A5FA3-E024-4972-9EDC-11E36C5A0D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -493,6 +493,30 @@ Global
{304FCFFF-97DE-484B-8D8C-612C644426E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{304FCFFF-97DE-484B-8D8C-612C644426E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{304FCFFF-97DE-484B-8D8C-612C644426E5}.Release|Any CPU.Build.0 = Release|Any CPU
{921CF401-4C2F-4C6D-A750-0B5DC457C1F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{921CF401-4C2F-4C6D-A750-0B5DC457C1F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{921CF401-4C2F-4C6D-A750-0B5DC457C1F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{921CF401-4C2F-4C6D-A750-0B5DC457C1F1}.Release|Any CPU.Build.0 = Release|Any CPU
{6B0232B7-5F29-4FB5-B383-1AA02DFE1089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B0232B7-5F29-4FB5-B383-1AA02DFE1089}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B0232B7-5F29-4FB5-B383-1AA02DFE1089}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B0232B7-5F29-4FB5-B383-1AA02DFE1089}.Release|Any CPU.Build.0 = Release|Any CPU
{4AD27517-BAFC-413B-A8F0-988C3CEDC662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AD27517-BAFC-413B-A8F0-988C3CEDC662}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AD27517-BAFC-413B-A8F0-988C3CEDC662}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AD27517-BAFC-413B-A8F0-988C3CEDC662}.Release|Any CPU.Build.0 = Release|Any CPU
{FBD12B0B-6731-4DD4-9C13-86F34593E974}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBD12B0B-6731-4DD4-9C13-86F34593E974}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBD12B0B-6731-4DD4-9C13-86F34593E974}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBD12B0B-6731-4DD4-9C13-86F34593E974}.Release|Any CPU.Build.0 = Release|Any CPU
{4EF4364F-6E64-43CE-BED1-E6FE01024899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EF4364F-6E64-43CE-BED1-E6FE01024899}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EF4364F-6E64-43CE-BED1-E6FE01024899}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EF4364F-6E64-43CE-BED1-E6FE01024899}.Release|Any CPU.Build.0 = Release|Any CPU
{8E75AEE2-017B-474F-A96D-035DF76A1C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E75AEE2-017B-474F-A96D-035DF76A1C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E75AEE2-017B-474F-A96D-035DF76A1C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E75AEE2-017B-474F-A96D-035DF76A1C9E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ libraries](https:/open-telemetry/opentelemetry-specification/blob/ma
* [Jaeger](./src/OpenTelemetry.Exporter.Jaeger/README.md)
* [OTLP](./src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md)
(OpenTelemetry Protocol)
* [Prometheus](./src/OpenTelemetry.Exporter.Prometheus/README.md)
* [Prometheus HttpListener](./src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md)
* [Prometheus AspNetCore](./src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md)
* [Zipkin](./src/OpenTelemetry.Exporter.Zipkin/README.md)

See the [OpenTelemetry registry](https://opentelemetry.io/registry/?s=net) for
Expand Down
3 changes: 2 additions & 1 deletion docs/metrics/customizing-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ Refer to the individual exporter docs to learn how to use them:
* [In-memory](../../../src/OpenTelemetry.Exporter.InMemory/README.md)
* [OTLP](../../../src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md)
(OpenTelemetry Protocol)
* [Prometheus](../../../src/OpenTelemetry.Exporter.Prometheus/README.md)
* [Prometheus HttpListener](../../../src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md)
* [Prometheus AspNetCore](../../../src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md)

### Resource

Expand Down
3 changes: 2 additions & 1 deletion docs/metrics/extending-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ OpenTelemetry .NET SDK has provided the following built-in metric exporters:
* [InMemory](../../../src/OpenTelemetry.Exporter.InMemory/README.md)
* [Console](../../../src/OpenTelemetry.Exporter.Console/README.md)
* [OpenTelemetryProtocol](../../../src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md)
* [Prometheus](../../../src/OpenTelemetry.Exporter.Prometheus/README.md)
* [Prometheus HttpListener](../../../src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md)
* [Prometheus AspNetCore](../../../src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md)

Custom exporters can be implemented to send telemetry data to places which are
not covered by the built-in exporters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void Main()
{
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter("MyCompany.MyProduct.MyLibrary")
.AddPrometheusExporter(options => { options.StartHttpListener = true; })
.AddPrometheusHttpListener()
.Build();

Console.WriteLine("Press any key to exit");
Expand Down
21 changes: 11 additions & 10 deletions docs/metrics/getting-started-prometheus-grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ dotnet run
```

Add a reference to [Prometheus
Exporter](../../../src/OpenTelemetry.Exporter.Prometheus/README.md):
Exporter Http Listener](../../../src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md):

```sh
dotnet add package --prerelease OpenTelemetry.Exporter.Prometheus
dotnet add package --prerelease OpenTelemetry.Exporter.Prometheus.HttpListener
```

Now, we are going to make some small tweaks to the example in the
Expand All @@ -46,12 +46,13 @@ And replace the below line:
with

```csharp
.AddPrometheusExporter(options => { options.StartHttpListener = true; })
.AddPrometheusHttpListener()
```

With `AddPrometheusExporter()`, OpenTelemetry `PrometheusExporter` will export
`PrometheusHttpListener` is a wrapper that contains `PrometheusExporter`.
With `AddPrometheusHttpListener()`, OpenTelemetry `PrometheusExporter` will export
data via the endpoint defined by
[PrometheusExporterOptions.HttpListenerPrefixes](../../../src/OpenTelemetry.Exporter.Prometheus/README.md#httplistenerprefixes),
[PrometheusHttpListenerOptions.Prefixes](../../../src/OpenTelemetry.Exporter.Prometheus.HttpListener/README.md#prefixes),
which is `http://localhost:9464/` by default.

```mermaid
Expand All @@ -60,7 +61,7 @@ graph LR
subgraph SDK
MeterProvider
MetricReader[BaseExportingMetricReader]
PrometheusExporter["PrometheusExporter<br/>(http://localhost:9464/)"]
PrometheusHttpListener["PrometheusHttpListener<br/>(http://localhost:9464/)"]
end

subgraph API
Expand All @@ -69,7 +70,7 @@ end

Instrument --> | Measurements | MeterProvider

MeterProvider --> | Metrics | MetricReader --> | Pull | PrometheusExporter
MeterProvider --> | Metrics | MetricReader --> | Pull | PrometheusHttpListener
```

Also, for our learning purpose, use a while-loop to keep increasing the counter
Expand Down Expand Up @@ -99,7 +100,7 @@ web browser:

![Browser UI](https://user-images.githubusercontent.com/17327289/151633547-736c6d91-62d2-4e66-a53f-2e16c44bfabc.png)

Now, we understand how we can configure `PrometheusExporter` to export metrics.
Now, we understand how we can configure `PrometheusHttpListener` to export metrics.
Next, we are going to learn about how to use Prometheus to collect the metrics.

## Collect metrics using Prometheus
Expand Down Expand Up @@ -156,7 +157,7 @@ values we have set in `otel.yml`.
Congratulations!

Now we know how to configure Prometheus server and deploy OpenTelemetry
`PrometheusExporter` to export our metrics. Next, we are going to explore a tool
`PrometheusHttpListener` to export our metrics. Next, we are going to explore a tool
called Grafana, which has powerful visualizations for the metrics.

## Explore metrics using Grafana
Expand Down Expand Up @@ -201,7 +202,7 @@ subgraph Prometheus
PrometheusDatabase
end

PrometheusExporter["PrometheusExporter<br/>(listening at #quot;http://localhost:9464/#quot;)"] -->|HTTP GET| PrometheusScraper{{"Prometheus scraper<br/>(polling #quot;http://localhost:9464/metrics#quot; every 10 seconds)"}}
PrometheusHttpListener["PrometheusHttpListener<br/>(listening at #quot;http://localhost:9464/#quot;)"] -->|HTTP GET| PrometheusScraper{{"Prometheus scraper<br/>(polling #quot;http://localhost:9464/metrics#quot; every 10 seconds)"}}
PrometheusScraper --> PrometheusDatabase[("Prometheus TSDB (time series database)")]
PrometheusDatabase -->|http://localhost:9090/graph| PrometheusUI["Browser<br/>(Prometheus Dashboard)"]
PrometheusDatabase -->|http://localhost:9090/api/| Grafana[Grafana Server]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.HttpListener\OpenTelemetry.Exporter.Prometheus.HttpListener.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/AspNetCore/Examples.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.AspNetCore\OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/Console/Examples.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.HttpListener\OpenTelemetry.Exporter.Prometheus.HttpListener.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs\OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs.csproj" />
</ItemGroup>
</Project>
9 changes: 3 additions & 6 deletions examples/Console/TestPrometheusExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ internal static object Run(int port)
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter(MyMeter.Name)
.AddMeter(MyMeter2.Name)
.AddPrometheusExporter(options =>
{
options.StartHttpListener = true;
options.HttpListenerPrefixes = new string[] { $"http://localhost:{port}/" };
options.ScrapeResponseCacheDurationMilliseconds = 0;
})
.AddPrometheusHttpListener(
exporterOptions => exporterOptions.ScrapeResponseCacheDurationMilliseconds = 0,
listenerOptions => listenerOptions.Prefixes = new string[] { $"http://localhost:{port}/" })
.Build();

var process = Process.GetCurrentProcess();
Expand Down
Loading