hoptical / grafana-kafka-datasource

A Grafana datasource plugin for Apache Kafka
Apache License 2.0
37 stars 13 forks source link

Kafka plugin doesn't show data correctly in panel #40

Open Dhyanesh97 opened 2 years ago

Dhyanesh97 commented 2 years ago

Describe the bug We configured comma separated Kafka servers in data source. While exploring data we added topic name, but in panel it doesn't show proper data. Also timestamp value is different. It shows "1754-08-31 04:37:09.129" value in timestamp.

image

Please find Json data below receiving from Kafka server.

{
   "beginTime": "1667562006",
   "counters": {
      "155": {
         "": {
            "VALUE_1": "0",
            "VALUE_2": "0"
            "VALUE_3": "0.000000",
            "VALUE_4": "0",
            "VALUE_5": "0.000000",
            "VALUE_6": "0.000000",
            "VALUE_7": "0.000000",
            "VALUE_8": "0.000000"
         }
      }
   },
   "endTime": "1667562306",
   "granPeriod": "300",
   "timezone": "IST+05:30",
   "R_MAC": "***************",
   "RU_ID": "**",
   "G_NAME": "***************",
   "VNF_ID": "***************-*****",
   "DU__ID": "0",
   "C_ID": "***",
   "G_ID": "****",
   "senderType": "***************",
   "swVersion": "***********",
   "clu_id": "***************",
   "GSwVersion": "***************"
}

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Add data source and configure topic name in server'
  2. Once added, click on 'explore'
  3. Add topic name
  4. As mentioned above, we see the data. Auto offset reset = Latest, partition = 0, timestamp mode = message timestamp

Expected behavior As we receive data at each 5 min of interval, it should show data in panel.

Screenshots image

After changing timestamp mode to now. image

Desktop Information:

Additional context Add any other context about the problem here.

Dhyanesh97 commented 1 year ago

@hoptical Can you check once and give inputs ?

hoptical commented 1 year ago

@Dhyanesh97 Hi. Sorry for the late answer. I will check this out and get back to you soon.

OneCricketeer commented 1 year ago

The readme makes it clear that the plugin does not work with nested JSON records, only flat key-value pairs where values are floats.

https://github.com/hoptical/grafana-kafka-datasource#known-limitations

Dhyanesh97 commented 1 year ago

@OneCricketeer @hoptical Would it possible to add this as feature request ? Would nice to have monitoring/alerting for kafka with Grafana instead of using any alternate way.

OneCricketeer commented 1 year ago

In my opinion, I'd rather use Kafka Connect to write to a JDBC database, Elasticsearch, or Influx, then use those as data sources.

reyemb commented 1 year ago

Thank you for putting this together. I do encounter a similiar problem. My JSON only consists of float values

{'motor_casing_vibration': 2.3857060000000003, 'motor_frequency_a': 49.43576, 'motor_frequency_b': 50.434024810790994, 'motor_frequency_c': 44.53125, 'motor_speed': 616.7824, 'motor_current': 81.80225, 'motor_active_power': 14.098670000000002, 'motor_apparent_power': 15.70457, 'motor_reactive_power': 15.147570000000002, 'motor_shaft_power': 14.539929999999998, 'motor_phase_current_a': 42.885, 'motor_phase_current_b': 48.74005, 'motor_phase_current_c': 34.39921, 'motor_coupling_vibration': 14.46289, 'motor_phase_voltage_ab': 420.4596, 'motor_phase_voltage_bc': 465.5061, 'motor_phase_voltage_ca': 459.461, 'pump_casing_vibration': 2.3857060000000003, 'pump_stage_1_impeller_speed_1': 667.2126, 'pump_stage_1_impeller_speed_2': 399.822, 'pump_stage_1_impeller_speed_3': 886.5435, 'pump_stage_1_impeller_speed_4': 536.0215, 'pump_stage_1_impeller_speed_5': 1092.674, 'pump_stage_1_impeller_speed_6': 672.2041, 'pump_stage_2_impeller_speed_1': 697.3726, 'pump_stage_2_impeller_speed_2': 801.7662, 'pump_stage_2_impeller_speed_3': 843.7883, 'pump_stage_2_impeller_speed_4': 797.8337, 'pump_stage_2_impeller_speed_5': 499.1729, 'pump_stage_2_impeller_speed_6': 662.5, 'pump_stage_2_impeller_speed_7': 794.7916, 'pump_stage_2_impeller_speed_8': 614.0740000000001, 'pump_stage_2_impeller_speed_9': 511.3185, 'pump_inlet_flow': 266.2474, 'pump_discharge_flow': 591.006, 'pump_unknown': 689.3682, 'pump_lube_oil_overhead_reservoir_level': 0.0, 'pump_lube_oil_return_temp': 41.40625, 'pump_lube_oil_supply_temp': 29.16667, 'pump_thrust_bearing_active_temp': 114.5833, 'motor_non_drive_end_radial_bearing_temp_1': 29.94792, 'motor_non_drive_end_radial_bearing_temp_2': 30.989582061767603, 'pump_thrust_bearing_inactive_temp': 53.38541, 'pump_drive_end_radial_bearing_temp_1': 50.63657, 'pump_non_drive_end_radial_bearing_temp_1': 35.30093, 'pump_non_drive_end_radial_bearing_temp_2': 52.08333, 'pump_drive_end_radial_bearing_temp_2': 44.849540000000005, 'pump_inlet_pressure': 172.7431, 'pump_temp_unknown': 66.84028, 'pump_discharge_pressure_1': -1, 'pump_discharge_pressure_2': 195.6019}

But still I get the same Output as Dhyanesh97

If i replace my json with your example everything works smoothly

I use Auto_offset_reset: Latest Timestamp Mode: Now

Andrewnar commented 6 months ago

Same problem here. Its intermittently working for me, with no logging or indication on why. It will periodically go into the panels state while other times it will simply show the same problems as @Dhyanesh97. This is without nested json values.

Andrewnar commented 5 months ago

As a note, after installing the plugin via the grafana-cli I was able to resolve my issue. There may have been indirect problems caused through downloading it through the grafana gui (via the marketplace). Hopefully by changing install method it'd help someone else out!