<commit_before># Configuration

## Agent Communication

The sensor tries to communicate with the Instana agent via IP 127.0.0.1 and as a fallback via the host's default gateway for containerized environments. Should the agent not be available under either of these IPs, e.g. due to iptables or other networking tricks, you can use environment variables to configure where the Instana host agent lives.

To use these, these environment variables should be set in the environment of the running Python process.

```shell
export INSTANA_AGENT_HOST = '127.0.0.1'
export INSTANA_AGENT_PORT = '42699'
```

## Setting the Service Name

If you'd like to assign a single service name for the entire application you can do so by setting an environment variable or via code:

```
export INSTANA_SERVICE_NAME=myservice
```

or

```Python
instana.service_name = "myservice"
```

## Debugging & More Verbosity

Setting `INSTANA_DEV` to a non nil value will enable extra logging output generally useful
for development.

```Python
export INSTANA_DEV="true"
```

## Disabling Automatic instrumentation

You can disable automatic instrumentation (tracing) by setting the environment variable `INSTANA_DISABLE_AUTO_INSTR`.  This will suppress the loading of instrumentation built-into the sensor.<commit_msg>Add OpenShift note on exposing the host IP (#80)<commit_after># Configuration

## Agent Communication

The sensor tries to communicate with the Instana agent via IP 127.0.0.1 and as a fallback via the host's default gateway for containerized environments. Should the agent not be available under either of these IPs, e.g. due to iptables or other networking tricks, you can use environment variables to configure where the Instana host agent lives.

To use these, these environment variables should be set in the environment of the running Python process.

```shell
export INSTANA_AGENT_HOST = '127.0.0.1'
export INSTANA_AGENT_PORT = '42699'
```

## Setting the Service Name

If you'd like to assign a single service name for the entire application you can do so by setting an environment variable or via code:

```
export INSTANA_SERVICE_NAME=myservice
```

or

```Python
instana.service_name = "myservice"
```

## Debugging & More Verbosity

Setting `INSTANA_DEV` to a non nil value will enable extra logging output generally useful
for development.

```Python
export INSTANA_DEV="true"
```

## Disabling Automatic instrumentation

You can disable automatic instrumentation (tracing) by setting the environment variable `INSTANA_DISABLE_AUTO_INSTR`.  This will suppress the loading of instrumentation built-into the sensor.

## OpenShift

In certain scenarios, the Python sensor can't automatically locate the Instana host agent.  To resolve this, add the following to your Python app deployment descriptor:

```
- name: INSTANA_AGENT_HOST
valueFrom:
  fieldRef:
    fieldPath: status.hostIP
```

This will set the environment variable INSTANA_AGENT_HOST with the IP of the host so the Python sensor can properly locate the Host agent.

{'fraction_non_alphanumeric': 0.059114927344782034, 'fraction_numerical': 0.011889035667107, 'mean_word_length': 5.03386454183267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5783429', 'n_tokens_mistral': 849, 'n_tokens_neox': 781, 'n_words': 394}