moira-alert / moira

Realtime Alerting for Graphite and Prometheus
MIT License
300 stars 69 forks source link

Fake API refactoring #304

Open sashasushko opened 5 years ago

sashasushko commented 5 years ago

For easy development we use fake API server (look fakeapi folder). But we keep all data in one big db.json file. It's not comfortable. json-server tool allow generate data on the go by JavaScript (look Generate random data).

ToDo

Warn! We don't have any tests yet, so to check that the backward compatibility is not broken, you will have to check everything by your hands. If you find it easier, you can instead write unit tests for MoiraApi.js. There is Jest in project. Installed and configured.


Please, look at two our major rules for contributors.

Vivekrajput20 commented 5 years ago

I want to work on it.

sashasushko commented 5 years ago

@Vivekrajput20 please give chance to others :-) But if someone will not take it in few days, of course, you can

shiv6146 commented 5 years ago

@sashasushko Can I take this up?

sashasushko commented 5 years ago

@shiv6146 yep, you can try ;-)

sashasushko commented 5 years ago

@shiv6146 how you'r going?

alekhyaNynala commented 5 years ago

@sashasushko May I take up this task? I think it has already been many days. I am very much interested to work on it

alekhyaNynala commented 5 years ago

I want even take up the related issues i.e #287 and #286

alekhyaNynala commented 5 years ago

Thank you

sashasushko commented 5 years ago

@alekhyaNynala Hi. Let's do one by one. Start with this #304

alekhyaNynala commented 5 years ago

@sashasushko Ok I'll work on this one. Thank you.

sashasushko commented 5 years ago

@alekhyaNynala thank you, not me :-)

hv7214 commented 4 years ago

@sashasushko just want some clarifications before i start working on this issue. Can values be any random string or it should have some optimal substructure ? Like trigger/targets can be any value or something like this aliasByNode(Egais.Api.Front.Controllers.Time.*.*.*.*.p95,5, 7, 8).

kunaltawatia commented 4 years ago

@sashasushko just want some clarifications before i start working on this issue. Can values be any random string or it should have some optimal substructure ? Like trigger/targets can be any value or something like this aliasByNode(Egais.Api.Front.Controllers.Time.*.*.*.*.p95,5, 7, 8).

Hi @hv7214, I guess all values, which are to be randomised, belong to any type described in Domain folder, where their own types are mentioned. For example Trigger/targets have a type of Array<string> mentioned in Domain/Trigger.js file. So it might have an array of random strings. But still some conflicts might come for example config.contacts.validation expects a regex with type string.

kunaltawatia commented 4 years ago

@sashasushko I think I could do this enhancement. Is this still available for assignment?

hv7214 commented 4 years ago

@sashasushko just want some clarifications before i start working on this issue. Can values be any random string or it should have some optimal substructure ? Like trigger/targets can be any value or something like this aliasByNode(Egais.Api.Front.Controllers.Time.*.*.*.*.p95,5, 7, 8).

Hi @hv7214, I guess all values, which are to be randomised, belong to any type described in Domain folder, where their own types are mentioned. For example Trigger/targets have a type of Array<string> mentioned in Domain/Trigger.js file. So it might have an array of random strings.

@kunaltawatia i know that it has to be string, that's why asked for clarification regarding the structure. Any random string doesn't make much sense. I think you should have a look in db.json.

kunaltawatia commented 4 years ago

@kunaltawatia i know that it has to be string, that's why asked for clarification regarding the structure. Any random string doesn't make much sense. I think you should have a look in db.json.

Oh I might have got your question wrong.

sashasushko commented 4 years ago

@kunaltawatia is right. The type must be correct. It's "first of all". But @hv7214 your opinion about consistency of mock data also is correct.

I'm not familiar with target syntax, you can dig itself (there is some page in documentation) or ask backend developers. For example, @beevee