Skip to content

Add timestamp field support - #69

Merged
siimon merged 3 commits into
prometheus:masterfrom
tachuris:timestamp
Apr 21, 2017
Merged

siimon merged 3 commits into
prometheus:masterfrom
tachuris:timestamp

Conversation

@tachuris

Copy link
Copy Markdown
Contributor

@siimon siimon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall, just got a question that you could answer..

Have you verified this so Prometheus is able to scrape metrics with time stamps?

Comment thread lib/counter.js
if(isNumber(labels) || !labels) {
return inc.call(this, null)(labels);
return inc.call(this, null)(labels, value);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure why value is added here

@tachuris tachuris Feb 1, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If labels is a number or falsy then it's used as a value. Consequently, the next argument (value) is used as a timestamp.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gotcha!

Might rename the variable then so it makes more sense, I can do that later on if you don't want to do it..

Comment thread lib/gauge.js
Gauge.prototype.set = function(labels, value, timestamp) {
if(isNumber(labels)) {
return set.call(this, null)(labels);
return set.call(this, null)(labels, value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here, I'm probably missing something :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above :)

@tachuris

tachuris commented Feb 1, 2017

Copy link
Copy Markdown
Contributor Author

Have you verified this so Prometheus is able to scrape metrics with time stamps?

Yes, already verified.

@siimon

siimon commented Feb 2, 2017

Copy link
Copy Markdown
Contributor

Another thing, we need to update the typescript definitions as well, as in the other comment, if you don't want to do it I can do it after this PR is merged

@SimenB

SimenB commented Apr 1, 2017

Copy link
Copy Markdown
Contributor

Any news here? 😄

@siimon
siimon merged commit c324b9b into prometheus:master Apr 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants