@@ -227,7 +227,7 @@ def create_counter(
227227
228228 Args:
229229 name: The name of the instrument to be created
230- unit: The unit for measurements this instrument reports. For
230+ unit: The unit for observations this instrument reports. For
231231 example, ``By`` for bytes. UCUM units are recommended.
232232 description: A description for this instrument and what it measures.
233233 """
@@ -240,7 +240,7 @@ def create_up_down_counter(
240240
241241 Args:
242242 name: The name of the instrument to be created
243- unit: The unit for measurements this instrument reports. For
243+ unit: The unit for observations this instrument reports. For
244244 example, ``By`` for bytes. UCUM units are recommended.
245245 description: A description for this instrument and what it measures.
246246 """
@@ -253,23 +253,23 @@ def create_observable_counter(
253253
254254 An observable counter observes a monotonically increasing count by
255255 calling provided callbacks which returns multiple
256- :class:`~opentelemetry._metrics.measurement.Measurement `.
256+ :class:`~opentelemetry._metrics.observation.Observation `.
257257
258258 For example, an observable counter could be used to report system CPU
259259 time periodically. Here is a basic implementation::
260260
261- def cpu_time_callback() -> Iterable[Measurement ]:
262- measurements = []
261+ def cpu_time_callback() -> Iterable[Observation ]:
262+ observations = []
263263 with open("/proc/stat") as procstat:
264264 procstat.readline() # skip the first line
265265 for line in procstat:
266266 if not line.startswith("cpu"): break
267267 cpu, *states = line.split()
268- measurements .append(Measurement (int(states[0]) // 100, {"cpu": cpu, "state": "user"}))
269- measurements .append(Measurement (int(states[1]) // 100, {"cpu": cpu, "state": "nice"}))
270- measurements .append(Measurement (int(states[2]) // 100, {"cpu": cpu, "state": "system"}))
268+ observations .append(Observation (int(states[0]) // 100, {"cpu": cpu, "state": "user"}))
269+ observations .append(Observation (int(states[1]) // 100, {"cpu": cpu, "state": "nice"}))
270+ observations .append(Observation (int(states[2]) // 100, {"cpu": cpu, "state": "system"}))
271271 # ... other states
272- return measurements
272+ return observations
273273
274274 meter.create_observable_counter(
275275 "system.cpu.time",
@@ -281,34 +281,34 @@ def cpu_time_callback() -> Iterable[Measurement]:
281281 To reduce memory usage, you can use generator callbacks instead of
282282 building the full list::
283283
284- def cpu_time_callback() -> Iterable[Measurement ]:
284+ def cpu_time_callback() -> Iterable[Observation ]:
285285 with open("/proc/stat") as procstat:
286286 procstat.readline() # skip the first line
287287 for line in procstat:
288288 if not line.startswith("cpu"): break
289289 cpu, *states = line.split()
290- yield Measurement (int(states[0]) // 100, {"cpu": cpu, "state": "user"})
291- yield Measurement (int(states[1]) // 100, {"cpu": cpu, "state": "nice"})
290+ yield Observation (int(states[0]) // 100, {"cpu": cpu, "state": "user"})
291+ yield Observation (int(states[1]) // 100, {"cpu": cpu, "state": "nice"})
292292 # ... other states
293293
294294 Alternatively, you can pass a sequence of generators directly instead
295295 of a sequence of callbacks, which each should return iterables of
296- :class:`~opentelemetry._metrics.measurement.Measurement `::
296+ :class:`~opentelemetry._metrics.observation.Observation `::
297297
298- def cpu_time_callback(states_to_include: set[str]) -> Iterable[Iterable[Measurement ]]:
298+ def cpu_time_callback(states_to_include: set[str]) -> Iterable[Iterable[Observation ]]:
299299 while True:
300- measurements = []
300+ observations = []
301301 with open("/proc/stat") as procstat:
302302 procstat.readline() # skip the first line
303303 for line in procstat:
304304 if not line.startswith("cpu"): break
305305 cpu, *states = line.split()
306306 if "user" in states_to_include:
307- measurements .append(Measurement (int(states[0]) // 100, {"cpu": cpu, "state": "user"}))
307+ observations .append(Observation (int(states[0]) // 100, {"cpu": cpu, "state": "user"}))
308308 if "nice" in states_to_include:
309- measurements .append(Measurement (int(states[1]) // 100, {"cpu": cpu, "state": "nice"}))
309+ observations .append(Observation (int(states[1]) // 100, {"cpu": cpu, "state": "nice"}))
310310 # ... other states
311- yield measurements
311+ yield observations
312312
313313 meter.create_observable_counter(
314314 "system.cpu.time",
@@ -320,11 +320,11 @@ def cpu_time_callback(states_to_include: set[str]) -> Iterable[Iterable[Measurem
320320 Args:
321321 name: The name of the instrument to be created
322322 callbacks: A sequence of callbacks that return an iterable of
323- :class:`~opentelemetry._metrics.measurement.Measurement `.
323+ :class:`~opentelemetry._metrics.observation.Observation `.
324324 Alternatively, can be a sequence of generators that each yields
325325 iterables of
326- :class:`~opentelemetry._metrics.measurement.Measurement `.
327- unit: The unit for measurements this instrument reports. For
326+ :class:`~opentelemetry._metrics.observation.Observation `.
327+ unit: The unit for observations this instrument reports. For
328328 example, ``By`` for bytes. UCUM units are recommended.
329329 description: A description for this instrument and what it measures.
330330 """
@@ -335,7 +335,7 @@ def create_histogram(self, name, unit="", description="") -> Histogram:
335335
336336 Args:
337337 name: The name of the instrument to be created
338- unit: The unit for measurements this instrument reports. For
338+ unit: The unit for observations this instrument reports. For
339339 example, ``By`` for bytes. UCUM units are recommended.
340340 description: A description for this instrument and what it measures.
341341 """
@@ -349,10 +349,10 @@ def create_observable_gauge(
349349 Args:
350350 name: The name of the instrument to be created
351351 callbacks: A sequence of callbacks that return an iterable of
352- :class:`~opentelemetry._metrics.measurement.Measurement `.
352+ :class:`~opentelemetry._metrics.observation.Observation `.
353353 Alternatively, can be a generator that yields iterables of
354- :class:`~opentelemetry._metrics.measurement.Measurement `.
355- unit: The unit for measurements this instrument reports. For
354+ :class:`~opentelemetry._metrics.observation.Observation `.
355+ unit: The unit for observations this instrument reports. For
356356 example, ``By`` for bytes. UCUM units are recommended.
357357 description: A description for this instrument and what it measures.
358358 """
@@ -366,10 +366,10 @@ def create_observable_up_down_counter(
366366 Args:
367367 name: The name of the instrument to be created
368368 callbacks: A sequence of callbacks that return an iterable of
369- :class:`~opentelemetry._metrics.measurement.Measurement `.
369+ :class:`~opentelemetry._metrics.observation.Observation `.
370370 Alternatively, can be a generator that yields iterables of
371- :class:`~opentelemetry._metrics.measurement.Measurement `.
372- unit: The unit for measurements this instrument reports. For
371+ :class:`~opentelemetry._metrics.observation.Observation `.
372+ unit: The unit for observations this instrument reports. For
373373 example, ``By`` for bytes. UCUM units are recommended.
374374 description: A description for this instrument and what it measures.
375375 """
0 commit comments