Added ES SimpleClient support for bosun backend and annotation. #1947
Conversation
Test is failing due to missing annotation backend changes bosun-monitor/annotate#6 are not in place. |
36867f8
to
caddacf
@captncraig after vendor update getting git conflicts |
Oh crap. Yeah, that sucks. Try |
c1e678e
to
ca37c05
@captncraig I tired everything to get get rid of vendor/vendor.json conflict ..am able to merge it in my local repo but it's still failing here. I will retry tom, mean while if you have some free time have look at my version and let me know if you find anything suspicious. |
Here's what I'd recommend.
Sorry, I know this can be real painful. |
00143f3
to
415bbb9
@captncraig finally am able to fix the vendor.json conflict issue by replacing the 'revision' hash and 'revisionTime' from origin/master not sure it was the right thing to do? During the merging process I have noticed go format issue in backend/backend.go, pls have look at bosun-monitor/annotate#7 |
Here is what I do when working on annotate and vendoring it:
I think maybe because gorilla stuff things need to be added in a certain On Tue, Oct 25, 2016 at 5:53 AM, Pradeep Mishra notifications@github.com
|
this is dependent on bosun-monitor/annotate#7 |
force updated |
be71172
to
11263d2
@kylebrandt done with code merge for multi elastic backend support :), do let me know if you find any issue or require any further changes. Thanks, |
Need to look at the code, but I think it might be better to assign which backend to use to the Context object attached to each template. That way we don't have to change the arguments to the function. This may not matter so much for the elastic functions, but when we want to add the functionality to more tsdb providers than they won't have to change either. Since templates are procedural, this should work. You would just do something like `{{ .ES = "mySecondary"}}. Or it could be a method on the context like {{ .UseElastic "mySecondary" }} |
@kylebrandt if we move the variable out from functions to context object expression checks using /expr page are failing with empty prefix key e.g escount($index, $keyField, $filter, $bucketSize, "3h", ""), are you okay to refernece the context obj in expr.go |
@pradeepbbl I don't understand why it would need to access the context object in the expr package? Can't you just call the functions passing the key from the context instead of an argument to the function?
and then something like:
|
Also, could it be make so the text inside |
rebase with 'upstream/master' |
7445cf5
to
c7b6781
@kylebrandt done with the merging and changes discussed above. Please have a look and let me know if anything need to be changed. Test's Done:
Thanks, |
@@ -41,6 +44,7 @@ func (s *Schedule) Data(rh *RunHistory, st *models.IncidentState, a *conf.Alert, | |||
IsEmail: isEmail, | |||
schedule: s, | |||
runHistory: rh, | |||
ElasticHost: es, |
kylebrandt
Apr 18, 2017
Member
I think we can get rid of the global var here. Initalize it to the string "default" like in https://github.com/bosun-monitor/bosun/pull/1947/files#diff-d6bd3827d8c8d679e462f07cef34f092R755. The for UseElastic have it set c.ElasticHost (and doesn't need to return anything). Since UseElastic is a method on a pointer it will change the context object.
I think we can get rid of the global var here. Initalize it to the string "default" like in https://github.com/bosun-monitor/bosun/pull/1947/files#diff-d6bd3827d8c8d679e462f07cef34f092R755. The for UseElastic have it set c.ElasticHost (and doesn't need to return anything). Since UseElastic is a method on a pointer it will change the context object.
pradeepbbl
Apr 18, 2017
•
Author
Contributor
Sure, I have added it for debug purpose. I will make the change as suggested.
I would also like your suggestion on logging ES host map https://github.com/bosun-monitor/bosun/pull/1947/files#diff-2039e8e0c0f4873ec699c321c1e336f9R261, are you okay with it?
Sure, I have added it for debug purpose. I will make the change as suggested.
I would also like your suggestion on logging ES host map https://github.com/bosun-monitor/bosun/pull/1947/files#diff-2039e8e0c0f4873ec699c321c1e336f9R261, are you okay with it?
} | ||
var err error | ||
if e.PrefixKey != "" { | ||
slog.Infof("es prefix key found connecting to host: %s", e.Hosts[e.PrefixKey]) |
kylebrandt
Apr 18, 2017
Member
this should be removed since it logs whenever the expressions are executed so it will be spammy.
this should be removed since it logs whenever the expressions are executed so it will be spammy.
slog.Infof("es prefix key found connecting to host: %s", e.Hosts[e.PrefixKey]) | ||
} else { | ||
e.PrefixKey = "default" | ||
slog.Infof("es prefix key missing set it to default") |
kylebrandt
Apr 18, 2017
Member
and remove this one as well.
and remove this one as well.
Oh and documentation. Need to update docs/expression.md to explain the elastic prefix , docs/system_configuration.md with the changes to ES configuration, and definitions.md with the new template func. |
8574445
to
c3e3c80
done with the documentation :) |
https://github.com/bosun-monitor/bosun/tree/prefixIdea illustrates what I think might be a better way to pass the prefix. Diff:
From Slack private chat:
|
couple more changes at https://github.com/bosun-monitor/bosun/tree/mesFixes I need to make sure simple client works with these changes though and test a couple other things. Ironically, one of my ES clusters is down right now.. :-/ Should be fixed in an hour or so
|
1f4d85e
into
bosun-monitor:master
This change will allow to create a light weight elastic search client which is suitable for elasticsearch standalone server.