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

Add support for instrumentation scope attributes (Meter tags) #5089

Merged
merged 21 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
4 changes: 2 additions & 2 deletions examples/Console/TestOtlpExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ internal static object Run(string endpoint, string protocol)
* launch the OpenTelemetry Collector with an OTLP receiver, by running:
*
* - On Unix based systems use:
* docker run --rm -it -p 4317:4317 -p 4318:4318 -v $(pwd):/cfg otel/opentelemetry-collector:0.48.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -p 4318:4318 -v $(pwd):/cfg otel/opentelemetry-collector:latest --config=/cfg/otlp-collector-example/config.yaml
*
* - On Windows use:
* docker run --rm -it -p 4317:4317 -p 4318:4318 -v "%cd%":/cfg otel/opentelemetry-collector:0.48.0 --config=/cfg/otlp-collector-example/config.yaml
* docker run --rm -it -p 4317:4317 -p 4318:4318 -v "%cd%":/cfg otel/opentelemetry-collector:latest --config=/cfg/otlp-collector-example/config.yaml
*
* Open another terminal window at the examples/Console/ directory and
* launch the OTLP example by running:
Expand Down
13 changes: 11 additions & 2 deletions src/OpenTelemetry.Exporter.Console/ConsoleMetricExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public override ExportResult Export(in Batch<Metric> batch)

foreach (var metric in batch)
{
var msg = new StringBuilder($"\nExport ");
msg.Append(metric.Name);
var msg = new StringBuilder($"\n");
msg.Append($"Metric Name: {metric.Name}");
if (metric.Description != string.Empty)
{
msg.Append(", ");
Expand All @@ -75,6 +75,15 @@ public override ExportResult Export(in Batch<Metric> batch)

this.WriteLine(msg.ToString());

foreach (var meterTag in metric.MeterTags)
{
this.WriteLine("\tMeter Tags:");
if (ConsoleTagTransformer.Instance.TryTransformTag(meterTag, out var result))
{
this.WriteLine($"\t {result}");
}
}

foreach (ref readonly var metricPoint in metric.GetMetricPoints())
{
string valueDisplay = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
accepts a `name` parameter to support named options.
([#4916](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4916))

* Add support for Instrumentation Scope Attributes (i.e Meter Tags), fixing
cijothomas marked this conversation as resolved.
Show resolved Hide resolved
issue [#4563](https://github.com/open-telemetry/opentelemetry-dotnet/issues/4563).

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
Loading
Loading