Coder Social home page Coder Social logo

vinicius-ianni / sarama Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elastic/sarama

0.0 0.0 0.0 8.95 MB

Sarama is a Go library for Apache Kafka 0.8, and up.

Home Page: https://shopify.github.io/sarama

License: MIT License

Makefile 0.07% Go 99.83% Shell 0.11%

sarama's Introduction

Sarama fork for Beats

This repository holds the version of Sarama shipped with Beats, which sometimes includes bug fixes that have not yet reached an official Sarama release. The Beats package links against the beats-fork branch.

Current state

The current baseline Sarama version is v1.27.2.

The additional patches applied to this version are:

Updating this repository

Adding a new fix

If a new fix needs to be applied, open a pull request against the beats-fork branch of this repository. The fix should go through standard code review and should include an update to the "Current state" section of the README.md, linking to details of the change.

Syncing with a more recent upstream

This fork does not always sync against the latest Sarama release. However, the intent is to stay as close to the current release as makes sense based on known issues and testing constraints.

Updates should always target an explicit release tag. To perform the update, first create your own fork of sarama with the "Fork" icon at the top right, then run the following from the command line:

# Clone the repository locally, pointing at your own fork
git clone [email protected]:[YOUR USERNAME]/sarama.git

# Add links back to the Elastic and Shopify repositories so
# we can merge between them, and run git fetch so we can
# access the version tags.
git remote add upstream [email protected]:elastic/sarama.git
git remote add shopify [email protected]:Shopify/sarama.git
git fetch --all

# Check out the current Elastic fork and use it as a baseline
# for a new local branch called "version-upgrade"
git checkout upstream/beats-fork
git checkout -b version-upgrade

# Merge the target version into your new branch (replace
# the version tag as appropriate).
# If the new version conflicts with the outstanding bug
# fixes, you will need to resolve those conflicts in this
# step.
git merge v1.26.4

# Push the update back to your fork on github.
git push --set-upstream origin version-upgrade

After this, open a regular pull request as in the previous section, remembering to update README.md to reflect the new baseline version.

Updating the Beats repository

After a new fix or update, the Beats repository needs to be updated to point to the new version. You should almost always target the most recent commit in the commits list for the beats-fork branch unless that would disrupt an impending release. Copy the commit hash (with the copy icon or by clicking through to the commit itself), then from a local branch of the Beats repository:

go mod edit -replace github.com/Shopify/sarama=github.com/elastic/sarama@[commit hash]
make notice

(When backporting to 7.8 or earlier you will also need to run mage vendor and then rerun make notice in the backport branch.)

You can then commit the results and submit a PR against the Beats repository, remembering to backport if appropriate. Pull requests MUST include the commit summary they target in their description, e.g.:

"This PR updates Sarama to the current Elastic fork, targeting the commit:

commit 123456789abcdefdf68d97cd255ebc039d36e88c (HEAD -> beats-fork, upstream/beats-fork)
Author: Someone <[email protected]>
Date:   Wed Jun 10 16:19:46 2020 -0400

    Apply some sort of fix

"

(This information is technically redundant, but makes it much easier for code reviewers to confirm that the right version is being applied.) See this example PR.

What Sarama version is Beats linked to?

In any Beats branch, you can find the baseline Sarama version and any additional patches by checking the commit hash in the module configuration:

> grep Shopify/sarama go.mod

        github.com/Shopify/sarama v0.0.0-00010101000000-000000000000
        github.com/Shopify/sarama => github.com/elastic/sarama v1.19.1-0.20200625133446-b4d980d71f60

Important: the tag prefix on the Sarama fork, "v1.19.1" in this case, comes from internal interaction between git and go modules, and has no human-discernible connection to the deployed version!

To get the real answer, copy the hash at the end of the line (b4d980d71f60 in this example), and check the repository status at that hash by opening https://github.com/elastic/sarama/tree/[hash]. The README.md at the bottom of that page will list the base version and patches that were in effect in its "Current state" section.

If there is no second line when you check go.mod, then the fork is not in use, and the current Sarama version is whatever is referenced by the tag at the end of the Sarama line.

Turning the fork on / off in Beats

When a mainline Sarama release includes all fixes we need, we should generally prefer to link directly to it instead of using the fork. To do this:

  • Submit a PR against the beats-fork branch, updating it to the new target version and reverting any remaining custom patches (see the instructions above). This is to make sure the fork is left in a clean state if it needs to be turned on again in the future.
  • In the Beats repository:
    • select the new Sarama version with:

      go get github.com/Shopify/[email protected]    [replace tag with the real target version]
      
    • Edit go.mod manually to remove the line github.com/Shopify/sarama => github.com/elastic/sarama...

    • Reload the linked version by running mage vendor and mage update

    • Commit the results and submit the resulting PR

Once this is done, the fork can be reenabled at any time by following instructions in the previous sections to update the fork and reference it from Beats.

Original README.md follows:

sarama

GoDoc Build Status Coverage

Sarama is an MIT-licensed Go client library for Apache Kafka version 0.8 (and later).

Getting started

  • API documentation and examples are available via godoc.
  • Mocks for testing are available in the mocks subpackage.
  • The examples directory contains more elaborate example applications.
  • The tools directory contains command line tools that can be useful for testing, diagnostics, and instrumentation.

You might also want to look at the Frequently Asked Questions.

Compatibility and API stability

Sarama provides a "2 releases + 2 months" compatibility guarantee: we support the two latest stable releases of Kafka and Go, and we provide a two month grace period for older releases. This means we currently officially support Go 1.13 through 1.14, and Kafka 2.4 through 2.6, although older releases are still likely to work.

Sarama follows semantic versioning and provides API stability via the gopkg.in service. You can import a version with a guaranteed stable API via http://gopkg.in/Shopify/sarama.v1. A changelog is available here.

Contributing

sarama's People

Contributors

eapache avatar wvanbergen avatar bai avatar burke avatar d1egoaz avatar dnwe avatar vlad-arista avatar horkhe avatar mk6i avatar dim avatar francoispoinsot avatar slaunay avatar thesalmontapes avatar faec avatar bobrik avatar aaronkavlie-wf avatar skidder avatar mimaison avatar kjtsanaktsidis avatar weeco avatar alrs avatar d6o avatar agapoff avatar mongey avatar stanislavkozlovski avatar uovobw avatar varun06 avatar dieterbe avatar antsbean avatar rtreffer-sc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.