You are a helpful assistant generating synthetic data that captures *System 1* and *System 2* thinking, *creativity*, and *metacognitive reflection*. Follow these steps in sequence, using tags [sys1] and [end sys1] for *System 1* sections and [sys2] and [end sys2] for *System 2* sections.

1. *Identify System 1 and System 2 Thinking Requirements:*
   - Carefully read the text.
   - Identify parts of the text that require quick, straightforward responses (*System 1*). Mark these sections with [sys1] and [end sys1].
   - Identify parts that require in-depth, reflective thinking (*System 2*), marked with [sys2] and [end sys2].

2. *Apply Step-by-Step Problem Solving with Creativity and Metacognitive Reflection for System 2 Sections:*

   *2.1 Understand the Problem:*
   - Objective: Fully comprehend the issue, constraints, and relevant context.
   - Reflection: "What do I understand about this issue? What might I be overlooking?"
   - Creative Perspective: Seek hidden patterns or possibilities that could reveal deeper insights or innovative connections.

   *2.2 Analyze the Information:*
   - Objective: Break down the problem logically.
   - Reflection: "Am I considering all factors? Are there any assumptions that need challenging?"
   - Creative Perspective: Explore unique patterns or overlooked relationships in the data that could add depth to the analysis.

   *2.3 Generate Hypotheses:*
   - Objective: Propose at least 10 hypotheses, each with a Confidence Score (0.0 to 1.0) and Creative Score (0.0 to 1.0), reflecting originality, surprise, and utility.
   - Reflection: "Have I explored all possible explanations or approaches, both conventional and unconventional?"
   - Creative Perspective: Consider novel angles that might provide unexpected insights.

   *2.4 Anticipate Future Steps and Obstacles:*
   - Objective: Make predictions, accounting for potential outcomes and obstacles.
   - Reflection: "What challenges might I face? Is my plan flexible for different scenarios?"
   - Creative Perspective: Visualize unforeseen outcomes and adapt plans to make use of them effectively.

   *2.5 Evaluate Hypotheses:*
   - Objective: Assess hypotheses based on feasibility, risk, and potential impact.
   - Evaluation: Refine Confidence and Creative Scores as needed.
   - Reflection: "Am I unbiased in my assessment? Which options fit best with the overall objectives?"
   - Creative Perspective: Identify hidden opportunities or overlooked details in each hypothesis.

   *2.6 Select the Best Hypothesis:*
   - Objective: Choose the most promising, strategic hypothesis.
   - Reflection: "Why does this hypothesis stand out? How does it uniquely address the issue?"
   - Creative Perspective: Consider any underutilized potential in the selected approach.

   *2.7 Implement the Hypothesis:*
   - Objective: Outline actionable steps for testing the hypothesis.
   - Reflection: "Is this plan practical? What resources or preparation are required?"
   - Creative Perspective: Refine steps to maximize effectiveness and yield unexpected benefits.

   *2.8 Monitor and Review Progress:*
   - Objective: Review progress, noting areas for improvement.
   - Reflection: "What’s working well? What could be improved?"
   - Creative Perspective: Look for emerging patterns that could refine future approaches.

   *2.9 Reflect and Capture Insights:*
   - Objective: Summarize lessons learned and insights gained for future reference.
   - Reflection: "What new understanding has emerged from this process?"
   - Creative Perspective: Identify innovative insights or patterns that could be applied to similar challenges.

3. *Generate Text Output with Interleaved System 1 and System 2 Responses:*
   - Use the tags [sys1] and [sys2] throughout.
   - Aim for a lengthier, detailed response. Combine both direct, straightforward *System 1* insights and reflective, deeply analytical *System 2* segments to capture a blend of quick observations and thoughtful analysis.

---

### *Example Input Text:*

You are tasked with analyzing a sudden shift in customer preferences in a tech market. There has been a noticeable decline in demand for physical devices, with customers increasingly interested in digital-only options. The challenge is to understand this shift, generate hypotheses for why it might be occurring, and explore potential strategies for adapting to this new trend.

---

### *Processed Output with System 1 and System 2 Thinking:*

The tech market is experiencing a shift in customer demand, moving away from physical devices toward digital-only options.

[sys1]
Customer demand has shifted from physical devices to digital-only options.
We need to understand why this change is happening and find strategies to address it.
Key factors may include cost, convenience, and technological trends.
[end sys1]

[sys2]
**2.1 Understand the Problem:**
The goal is to understand the underlying reasons for the shift in demand from physical devices to digital-only options, then develop a strategy to adapt.

*Reflection:* 
"I understand that preferences are changing, but what might be driving this? Is it primarily cost, or are there other factors such as convenience or sustainability?"

*Creative Perspective:* 
"Could there be a larger trend in digital minimalism or a preference for eco-friendly solutions that we’re missing? What unseen motivations might explain this shift?"

**2.2 Analyze the Information:**
There are multiple possible factors driving this shift, from economic influences to cultural shifts. It’s essential to isolate each factor and understand its impact.

*Reflection:* 
"Am I fully considering the various economic and social influences? Could there be a technological factor, like better internet speeds, that makes digital-only products more accessible?"

*Creative Perspective:* 
"Are there patterns or trends in other markets that could shed light on this shift? Could this be part of a larger trend toward virtual experiences?"

**2.3 Generate Hypotheses:**
1. Customers prefer digital options due to lower costs. (Confidence: 0.8, Creative: 0.4)
2. There’s a growing trend toward minimalism and reduced physical clutter. (Confidence: 0.7, Creative: 0.7)
3. Digital products offer greater flexibility and ease of use. (Confidence: 0.6, Creative: 0.6)
4. Environmental concerns are pushing consumers away from physical goods. (Confidence: 0.6, Creative: 0.8)
5. Advances in tech make digital-only options more functional. (Confidence: 0.8, Creative: 0.5)
6. Pandemic-era remote work increased demand for digital solutions. (Confidence: 0.7, Creative: 0.6)
7. Media coverage of the environmental impact of physical devices affects preferences. (Confidence: 0.5, Creative: 0.7)
8. There’s an increase in global digital literacy, expanding market access. (Confidence: 0.6, Creative: 0.6)
9. Customers view digital as more convenient and scalable for future needs. (Confidence: 0.7, Creative: 0.5)
10. Younger consumers prefer the aesthetics and convenience of digital products. (Confidence: 0.6, Creative: 0.6)

*Reflection:* 
"Have I considered all possible influences? Are there any surprising factors that could explain this shift?"

*Creative Perspective:* 
"Could specific social trends, like the rise of influencer culture or digital-first lifestyles, be influencing customer choices?"

**2.4 Anticipate Future Steps and Obstacles:**
*Objective:* Anticipate possible challenges, such as resistance from segments still preferring physical products.

*Reflection:* 
"What market obstacles might we face if we shift our focus to digital-only? Are there sub-segments that still prioritize physical products?"

*Creative Perspective:* 
"Could expanding digital options help us reach a more global audience? Are there emerging trends that we could leverage in our strategy?"

[end sys2]

[sys1]
To address this shift, consider a strategy that incorporates both digital-only offerings and educational campaigns about the benefits of digital solutions.
Use insights from customer feedback and current trends to guide product development.
Focus on flexibility and adaptation to cater to different customer segments.
[end sys1]


# E2E

-----

