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

Correct HTTP Push end point #101

Closed
wants to merge 1 commit into from
Closed

Correct HTTP Push end point #101

wants to merge 1 commit into from

Conversation

meetme2meat
Copy link

As of 0.7.0 the HTTP push endpoint has been changed from /jobs/ -> /job/.

This pull request attempt to correct that.

…n /job/. This commit attempt to address this

Signed-off-by: Viren Negi <meetme2meat@gmail.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c0eaf93 on meetme2meat:correct-http-push-endpoint into 300de85 on prometheus:master.

@coveralls
Copy link

coveralls commented Jan 18, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 464aa05 on meetme2meat:correct-http-push-endpoint into 300de85 on prometheus:master.

@beorn7 beorn7 requested a review from grobie January 21, 2019 19:45
PATH = '/metrics/jobs/%s'.freeze
INSTANCE_PATH = '/metrics/jobs/%s/instances/%s'.freeze
PATH = '/metrics/job/%s'.freeze
INSTANCE_PATH = '/metrics/job/%s/instances/%s'.freeze
Copy link
Member

Choose a reason for hiding this comment

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

s/instances/instance/

Copy link
Author

Choose a reason for hiding this comment

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

@beorn7 I can change that but I do seem to find the anything mentioned in the README.md regarding the instances thing?

end

it 'uses the full metrics path if an instance value is given' do
push = Prometheus::Client::Push.new('bar-job', 'foo')

expect(push.path).to eql('/metrics/jobs/bar-job/instances/foo')
expect(push.path).to eql('/metrics/job/bar-job/instances/foo')
Copy link
Member

Choose a reason for hiding this comment

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

s/instances/instance/

end

it 'escapes non-URL characters' do
push = Prometheus::Client::Push.new('bar job', 'foo <my instance>')

expected = '/metrics/jobs/bar%20job/instances/foo%20%3Cmy%20instance%3E'
expected = '/metrics/job/bar%20job/instances/foo%20%3Cmy%20instance%3E'
Copy link
Member

Choose a reason for hiding this comment

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

s/instances/instance/

@beorn7
Copy link
Member

beorn7 commented Jan 21, 2019

Note that this is the same as #99 and #97 .

@grobie could you shepherd this into a solution? Note that Pushgateway v0.7 doesn't support the legacy paths anymore.

@Eric-Fontana-Bose
Copy link

Shouldn’t it be instance (singular) not instances ? See https://github.com/prometheus/pushgateway/pull/227/files

@beorn7
Copy link
Member

beorn7 commented Jan 24, 2019

It can be anything, but with the current endpoint, if you use /instances/foo, you will push with a label instances="foo" rather than instance="foo".

Thus, if you still want to push an instance tag (which is not recommended in general), you need to use /instance/ in the path, even if /instances/ is technically possible.

@meetme2meat
Copy link
Author

meetme2meat commented Jan 24, 2019

@beorn7 Yes, naming it as instance would help in the scenario where we are interested in knowing the instance from where the metric was pushed, else Prometheus db would have instances and instance label.

On the other note, the honour_labels options which I planning to use on prometheus_scarper will fail if it stays as instances.

@beorn7 I can make the change. If my appeal sounds reasonable to you.

@beorn7
Copy link
Member

beorn7 commented Jan 24, 2019

The minimum fix of client_ruby is to do s/jobs/job/ and s/instances/instance/ without changing the function signature. Deprecation of pushing with an instance label can be done separately.

@grobie is the maintainer and has to shepherd this.

@beorn7 beorn7 mentioned this pull request Jan 25, 2019
@beorn7
Copy link
Member

beorn7 commented Jan 25, 2019

I talked to @grobie and @stuartnelson3 and created #102 with the suggested changes. Thus, this has been superseded. My apologies for the slow processing. We should have done a better job as maintainers.

@beorn7 beorn7 closed this Jan 25, 2019
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.

4 participants