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

Updated KafkaClient API - version 0.9.0 #1028

Merged
merged 1 commit into from
Jul 14, 2014
Merged

Conversation

lgtml
Copy link
Contributor

@lgtml lgtml commented Jul 10, 2014

Problem - Old kafka-python API

kafka-python updated the latest __init__ api to use comma delimited host string, this breaks the old api which was used in the check; on the bright side it simplifies the checks code.

info dump

    kafka_consumer
    --------------
      - instance #0 [ERROR]: TypeError("object of type 'int' has no len()",)
      - Collected 0 metrics, 0 events & 0 service checks

Stack Trace:

2014-07-10 18:05:38 UTC | INFO | dd.collector | kazoo.client(connection.py:536) | Closing connection to ec2-54-191-60-165.us-west-2.compute.amazonaws.com:2181
2014-07-10 18:05:38 UTC | INFO | dd.collector | kazoo.client(client.py:439) | Zookeeper session lost, state: CLOSED
2014-07-10 18:05:38 UTC | ERROR | dd.collector | checks.kafka_consumer(__init__.py:507) | Check 'kafka_consumer' instance #0 failed
Traceback (most recent call last):
  File "/usr/share/datadog/agent/checks/__init__.py", line 498, in run
    self.check(copy.deepcopy(instance))
  File "/usr/share/datadog/agent/checks.d/kafka_consumer.py", line 71, in check
    # Connect to Kafka
  File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 40, in __init__
    self.load_metadata_for_topics()  # bootstrap with all metadata
  File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 252, in load_metadata_for_topics
    request_id, topics)
  File "/usr/local/lib/python2.7/dist-packages/kafka/protocol.py", line 354, in encode_metadata_request
    KafkaProtocol.METADATA_KEY)
  File "/usr/local/lib/python2.7/dist-packages/kafka/protocol.py", line 49, in _encode_message_header
    return struct.pack('>hhih%ds' % len(client_id),
TypeError: object of type 'int' has no len()

Tests

Note: there we no tests to update so I did not bother writting one

  • Updated local agent, restart and saw the follow under info:
    kafka_consumer
    --------------
      - instance #0 [OK]
      - Collected 8 metrics, 0 events & 0 service checks

Reading Material

kafka-python docs
kafka-python KafkaClient.init
kafka-python collect_hosts

@remh remh added this to the 5.0 milestone Jul 10, 2014
@remh
Copy link
Contributor

remh commented Jul 14, 2014

Thanks a lot! Looks good to me!

remh added a commit that referenced this pull request Jul 14, 2014
Updated KafkaClient API - version 0.9.0
@remh remh merged commit 1b885a3 into DataDog:master Jul 14, 2014
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

2 participants