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

Disable temp file creation if enable_local_storage set to be False #1208

Open
liyakun opened this issue Jun 13, 2023 · 4 comments · May be fixed by #1212
Open

Disable temp file creation if enable_local_storage set to be False #1208

liyakun opened this issue Jun 13, 2023 · 4 comments · May be fixed by #1212
Labels
azure Microsoft Azure bug

Comments

@liyakun
Copy link

liyakun commented Jun 13, 2023

Describe your environment.

  • Python version: 3.11.3
  • opencensus-ext-azure version: 1.1.9
  • Running environment: Docker container
    • Docker image: python:3.11-slim
  • Cloud provider: Azure Application Insight

Steps to reproduce.
Running application with AzureEventHandler integrated with Python logging, logging configuration file has the following related structure

"azure_event_handler": {
      "level": "INFO",
      "formatter": "info",
      "()": "opencensus.ext.azure.log_exporter.AzureEventHandler",
      "enable_local_storage": 0,
      "storage_path": "not_exist"
}

The reason that I want to disable the local storage is because my container has read only system, any writing should be disabled. However, the checking in

does not consider whether enable_local_storage is disable. The root cause is in which triggers and from here, it calls the process_options function again which will create the temp file.

What is the expected behavior?
No temp file should be created if enable_local_storage is set to False.

What is the actual behavior?
Temp file created even if enable_local_storage is set to False

@liyakun liyakun added the bug label Jun 13, 2023
@jeremydvoss
Copy link
Collaborator

Looking into this.

@jeremydvoss
Copy link
Collaborator

An easy workaround for read-only scenarios is to pass in a storage_path. Even though it won't be used, it will prevent the temp folder from being created.

@liyakun
Copy link
Author

liyakun commented Jun 27, 2023

@jeremydvoss thanks for sharing this workaround, I actually tested it before, but it is not working. The reason basically is that

won't pass this storage_path along, only the enable_local_storage is kept.

My issue description seems not really precise, actually once enable_local_storage is checked at

, we don't really have to worry about the passing of storage_path argument in statsbeat.py.

@jeremydvoss
Copy link
Collaborator

I see. Thanks for explaining. OpenCensus has been deprecated. I suggest migrating to our new OpenTelemetry Distro.

In the meantime, since the statsbeat exporter assumes it has the ability to create a temp file, you can try disabling statsbeat but setting the environment variable APPLICATIONINSIGHTS_STATSBEAT_DISABLED_ALL=true

@lzchen lzchen added the azure Microsoft Azure label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure Microsoft Azure bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants