Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include C3 monitoring interceptors and update packaging validation #464

Merged
merged 3 commits into from Oct 19, 2018

Conversation

rnpridgeon
Copy link
Contributor

No description provided.

@edenhill edenhill changed the title Update packaging validation Include C3 monitoring interceptors and update packaging validation Oct 11, 2018
*
* @returns 0 on success or -1 on failure (exception raised).
*/
static int common_conf_set_special(PyObject *confdict, rd_kafka_conf_t *conf, const char *name, PyObject *vo) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to < 80 columns

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use @param vo The property value object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is because vo's name and type are fairly ambiguous?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

const char *v;
char errstr[256];

PyObject *vs = NULL, *vs8 = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all variable definitions in one consecutive block at the head of the function, that is, move this above the empty line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs does not need NULL initialization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, although is there any harm in initializing it? Here it doesn't matter but in the while loop you will throw uninitialized variable warnings because we jump to inner_error which references them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is documentation. If something is done explicitly the reader thinks there is a reason for it. If there is no reason, we thus shouldn't do it, to avoid confusing the reader.

confluent_kafka/src/confluent_kafka.c Show resolved Hide resolved
PyErr_Format(PyExc_TypeError, "expected configuration property %s "
"as type unicode string here", name);

Py_XDECREF(vs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does nothing, vs is always NULL here

return -1;
}

Py_XDECREF(vs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py_DECREF(), we know vs is non-NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I was thinking consistency might be nice but it unnecessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is also documenting the assumptions of availability, state, etc.
If a variable needs to be checked, then check it.
If we know a variable is always set, don't check it.

*/
if ((vo = PyDict_GetItemString(confdict, "debug"))) {
if (common_conf_set_special(confdict, conf, "debug", vo)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for braces for single line blocks.

suggest you explicitly check for return value == -1, or change set_special to return 0 on error and 1 on success.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope not needed, although arguably it does make it easier to read

/* Enable valid offsets in delivery reports */
rd_kafka_conf_set(conf, "produce.offset.report", "true", NULL, 0);
/*
* Default config (overridable by user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't seem to be true anymore.

/* Resolve plugin paths */
PyObject *resolved;
resolved = resolve_plugins(vo);
if (!resolved) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove braces

confluent_kafka/src/confluent_kafka.c Show resolved Hide resolved
Py_XDECREF(ks8);
Py_XDECREF(ks);

Py_DECREF(confdict);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goto outer_err here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

@rnpridgeon
Copy link
Contributor Author

@edenhill plugged some leaks, fixed some docs. Mind giving it another go

Copy link
Contributor

@edenhill edenhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny miny


/* Enable valid offsets in delivery reports */
rd_kafka_conf_set(conf, "produce.offset.report", "true", NULL, 0);
if ((vo = PyDict_GetItemString(confdict, "debug")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

micro nit: Personally I would wrap the outer block in { }, or turn it into a single if:
if ((vo = .. ) && !common_set_sp..)) \n goto outer_err

}
PyDict_DelItemString(confdict, "default.topic.config");
}

/* Convert config dict to config key-value pairs. */
while (PyDict_Next(confdict, &pos, &ko, &vo)) {
PyObject *ks, *ks8;
PyObject *ks = NULL, *ks8 = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ks does not need initialization

Copy link
Contributor

@edenhill edenhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no tests for the monics using the binary wheels, should be added to test-osx test-manylinux.

.appveyor.yml Outdated
@@ -1,6 +1,6 @@
environment:
global:
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC3
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC4
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC5

.travis.yml Outdated
@@ -1,32 +1,32 @@
matrix:
include:
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC3
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RC4 -> RC5 across the board

.travis.yml Outdated
- if [[ -z $CIBW_BEFORE_BUILD ]]; then py.test -v --timeout 20 --ignore=tmp-build --import-mode append ; fi
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then cibuildwheel --output-dir wheelhouse ; ls -la wheelhouse/ ; fi
# Make plugins available for tests
- ldd staging/libs/* || true ; otool -L staging/libs/* || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ldd staging/libs/* || true ; otool -L staging/libs/* || true
- ldd staging/libs/* || otool -L staging/libs/* || true

f = os.path.join(path, "monitoring-interceptor" + ext)
if os.path.exists(f):
return False
print('Not found: {}'.format(f))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print('Not found: {}'.format(f))

tools/RELEASE.md Outdated

$ git commit -m "librdkafka version bump to v0.11.6" .travis.yml .appveyor.yml
* `tools/install-interceptors.sh`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `tools/install-interceptors.sh`
* `tools/install-interceptors.sh` - edit and change version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just above this we state the following:

"Change to the latest version of the confluent-librdkafka-plugins in:"

To be clear this in addition to this statement not a replacement correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to clarify that the file needs editing rather than being run, since referencing a shell script in backticks usually suggests the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure works for me just wanted to make sure

@@ -34,15 +34,15 @@ pip install confluent_kafka --no-cache-dir --no-index -f $WHEELHOUSE
# https://github.com/pypa/pip/issues/5247
pip install pytest pytest-timeout --ignore-installed six

# Verify that OpenSSL and zlib are properly linked
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tthink we should do cd .. here prior to all the remaining steps

@edenhill edenhill force-pushed the pkg-monic branch 2 times, most recently from 2442325 to 0b2cce3 Compare October 19, 2018 00:27
@RasmusWL
Copy link

I cannot stress how happy I am about this. I know it is an awful practise to make +1 comments on issues, but I really want to show my appreciation to you guys @rnpridgeon and @edenhill 💖 🎉

You have officially made my day! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants