Skip to content

Clarify instrument concurrency requirements #4867

@tigrannajaryan

Description

@tigrannajaryan

The Concurrency requirements for Metric API currently state

All methods of any Instrument are safe to be called concurrently.

My expectations after reading this sentence was that if I obtain an instrument in a particular language implementation, it should be safe to calls its methods concurrently. The particular use case I had was calling Int64Counter.Add() method in Go.

The docs for Int64Counter.Add() do not specify whether it is safe to call concurrently, so I asked @MrAlias for clarification.

His opinion on the spec requirement is different from what I expected. He believes the API requirement I linked to is non normative and doesn't apply to SDK anyway since it is about the API. (@MrAlias please correct me if I misinterpreted your opinion).

I would like to have a discussion and make clarification in the spec about what we expect from this requirement section.

My opinion is the following:

  1. The listed requirement is part of the spec. We may want to reword to make it normative to avoid confusion.
  2. My reading of that sentence is that you can call the Instrument APIs concurrently regardless of what implementation (what SDK) the API is plugged into.
  3. The SDK inherits all requirements of the API that it implements. If the API defines concurrency guarantees the SDK is expected to implement it in a compliant way. This API requirement by proxy sets concurrency requirements on Instrument implementations in SDKs.

I am looking for an input from spec maintainers/approvers.

Metadata

Metadata

Labels

spec:metricsRelated to the specification/metrics directorytriage:accepted:ready-with-sponsorReady to be implemented and has a specification sponsor assigned

Type

No type

Projects

Status

Spec - Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions