RuntimeTools / appmetrics-elk

A connector that collects data using 'appmetrics' and sends it to ElasticSearch for use with Kibana
Apache License 2.0
29 stars 12 forks source link

Custom mappings and events #7

Closed tobalsgithub closed 8 years ago

tobalsgithub commented 8 years ago

Not sure if this question belongs here or not. Redirect me if I'm out of place.

Have you considered allowing custom mappings and custom events? I really like the way this project is modularized, and the way the mappings are tied to the events. Moreover, I can imagine custom application metrics that I would want to capture in a similar way. Have you thought about ways for people to create their own mappings that would act as listeners for custom events?

Considering that this project is tied very closely to the appmetrics project, I could imagine that the custom event itself might need to be something made available in appmetrics, whereas the mappings piece for elasticsearch should go here.

But when playing with this a bit, the actual generation of the custom event is so trivial that it almost doesn't need to be enabled at all.

That just leaves the mappings piece in this repo.

Let me know what you think. It'd be relatively easy to put something together outside this project if you think custom mappings/events is not the direction this project should go.

seabaylea commented 8 years ago

The design of the ELK connector is such that to enable a new event type - whether that's custom or for a newer level of 'appmetrics' that isn't yet supported, all you should need to do is drop a new mappings file into the mappings directory before you start the application.

This should automatically cause the 'appmetrics-elk' connect to subscribe to the new event, and publish the data Elasticsearch. This is implemented in the registerCallback function in appmetrics-elk.js.

Having said that, there's probably better ways of adding in custom events, and there's also probably value in adding an API route as well as using the 'mappings' directory for "drop-ins".

tobalsgithub commented 8 years ago

Thinking an api would be best. From looking at it, it seems like the only thing that would need to happen is for registerCallback to be made public. Then, a JSON object could be passed in that represents the mapping. Could we just stick registerCallback on the appmetrics object that's returned when calling appmetrics.monitor()?

Using the mappings directory can work too, but it's a little weird to have to add something to a node_modules directory on deploy or during development.