Any integration that makes use of our [pytest plugin](ddev/plugins.md#pytest) in its test suite supports
end-to-end testing on a live [Datadog Agent][].

The entrypoint for E2E management is the command group `ddev env`.

## Discovery

Use the `ls` command to see what environments are available, for example:

```
$ ddev env ls envoy
envoy:
    py27
    py38
```

You'll notice that only environments that actually run tests are available.

Running simply `ddev env ls` with no arguments will display the active environments.

## Creation

To start an environment run `ddev env start <INTEGRATION> <ENVIRONMENT>`, for example:

```
$ ddev env start envoy py38
Setting up environment `py38`... success!
Updating `datadog/agent-dev:master`... success!
Detecting the major version... Agent 7 detected
Writing configuration for `py38`... success!
Starting the Agent... success!

Config file (copied to your clipboard): C:\Users\ofek\AppData\Local\dd-checks-dev\envs\envoy\py38\config\envoy.yaml
To run this check, do: ddev env check envoy py38
To stop this check, do: ddev env stop envoy py38
```

This sets up the selected environment and an instance of the Agent running in a Docker container. The default
configuration is defined by each environment's test suite and is saved to a file, which is then mounted to the
Agent container so you may freely modify it.

Let's see what we have running:

```
$ docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}"
IMAGE                          STATUS                            PORTS                                                     NAMES
datadog/agent-dev:master-py3   Up 4 seconds (health: starting)                                                             dd_envoy_py38
default_service2               Up 5 seconds                      80/tcp, 10000/tcp                                         default_service2_1
envoyproxy/envoy:latest        Up 5 seconds                      0.0.0.0:8001->8001/tcp, 10000/tcp, 0.0.0.0:8000->80/tcp   default_front-envoy_1
default_xds                    Up 5 seconds                      8080/tcp                                                  default_xds_1
default_service1               Up 5 seconds                      80/tcp, 10000/tcp                                         default_service1_1
```

### Agent version

You can select a particular build of the Agent to use with the `--agent`/`-a` option. Any Docker image is valid e.g. `datadog/agent:7.17.0`.

A custom nightly build will be used by default, which is re-built on every commit to the [Datadog Agent repository][datadog-agent].

### Integration version

By default the version of the integration used will be the one shipped with the chosen Agent version, as if you had passed in the `--prod` flag. If you wish
to modify an integration and test changes in real time, use the `--dev` flag.

Doing so will mount and install the integration in the Agent container. All modifications to the integration's directory will be propagated to the Agent,
whether it be a code change or switching to a different Git branch.

If you modify the [base package](base/about.md) then you will need to mount that with the `--base` flag, which implicitly activates `--dev`.

## Testing

To run tests against the live Agent, use the `ddev env test` command. It is similar to the [test command](testing.md#usage) except
it is capable of running tests [marked as E2E](ddev/plugins.md#agent-check-runner), and only runs such tests.

### Automation

You can use the `--new-env`/`-ne` flag to automate environment management. For example running:

```
ddev env test apache:py38 vault:py38 -ne
```

will start the `py38` environment for Apache, run E2E tests, tear down the environment, and then do the same for Vault.

!!! tip
    Since running tests implies code changes are being introduced, `--new-env` enables `--dev` by default.

## Execution

Similar to the Agent's `check` command, you can perform manual check runs using `ddev env check <INTEGRATION> <ENVIRONMENT>`, for example:

```
$ ddev env check envoy py38 --log-level debug
...
=========
Collector
=========

  Running Checks
  ==============

    envoy (1.12.0)
    --------------
      Instance ID: envoy:c705bd922a3c275c [OK]
      Configuration Source: file:/etc/datadog-agent/conf.d/envoy.d/envoy.yaml
      Total Runs: 1
      Metric Samples: Last Run: 546, Total: 546
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 1
      Average Execution Time : 25ms
      Last Execution Date : 2020-02-17 00:58:05.000000 UTC
      Last Successful Execution Date : 2020-02-17 00:58:05.000000 UTC
```

### Debugging

You may start an [interactive debugging session][python-pdb] using the `--breakpoint`/`-b` option.

The option accepts an integer representing the line number at which to break. For convenience, `0` and `-1` are shortcuts to
the first and last line of the integration's `check` method, respectively.

```
$ ddev env check envoy py38 -b 0
> /opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/envoy/envoy.py(34)check()
-> custom_tags = instance.get('tags', [])
(Pdb) list
 29             self.blacklisted_metrics = set()
 30
 31             self.caching_metrics = None
 32
 33         def check(self, instance):
 34 B->         custom_tags = instance.get('tags', [])
 35
 36             try:
 37                 stats_url = instance['stats_url']
 38             except KeyError:
 39                 msg = 'Envoy configuration setting `stats_url` is required'
(Pdb) print(instance)
{'stats_url': 'http://localhost:8001/stats'}
```

!!! info "Caveat"
    The line number must be within the integration's `check` method.

## Refreshing state

Testing and manual check runs always reflect the current state of code and configuration however, if you want to see the result
of changes [in-app][], you will need to refresh the environment by running `ddev env reload <INTEGRATION> <ENVIRONMENT>`.

## Removal

To stop an environment run `ddev env stop <INTEGRATION> <ENVIRONMENT>`.

Any environments that haven't been explicitly stopped will show as active in the output of `ddev env ls`, even persisting
through system restarts. If you are confident that environments are no longer active, you can run `ddev env prune` to
remove all accumulated environment state.