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

[ElasticSearch] Improve tests and bug fixes #1487

Merged
merged 5 commits into from
Apr 3, 2015
Merged

[ElasticSearch] Improve tests and bug fixes #1487

merged 5 commits into from
Apr 3, 2015

Conversation

remh
Copy link

@remh remh commented Mar 30, 2015

Also:

  • Pretty format coverage report
  • Log more info when candidates assertion is failing

- Properly handle multiple instances
- 100% metrics and service checks coverage
- Flake8 (everything but line > 80)
- Make sure that constants are constants

Also:
- Pretty format coverage report
- Log more info when candidates assertion is failing
@remh remh added this to the 5.3.0 milestone Mar 30, 2015
@remh
Copy link
Author

remh commented Mar 31, 2015

Failing on Apache test.

@@ -126,7 +159,7 @@ class ESCheck(AgentCheck):
"elasticsearch.relocating_shards": ("gauge", "relocating_shards"),
"elasticsearch.initializing_shards": ("gauge", "initializing_shards"),
"elasticsearch.unassigned_shards": ("gauge", "unassigned_shards"),
"elasticsearch.cluster_status": ("gauge", "status", lambda v: {"red":0, "yellow":1, "green":2}.get(v, -1)),
"elasticsearch.cluster_status": ("gauge", "status", lambda v: {"red": 0, "yellow": 1, "green": 2}.get(v, -1)),
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: but this should probably use the class constants instead of bare integers to define the service check values.

Copy link
Author

Choose a reason for hiding this comment

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

What class constants ? This is a mapping that is not related to service checks. This is sent as a metric, it was done before we had service checks so one could alert on the cluster status.

Those values are actually the opposite of the constants we use for service checks.

Copy link
Member

Choose a reason for hiding this comment

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

Apologies, scratch that.. Should have looked more at the context.
Maybe at one point we could deprecate this guy, it's really confusing

log.error("No candidates for {0} (value: {1}, tags: {2}, count: {3}, at_least: {4}, hostname: {5})"\
.format(metric_name, value, tags, count, at_least, hostname))
raise

Copy link
Member

Choose a reason for hiding this comment

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

I added the debug headers for that reason ("Looking for...") should we keep only one or another? I am good with both, also "No candidates" might not be a clear message for some cases like at_least=1.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't find the debug log visible enough when testing, especially when you have a lot of metrics. This log line made my debugging easier. I can change the message though.

Copy link
Member

Choose a reason for hiding this comment

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

Works for me. Let's get rid of the debug lines then.

@remh
Copy link
Author

remh commented Apr 3, 2015

Failing on Apache. Merging.

remh pushed a commit that referenced this pull request Apr 3, 2015
[ElasticSearch] Improve tests and bug fixes
@remh remh merged commit 1317325 into master Apr 3, 2015
@remh remh deleted the remh/elastic branch April 3, 2015 19:38
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.

wrong url in elastic.py can.connect monitor used for version > 0.90.10
2 participants