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

The Param “Check Definition” of consul api "/v1/txn" did not changed ,when I use this api #5477

Closed
novice-dgh opened this issue Mar 12, 2019 · 3 comments · Fixed by #5553

Comments

@novice-dgh
Copy link

novice-dgh commented Mar 12, 2019

[@banks: edited to make JSON formatting more readable]

Before I use consul api "v1/txn",my node health like this:

[
    {
        "Node":"exporter",
        "CheckID":"service:exporter",
        "Name":"codis-exporter web http check",
        "Status":"critical",
        "Notes":"Http based health check",
        "Output":"",
        "ServiceID":"exporter",
        "ServiceName":"exporter",
        "ServiceTags":[
            "codis_exporter"
        ],
        "Definition":{
            "Interval":"6s",
            "Timeout":"6s",
            "DeregisterCriticalServiceAfter":"6s",
            "HTTP":"http://0.0.0.0:9599",
            "TLSSkipVerify":true
        },
        "CreateIndex":11,
        "ModifyIndex":11
    }]

when I use consul api "v1/txn" with param :

[
	{
		"KV": null,
		"Node": null,
		"Service": null,
		"Check": {
			"Verb": "cas",
			"Check": {
				"Node": "exporter",
				"CheckID": "service:exporter",
				"Name": "codis-exporter web http check",
				"Status": "passing",
				"Notes": "Http based health check",
				"Output": "HTTP GET http://0.0.0.0:9599: 200 OK Output: \u003chtml\u003e\n             \u003chead\u003e\u003ctitle\u003eCodis Exporter\u003c/title\u003e\u003c/head\u003e\n             \u003cbody\u003e\n             \u003ch1\u003eCodis Exporter\u003c/h1\u003e\n             \u003cp\u003e\u003ca href='/metrics'\u003eMetrics\u003c/a\u003e\u003c/p\u003e\n             \u003c/body\u003e\n             \u003c/html\u003e",
				"ServiceID": "exporter",
				"ServiceName": "exporter",
				"ServiceTags": [
					"codis_exporter"
				],
				"Definition": {
					"Interval": "6s",
					"Timeout": "6s",
					"DeregisterCriticalServiceAfter": "6s",
					"HTTP": "http://0.0.0.0:9599",
					"Header": null,
					"Method": "",
					"TLSSkipVerify": true,
					"TCP": ""
				},
				"CreateIndex": 11,
				"ModifyIndex": 11
			}
		}
	}
]

Then , the Node state has changed and the "Interval" and "Timeout" in Check Definition was not changed , the datas what I commit has covered。like this:
image

@evanphx @topfunky @hornbeck @dylanegan

@novice-dgh
Copy link
Author

novice-dgh commented Mar 12, 2019

before use like this:
image

@novice-dgh novice-dgh changed the title consul api "/v1/txn" Param Check Definition update didn't work The Param “Check Definition” of consul api "/v1/txn" did not changed ,when I use this api Mar 12, 2019
@evanphx
Copy link
Contributor

evanphx commented Mar 12, 2019

Do not tag random people.

@ghost
Copy link

ghost commented Mar 22, 2019

I think this bug is caused by a change in JSON syntax

https://github.com/hashicorp/consul/blob/v1.4.3/agent/txn_endpoint.go#L242

The txn endpoint linked above expects to use "IntervalDuration", "TimeoutDuration" and "DeregisterCriticalServiceAfterDuration" instead of the older "Interval", "Timeout" and "DeregisterCriticalServiceAfter" properties

It looks like the Consul Go API also needs to be updated to support the change in JSON format for the txn endpoint, it only ever sends the versions with out "Duration".

https://github.com/hashicorp/consul/blob/v1.4.3/api/health.go#L54

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 a pull request may close this issue.

2 participants