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

Allow the DoubleHistogramInstrument to record value #473

Conversation

hunguyenaxon
Copy link
Contributor

The fix is for #468

As per in LongHistogramMeterSdk, we need to record the value for DoubleHistogramInstrument as well

//TODO: implement
public func record(value: Double, attributes: [String: OpenTelemetryApi.AttributeValue]) {
if value < 0 {
print("Histograms can only record non-negative values. Instrument \(instrumentDescriptor.name) has recorded a negative value.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message is following to Android version (link)

@Override
  public void record(long value, Attributes attributes, Context context) {
    if (value < 0) {
      throttlingLogger.log(
          Level.WARNING,
          "Histograms can only record non-negative values. Instrument "
              + getDescriptor().getName()
              + " has recorded a negative value.");
      return;
    }
    storage.recordLong(value, attributes, context);
  }

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Files Coverage Δ
...etrySdk/Metrics/Stable/LongHistogramMeterSdk.swift 0.00% <0.00%> (ø)
...rySdk/Metrics/Stable/DoubleHistogramMeterSdk.swift 28.57% <12.50%> (-11.43%) ⬇️

... and 1 file with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@bryce-b bryce-b merged commit cc58692 into open-telemetry:main Oct 9, 2023
4 checks passed
@hunguyenaxon hunguyenaxon deleted the hunguyen-468-fix-record-double-histogram-metric branch October 10, 2023 00:52
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.

2 participants