Skip to content

Add metrics exporter modes - #2353

Merged
cijothomas merged 6 commits into
open-telemetry:mainfrom
reyang:reyang/metrics-export-mode
Sep 15, 2021
Merged

Add metrics exporter modes#2353
cijothomas merged 6 commits into
open-telemetry:mainfrom
reyang:reyang/metrics-export-mode

Conversation

@reyang

@reyang reyang commented Sep 14, 2021

Copy link
Copy Markdown
Member

Introduced ExportModes attribute for metric exporters.
With the change, the SDK will throw exception if the user is trying to setup a PeriodicExportingMetricReader with an exporter which only supports pull mode.

PrometheusExporter will look like:

    [AggregationTemporality(AggregationTemporality.Cumulative)]
    [ExportModes(ExportModes.Pull)]
    public class PrometheusExporter : BaseExporter<Metric>
    {
        ...
    }

If someone is doing this:

provider.AddMetricReader(new PeriodicExportingMetricReader(new PrometheusExporter(...)))

an InvalidOperationException("The exporter does not support push mode.") will be thrown.

@reyang
reyang requested a review from a team September 14, 2021 21:12
@codecov

codecov Bot commented Sep 14, 2021

Copy link
Copy Markdown

Codecov Report

Merging #2353 (5860327) into main (2df1a62) will decrease coverage by 0.45%.
The diff coverage is 27.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2353      +/-   ##
==========================================
- Coverage   81.08%   80.62%   -0.46%     
==========================================
  Files         228      229       +1     
  Lines        7305     7318      +13     
==========================================
- Hits         5923     5900      -23     
- Misses       1382     1418      +36     
Impacted Files Coverage Δ
src/OpenTelemetry/Metrics/ExportModesAttribute.cs 0.00% <0.00%> (ø)
...Telemetry/Metrics/PeriodicExportingMetricReader.cs 0.00% <0.00%> (ø)
...OpenTelemetry/Metrics/BaseExportingMetricReader.cs 71.42% <45.45%> (-4.77%) ⬇️
...ation.AspNet.TelemetryHttpModule/ActivityHelper.cs 56.14% <0.00%> (-28.08%) ⬇️
src/OpenTelemetry.Api/Context/RuntimeContext.cs 63.15% <0.00%> (-13.16%) ⬇️
...emetry.Api/Context/AsyncLocalRuntimeContextSlot.cs 87.50% <0.00%> (-12.50%) ⬇️
...Zipkin/Implementation/ZipkinExporterEventSource.cs 63.63% <0.00%> (-9.10%) ⬇️
....TelemetryHttpModule/AspNetTelemetryEventSource.cs 23.33% <0.00%> (-6.67%) ⬇️
...ZPages/Implementation/ZPagesExporterEventSource.cs 56.25% <0.00%> (-6.25%) ⬇️
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 96.85% <0.00%> (-0.79%) ⬇️
... and 1 more

@reyang
reyang force-pushed the reyang/metrics-export-mode branch from b629336 to a115014 Compare September 15, 2021 01:17
Comment thread src/OpenTelemetry/Metrics/ExportMode.cs Outdated
Comment thread src/OpenTelemetry/Metrics/ExportModeAttribute.cs Outdated
Comment thread src/OpenTelemetry/Metrics/PeriodicExportingMetricReader.cs
@reyang reyang mentioned this pull request Sep 15, 2021
3 tasks
@reyang reyang changed the title Add metrics exporter mode Add metrics exporter modes Sep 15, 2021
@cijothomas
cijothomas merged commit 5deeb07 into open-telemetry:main Sep 15, 2021
@reyang
reyang deleted the reyang/metrics-export-mode branch September 16, 2021 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants