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

Set zbctl user agent #9434

Merged
merged 2 commits into from
May 31, 2022
Merged

Set zbctl user agent #9434

merged 2 commits into from
May 31, 2022

Conversation

Zelldon
Copy link
Member

@Zelldon Zelldon commented May 20, 2022

Description

In order to distinguish between go-client and zbctl this PR adds a new possibility to set the UserAgent as client config.
Zbctl use that config and set its own user-agent header.

This is useful to understand which client types and versions are mostly used. See slack https://camunda.slack.com/archives/CHBFBRFM2/p1652420371478469?thread_ts=1651237779.179459&cid=CHBFBRFM2

Related issues

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

Please refer to our review guidelines.

In order to distinguish between go-client and zbctl add a new possibility to set the UserAgent as client config.
Zbctl use that config and set their own user agent header.

This is useful to understand which client types and versions are mostly used.
@Zelldon Zelldon marked this pull request as ready for review May 20, 2022 15:03
@@ -164,6 +166,61 @@ func (s *clientTestSuite) TestGatewayAddressEnvVar() {
s.EqualValues(fmt.Sprintf("0.0.0.0:%s", parts[len(parts)-1]), config.GatewayAddress)
}

func (s *clientTestSuite) TestDefaultUserAgent() {
// given
var incomingContext = make(map[string][]string)
Copy link
Member Author

Choose a reason for hiding this comment

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

❓ Found no better way to verify it. Happy to hear your thoughts

Copy link
Member

Choose a reason for hiding this comment

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

Other than moving createServerWithUnaryInterceptor to some sort of test utility file there's nothing I can think of improving here. We want to test that whoever serves go client requests receives a user-agent header and that that header includes the name and versions so this test looks spot on 👍

Copy link
Member Author

@Zelldon Zelldon left a comment

Choose a reason for hiding this comment

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

Would be interesting @menski whether you think we should backport this so we have the data also in earlier versions.

@Zelldon
Copy link
Member Author

Zelldon commented May 20, 2022

Note: @oleschoenburg the output of https://github.com/camunda/zeebe/runs/6527128287?check_suite_focus=true is not really useful :D do we have this on the radar?

Update: I was not aware that I can see the notes in the diff 👍

Copy link
Member

@lenaschoenburg lenaschoenburg left a comment

Choose a reason for hiding this comment

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

Thanks @Zelldon, took me a while to figure out where the version is coming from but I got it now. LGTM :shipit:

@@ -164,6 +166,61 @@ func (s *clientTestSuite) TestGatewayAddressEnvVar() {
s.EqualValues(fmt.Sprintf("0.0.0.0:%s", parts[len(parts)-1]), config.GatewayAddress)
}

func (s *clientTestSuite) TestDefaultUserAgent() {
// given
var incomingContext = make(map[string][]string)
Copy link
Member

Choose a reason for hiding this comment

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

Other than moving createServerWithUnaryInterceptor to some sort of test utility file there's nothing I can think of improving here. We want to test that whoever serves go client requests receives a user-agent header and that that header includes the name and versions so this test looks spot on 👍

@Zelldon
Copy link
Member Author

Zelldon commented May 31, 2022

bors r+

@zeebe-bors-camunda
Copy link
Contributor

@zeebe-bors-camunda zeebe-bors-camunda bot merged commit 57dca6a into main May 31, 2022
@zeebe-bors-camunda zeebe-bors-camunda bot deleted the zell-zbctl-user-agent branch May 31, 2022 12:12
@backport-action
Copy link
Collaborator

Successfully created backport PR #9467 for stable/1.3.

@backport-action
Copy link
Collaborator

Successfully created backport PR #9468 for stable/8.0.

zeebe-bors-camunda bot added a commit that referenced this pull request May 31, 2022
9468: [Backport stable/8.0] Set zbctl user agent r=Zelldon a=backport-action

# Description
Backport of #9434 to `stable/8.0`.

relates to 

Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
zeebe-bors-camunda bot added a commit that referenced this pull request May 31, 2022
9468: [Backport stable/8.0] Set zbctl user agent r=Zelldon a=backport-action

# Description
Backport of #9434 to `stable/8.0`.

relates to 

Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
zeebe-bors-camunda bot added a commit that referenced this pull request May 31, 2022
9467: [Backport stable/1.3] Set zbctl user agent r=oleschoenburg a=backport-action

# Description
Backport of #9434 to `stable/1.3`.

relates to 

Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants