open-telemetry / open-telemetry/opentelemetry-python

sdk/metrics: Set timestamp instead using now

Open
#4,296 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
4d 15h
Merged PRs (30d)
19

Description

Is your feature request related to a problem?

Hi,

I have offline process (without network connection) and i want to collect metrics from it. after i'm finished i generate json files with all the metrics i used. how can i set the timestamp and not use the current (which will gave me bad results)?

Describe the solution you'd like

Put the timestamp of Counter, Gauge etc to be optional in the arguments of the functions (add , set etc...)

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the SDK metrics Counter and Gauge entry points, especially their add and set functions, and how they currently obtain timestamps. Define how optional timestamps should affect offline-generated JSON metrics, then verify that the supported instruments preserve supplied timestamps without changing current behavior when omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.