@@ -1672,6 +1672,24 @@ static int common_conf_set_special(PyObject *confdict, rd_kafka_conf_t *conf,
1672
1672
return 1 ;
1673
1673
}
1674
1674
1675
+
1676
+ /**
1677
+ * @brief KIP-511: Set client.software.name and .version which is reported
1678
+ * to the broker.
1679
+ * Errors are ignored here since this is best-effort.
1680
+ */
1681
+ static void common_conf_set_software (rd_kafka_conf_t * conf ) {
1682
+ char version [128 ];
1683
+
1684
+ rd_kafka_conf_set (conf , "client.software.name" ,
1685
+ "confluent-kafka-python" , NULL , 0 );
1686
+
1687
+ snprintf (version , sizeof (version ), "%s-rdkafka-%s" ,
1688
+ CFL_VERSION_STR , rd_kafka_version_str (), NULL , 0 );
1689
+ rd_kafka_conf_set (conf , "client.software.version" , version , NULL , 0 );
1690
+ }
1691
+
1692
+
1675
1693
/**
1676
1694
* Common config setup for Kafka client handles.
1677
1695
*
@@ -1745,6 +1763,10 @@ rd_kafka_conf_t *common_conf_setup (rd_kafka_type_t ktype,
1745
1763
1746
1764
conf = rd_kafka_conf_new ();
1747
1765
1766
+ /* Set software name and verison prior to applying the confdict to
1767
+ * allow even higher-level clients to override it. */
1768
+ common_conf_set_software (conf );
1769
+
1748
1770
/*
1749
1771
* Set debug contexts first to capture all events including plugin loading
1750
1772
*/
@@ -2288,13 +2310,11 @@ static PyObject *libversion (PyObject *self, PyObject *args) {
2288
2310
rd_kafka_version ());
2289
2311
}
2290
2312
2291
- /*
2292
- * Version hex representation
2293
- * 0xMMmmRRPP
2294
- * MM=major, mm=minor, RR=revision, PP=patchlevel (not used)
2313
+ /**
2314
+ * @brief confluent-kafka-python version.
2295
2315
*/
2296
2316
static PyObject * version (PyObject * self , PyObject * args ) {
2297
- return Py_BuildValue ("si" , "1.3.0" , 0x01030000 );
2317
+ return Py_BuildValue ("si" , CFL_VERSION_STR , CFL_VERSION );
2298
2318
}
2299
2319
2300
2320
static PyMethodDef cimpl_methods [] = {
0 commit comments