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

docs(batcher): incorrect metricDescriptor field labels #1314

Closed
legendecas opened this issue Jul 15, 2020 · 3 comments · Fixed by #1431
Closed

docs(batcher): incorrect metricDescriptor field labels #1314

legendecas opened this issue Jul 15, 2020 · 3 comments · Fixed by #1431
Labels
document Documentation-related good first issue Good for newcomers up-for-grabs Good for taking. Extra help will be provided by maintainers

Comments

@legendecas
Copy link
Member

legendecas commented Jul 15, 2020

The doc says that custom batcher can determine aggregator for metrics by metricDescriptor.labels, while this is not true -- there are no metricDescriptor.labels in MetricDescriptor.

export class CustomBatcher extends UngroupedBatcher {
  aggregatorFor (metricDescriptor: MetricDescriptor) {
    if (metricDescriptor.labels === 'metricToBeAveraged') { // <= here is the problem
      return new AverageAggregator(10);
    }
    // this is exactly what the "UngroupedBatcher" does, we will re-use it
    // to fallback on the default behavior
    switch (metricDescriptor.metricKind) {
      case MetricKind.COUNTER:
        return new CounterSumAggregator();
      case MetricKind.OBSERVER:
        return new ObserverAggregator();
      default:
        return new MeasureExactAggregator();
    }
  }
}

Link: https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/batcher-api.md

Also, I'd believe it can be documented too that how do we declare a metrics that will be aggregated by the custom aggregators with custom batcher.

@legendecas legendecas added the bug Something isn't working label Jul 15, 2020
@dyladan
Copy link
Member

dyladan commented Jul 15, 2020

@legendecas are you planning on fixing this? If so, assign yourself please. If not, can you mark it as up-for-grabs?

@dyladan dyladan added document Documentation-related and removed bug Something isn't working labels Jul 15, 2020
@legendecas legendecas added the up-for-grabs Good for taking. Extra help will be provided by maintainers label Jul 15, 2020
@vmarchaud
Copy link
Member

I think it was a typo when i wrote this, it's indeed not possible. At the bottom with the complete version i use if (metricDescriptor.name === 'requests').

Also, I'd believe it can be documented too that how do we declare a metrics that will be aggregated by the custom aggregators with custom batcher.

I believe thats what i was achieving with the complete exemple at the bottom ? Was i wrong ?

@legendecas
Copy link
Member Author

@vmarchaud I believe thats what i was achieving with the complete exemple at the bottom

Yeah, you are right. I've missed that.

@dyladan dyladan added the good first issue Good for newcomers label Jul 17, 2020
@dyladan dyladan linked a pull request Aug 17, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document Documentation-related good first issue Good for newcomers up-for-grabs Good for taking. Extra help will be provided by maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants