Skip to content

fix: make client.py runnable without CLI arguments #4694

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/examples/auto-instrumentation/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from sys import argv
import sys

from requests import get

Expand All @@ -31,16 +31,16 @@
BatchSpanProcessor(ConsoleSpanExporter())
)


assert len(argv) == 2
# Get parameter from command line argument or use default value "testing"
param_value = sys.argv[1] if len(sys.argv) > 1 else "testing"

with tracer.start_as_current_span("client"):
with tracer.start_as_current_span("client-server"):
headers = {}
inject(headers)
requested = get(
"http://localhost:8082/server_request",
params={"param": argv[1]},
params={"param": param_value},
headers=headers,
)

Expand Down
Loading