Skip to content

Commit b4d831d

Browse files
committed
add CLI parameter support with backward compatibility in client.py
1 parent 7d00efd commit b4d831d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/examples/auto-instrumentation/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
1516

1617
from requests import get
1718

@@ -30,13 +31,15 @@
3031
BatchSpanProcessor(ConsoleSpanExporter())
3132
)
3233

34+
param_value = sys.argv[1] if len(sys.argv) > 1 else "testing"
35+
3336
with tracer.start_as_current_span("client"):
3437
with tracer.start_as_current_span("client-server"):
3538
headers = {}
3639
inject(headers)
3740
requested = get(
3841
"http://localhost:8082/server_request",
39-
params={"param": "testing"},
42+
params={"param": param_value},
4043
headers=headers,
4144
)
4245

0 commit comments

Comments
 (0)