-
Notifications
You must be signed in to change notification settings - Fork 773
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 PeriodicExporterOptions for console exporter #2648
Changes from 3 commits
6d4fde9
582ab9e
b54d2f3
bba1a15
6219570
b455ad0
bad1a9f
5e4034d
d9f2ee7
7b13ec4
cb2d200
d6b0379
b2dda9f
e1c8b15
315ce34
3e172af
88e805f
7502e65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// <copyright file="MetricReaderExportType.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
namespace OpenTelemetry.Metrics | ||
{ | ||
public enum MetricReaderExportType | ||
reese-lee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
Simple, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if I can suggest a better name, but simple doesn't convey the behavior...(For tracing, we could use Simple, as spec defined it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, I'm not a fan of I was tempted to consider the terms There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Well..the dispose is a manual action, as user has to explicitly call it (.Dispose, or use using statement/block to let c# do it) I'll merge to unblock progress, and will do a quick vote in todays SIG meeting:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OnDemand? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about AdHoc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disordered 🤣 |
||
Periodic, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// <copyright file="PeriodicExporterOptions.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
public class PeriodicExporterOptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be misleading, it is actual options for reader, not exporter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed the name is not quite right here. It was in part inspired by this section of the spec titled Periodic exporting MetricReader. Few ideas:
I think I like one of the rename options because the class kind of mimics what we have in tracing plus we should probably expand these options in the future with Do folks like any of these options? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now, we opted to rename |
||
{ | ||
public int ExportIntervalMilliseconds { get; set; } = 60000; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reyang @alanwest Can you share your thoughts on making the default as Periodic?
One thing I have observed is, users are used to seeing traces/logs from
ConsoleExporter
, by just doingAddConsoleExporter
. However, for Metrics, it won't work. There is nothing in the spec which saysConsoleExporter
should be paired with a periodic exporting reader, but I think it makes sense to pair it withPeriodicExportingReader
by default, to have similar experience as traces/logs.This example: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/AspNetCore/Startup.cs#L137, won't work as is, and most folks will be puzzled as to why Metrics are not showing up....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree that it makes sense for the console exporter to default to periodic. I think the general expectation is that info piped to stdout is emitted automatically vs invoking a collect or flush.
Also, my understanding is the console exporter is primarily useful in testing/troubleshooting scenarios. I think this is especially true for metrics, so seeing a quick validation things are alive and working with the single line
AddConsoleExporter()
is a plus.That said, I think when we take on the work to support additional output formats, I think the usefulness of the console exporter may expand beyond testing scenarios. In those cases I think folks will be fine configuring the exporter how they need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the challenges are:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we borrow that we do for OTLP Metric exporter?
Same default export interval as OTLP.
The behavior during exit - not sure I follow the specifics here. We do the usual shutdown/dispose right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could. The question is why do you think Console and OTLP should have the same default interval?
I think there should be a concrete usage scenario and we need to think about the design. For example, if the expectation is to use it for interactive output, the refresh rate should be
<= 0.3s
(based on the common study from interactive UI, and that's the reason why in the Stress test I picked0.2s
delay for each refresh).There are many issues with the current Console exporter. For example if there are both trace and metrics exporter, and folks would want to see Exemplar which connects traces and metrics, the output will be mixed up because the lack of synchronization on the outputs.
My gut feeling is that by making it outputs periodically without understanding the usage scenario and without a good design, is probably going to make the current situation worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to @reyang's judgment on not yet understanding the usage scenario. I've definitely not thought deep about either interactivity nor metric's relationship to tracing.
That said, if we continue to default to non-periodic, perhaps we update the ASP.NET Core example to use periodic to help guide folks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either we use periodic console exporter (and gather feedback about the default interval), or use Prometheus exporter. (the current console metrics exporter has a bug that it only outputs to stdout rather than leveraging the abstraction here)