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

Amend issue when getting agent host and port #230

Merged
merged 5 commits into from
Mar 30, 2023

Conversation

estringana
Copy link
Collaborator

Description

Add defaults to agent host and port. It also parsed DD_TRACE_AGENT_URL

Motivation

Additional Notes

Describe how to test your changes

Readiness checklist

  • Unit tests have been updated and pass
  • If known, an appropriate milestone has been selected
  • All new source files include the required notice

Release checklist

  • The CHANGELOG.md has been updated

@estringana estringana force-pushed the estringana/amend-agent-host-port-issue branch from 0e1611c to d640a14 Compare March 30, 2023 07:32
dd_mpack_write_lstr(w, "port");
mpack_write_uint(w, get_DD_TRACE_AGENT_PORT());
mpack_write_uint(w, port);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could probably split all of this new code into its own separate function, just for simplicity.

if (agent_host && ZSTR_LEN(agent_host) > 0) {
host = ZSTR_VAL(agent_host);
} else if (agent_url && ZSTR_LEN(agent_url) > 0) {
php_url *parsed_url = php_url_parse(ZSTR_VAL(agent_url));
Copy link
Collaborator

Choose a reason for hiding this comment

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

php_url needs to be freed after with php_url_free.

@estringana estringana force-pushed the estringana/amend-agent-host-port-issue branch from 9132263 to 7341678 Compare March 30, 2023 11:12
@estringana estringana force-pushed the estringana/amend-agent-host-port-issue branch from 7341678 to eef3de2 Compare March 30, 2023 11:35
@codecov-commenter
Copy link

Codecov Report

Merging #230 (bc08c58) into master (274e64f) will increase coverage by 7.44%.
The diff coverage is 86.20%.

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
+ Coverage   64.10%   71.55%   +7.44%     
==========================================
  Files          88       25      -63     
  Lines        5606     3290    -2316     
  Branches     1776      738    -1038     
==========================================
- Hits         3594     2354    -1240     
+ Misses        948      552     -396     
+ Partials     1064      384     -680     
Flag Coverage Δ
extension 71.55% <86.20%> (+0.10%) ⬆️
helper ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/extension/configuration.h 100.00% <ø> (ø)
src/extension/commands/client_init.c 85.24% <86.20%> (-0.18%) ⬇️

... and 63 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@estringana estringana marked this pull request as ready for review March 30, 2023 14:34
@@ -19,6 +20,9 @@
#include "mpack-node.h"
#include "mpack-writer.h"

static const unsigned int DEFAULT_AGENT_PORT = 8126;
static const unsigned int MAX_TCP_PORT_ALLOWED = 65535;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use UINT16_MAX instead since this is a well known limit.

}
}

void extract_url(url *out)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you misunderstood, I meant that you should just parse and add to msgpack here not to recreate everything with custom types. For example, something like this:

static void _pack_path_params(

@@ -19,6 +20,9 @@
#include "mpack-node.h"
#include "mpack-writer.h"

static const unsigned int DEFAULT_AGENT_PORT = 8126;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about DEFAULT_AGENT_HOST?

@estringana estringana force-pushed the estringana/amend-agent-host-port-issue branch from d40cf95 to 9de5ddc Compare March 30, 2023 15:01
Copy link
Collaborator

@Anilm3 Anilm3 left a comment

Choose a reason for hiding this comment

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

lgtm

@estringana estringana merged commit 97bba78 into master Mar 30, 2023
28 checks passed
@estringana estringana deleted the estringana/amend-agent-host-port-issue branch March 30, 2023 15:42
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