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

feat(sdk-metrics-base): add ValueType support for sync instruments #2776

Merged
merged 3 commits into from
Feb 14, 2022

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Feb 10, 2022

Which problem is this PR solving?

Trunc floating-point values if the ValueType is INT for synchronous instruments.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Exporting InstrumentDescriptor.
  • Trunc values.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link

codecov bot commented Feb 10, 2022

Codecov Report

Merging #2776 (70158a8) into main (e4aa9eb) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2776   +/-   ##
=======================================
  Coverage   93.42%   93.43%           
=======================================
  Files         159      159           
  Lines        5448     5452    +4     
  Branches     1144     1145    +1     
=======================================
+ Hits         5090     5094    +4     
  Misses        358      358           
Impacted Files Coverage Δ
.../opentelemetry-sdk-metrics-base/src/Instruments.ts 100.00% <0.00%> (ø)

@legendecas legendecas marked this pull request as ready for review February 10, 2022 06:01
@legendecas legendecas requested a review from a team February 10, 2022 06:01
Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

LGTM % nits

import { InstrumentDescriptor } from './InstrumentDescriptor';
import { WritableMetricStorage } from './state/WritableMetricStorage';

export class SyncInstrument {
constructor(private _writableMetricStorage: WritableMetricStorage, private _descriptor: InstrumentDescriptor) { }
private _valueType: ValueType;
Copy link
Member

Choose a reason for hiding this comment

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

Why have a separate private property when it can be accessed by the private descriptor already?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of reducing the property lookups in the path of counter.add. It is probably trivial, never mind. Updated.

@vmarchaud vmarchaud added the enhancement New feature or request label Feb 12, 2022
@legendecas legendecas merged commit fd62fa4 into open-telemetry:main Feb 14, 2022
@legendecas legendecas deleted the metrics-ff/value-type-sync branch February 14, 2022 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants