sonata-nfv / son-gkeeper

SONATA's Service Platform Gatekeeper
http://www.sonata-nfv.eu
Apache License 2.0
2 stars 18 forks source link

Start registering KPIs #447

Closed jbonnet closed 7 years ago

jbonnet commented 7 years ago

Now that we have the KPIs module, we need to start registering data.

jbonnet commented 7 years ago

Hey, @srodriguezOPT I've been reading the examples, and I have some doubts. For example, I want to register the number of packages submitted, some will be ok, others will be rejected because of an error or lack of permission, others will be duplicate, etc.

  1. What should I send in job and instance fields?
  2. What are the base_labels you mention, are they like {'created_at':'...', 'user_uuid':'...', 'status':'ok', ...} (i.e., further data about the event that originated the count)?

Thanks

santiagordguez commented 7 years ago

Hi @jbonnet ,

Let me show you an example of how prometheus will store the counter/gauge:

gk_maxApiCalls(exported_instance="gatekeeper", exported_job="api calls",..., "base_labels": {"api name": "services", "method": "GET"}) gk_maxApiCalls(exported_instance="gatekeeper", exported_job="api calls",..., "base_labels": {"api name": "services", "method": "POST"}) gk_maxApiCalls(exported_instance="gatekeeper", exported_job="api calls",..., "base_labels": {"api name": "services", "method": "PUT"}) gk_maxApiCalls(exported_instance="gatekeeper", exported_job="api calls",..., "base_labels": {"api name": "functions", "method": "GET"})

So, we can use instance and job to identify the origin and type of the KPI. Another example of an existing vim KPI: vim_maxServerGroupMembers{exported_instance="POP_2",exported_job="limits"...

With the base_labels, prometheus will create a counter/gauge with every set of base_labels. In the example: a gk_maxApiCalls gauge/counter with the api GET /services count a gk_maxApiCalls gauge/counter with the api POST /services count ....

We can use the base labels for the service status, the http error code, etc.

jbonnet commented 7 years ago

@srodriguezOPT Can you please add some KPIs registration code.. to the KPIs service? That would be nice playing as examples...

Thanks,

santiagordguez commented 7 years ago

Hi @jbonnet ,

In http://sp.int3.sonata-nfv.eu:9091/ you can check the counter/gauges created in the pushgateway.

For example, the job="sonata", instance="gtkkpi" both examples (example_gauge and example_counter) were created with the https://github.com/sonata-nfv/son-tests/tree/master/int-gtkkpi-prometheus tests; In test1.sh and test2.sh, you can check that the REST invocations are like

curl -H 'Content-Type: application/json' -X PUT -d '{ "metric_type": "counter", "job": "sonata", "instance": "gtkkpi", "name": "example_counter", "docstring": "metric counter test", "base_labels": {"label1": "value1", "label2": "value2"}}' http://sp.int3.sonata-nfv.eu:32001/api/v2/kpis)

jbonnet commented 7 years ago

Super! Thanks, consider it done! :-)

On 21 Mar 2017, at 16:55, Santiago Rodríguez notifications@github.com wrote:

Hi @jbonnet https://github.com/jbonnet ,

In http://sp.int3.sonata-nfv.eu:9091/ http://sp.int3.sonata-nfv.eu:9091/ you can check the counter/gauges created in the pushgateway.

For example, the job="sonata", instance="gtkkpi" both examples (example_gauge and example_counter) were created with the https://github.com/sonata-nfv/son-tests/tree/master/int-gtkkpi-prometheus https://github.com/sonata-nfv/son-tests/tree/master/int-gtkkpi-prometheus tests; In test1.sh and test2.sh, you can check that the REST invocations are like

curl -H 'Content-Type: application/json' -X PUT -d '{ "metric_type": "counter", "job": "sonata", "instance": "gtkkpi", "name": "example_counter", "docstring": "metric counter test", "base_labels": {"label1": "value1", "label2": "value2"}}' http://sp.int3.sonata-nfv.eu:32001/api/v2/kpis http://sp.int3.sonata-nfv.eu:32001/api/v2/kpis)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sonata-nfv/son-gkeeper/issues/447#issuecomment-288144624, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAuQ2hSUl97EP3gTor2vv9ffbd-jmsWks5roAEJgaJpZM4MP1_K.

jbonnet commented 7 years ago

Closed by #461