-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Oracle db input plugin #8568
Oracle db input plugin #8568
Conversation
Besides being just OracleDB focused, can you state the discrepancies between your PR and the GenericSQL Plugin PR #2785? |
Sure. It gathers database metadata and place it in tags automatically, so it makes configuration less verbose and error prone, also metadata contains more data(because it OracleDB focused) compared to GenericSQL. It supports per-query execution timeout, which can be helpful if some query starts being slow and takes all plugin interval time. From monitoring and alerting side it much more easy to investigate, when only one or two metrics lost instead of loosing all data and trying to understand why so many alerts rang. And, as I can see in GenericSQL's code, it doesn't consider that Oracle can provide NUMBER data type, which is internally varchar and can store numbers which not fit in 2^64. In Go such values would have string type. There is not much we can do if we get too large numbers, of course, but I tried to save as much precision as possible by parsing string and using float64, int64 and uint64 types. GenericSQL, if I looked properly, would store such values as strings and they may be impossible to use with some outputs which doesn't accept fields with string values like opentsdb. Or to use them in math expressions. I hadn't enough time to test it or to look into the code more attentively, so I may be incorrect - please, point me to it. |
As far as I can see there is some cross compilation issue with 386 arch because of CGO. Is there any way to fix it? |
If this plugin is only returning metrics coming from SQL queries, I would prefer to improve GenericSQL instead. The Oracle plugin can be kept if this one also produces specific info of the Oracle DB, similar as the MySQL and PostgreSQL plugins. |
Plugin generates metrics using sql queries only, but it also gathers some Oracle-specific runtime metadata to populate tags. It also has some Oracle-specific type conversion and use specific driver types. Unfortunately, I don't see a way how all of it can be added to existing GenericSQL logic. |
The team will have a look on it and we will come back to you. Our preference is still towards the GenericSQL input plugin. |
A very interesting plugin. Many Oracle users would love it, including me. I was happy to see some news here after years of discussions. +1 to add it to telegraf. |
Hey guys, sorry for being late to the party... @unflag I do understand that you use certain Oracle-specific data. The whole problem with Oracle go-clients is that they all require CGO. You are using
While Go 1.13 is not a problem, the CGO requirement is a problem! Telegraf will not have CGO enabled AFAIK! This also hinders the GenericSQL plugin to support OracleDBs. :-( One way to circumvent that issue might be to add this as external plugin. @ssoroka would this be possible, an external plugin with CGO enabled? |
building as an external plugin with CGO is possible using inputs.execd. Unless we can find a native Go version of the driver, I think the external execd plugin is probably the best route. Let me know if you have any questions or the status of non-cgo drivers changes |
This plugin runs queries on Oracle DB and creates metrics from received data. It has abilities to control which columns would be tags/fields, to switch schema and to set query execution timeout. Logging is handy and can be really helpful when multiple plugin instances run on different databases and executes a lot of queries. It uses godror driver, so free Oracle Client libraries are required at run time. Tests could be run without it, because they use go-sqlmock package. I already use it several month in production and now hope it ready to be helpful to someone else.
Also closes #831
Required for all PRs: