Skip to content

Conversation

@shahdyousefak
Copy link
Contributor

@shahdyousefak shahdyousefak commented Jan 28, 2025

Please ensure you've followed the checklist and provide all the required information before requesting a review.
If you do not have everything applicable to your PR, it will not be reviewed!
If you don't know what something is or if it applies to you, ask!

Don't delete below this line.


Required Information

  • I referenced the issue addressed in this PR. --> Currently, logging behavior is not properly differentiated between Unicorn and Pegasus. This leads to unnecessary and potentially sensitive logs appearing in production. The goal of this PR is to ensure that:
    Unicorn logs can be more verbose and include detailed error messages for debugging, including what may constitute PII-related logging, particularly when errors are thrown.
    Pegasus logs are minimal, avoiding unnecessary verbosity particularly when errors are thrown.

  • I described the changes made and how these address the issue. --> configured logging_utils.ts and logging_utils.py to handle PII logging separately for Unicorn and Pegasus.

  • I described how I tested these changes. --> verified that logs correctly identify whether the service is running in Unicorn (PII logging enabled) or Pegasus (PII logging disabled). toggled the

environment:
      - PII_LOGGING_ENABLED=true

to discern output for pegasus/unicorn. Next, need to address how it will be picked up if pii logging is enabled.

Coding/Commit Requirements

  • I followed applicable coding standards where appropriate (e.g., PEP8)
  • I have not committed any models or other large files.

New Component Checklist (mandatory for new microservices)

  • I added an entry to docker-compose.yml and build.yml.
  • I created A CI workflow under .github/workflows. --> I updated the workflows to copy the config directory, which contains the script for PII logging, to ensure it is available during the build process; before, config/logging_utils.ts wasn’t found, breaking the build. (Similar to copying schemas like run: cp -R ../../schemas src/)
    modified:   .github/workflows/autour-handler.yml
    modified:   .github/workflows/high-charts-handler.yml
    modified:   .github/workflows/motd.yml
    modified:   .github/workflows/osm-streets-handler.yml
    modified:   .github/workflows/photo-audio-handler.yml
    modified:   .github/workflows/photo-audio-haptics-handler.yml
  • I have created a README.md file that describes what the component does and what it depends on (other microservices, ML models, etc.).

OR

  • I have not added a new component in this PR.

@shahdyousefak shahdyousefak linked an issue Jan 28, 2025 that may be closed by this pull request
4 tasks
Copy link
Contributor

@jaydeepsingh25 jaydeepsingh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many issues, I will try to summarize everthying here:

  • Please make sure your source branch is in sync with main branch. Currently it is reverting a lot of code in main branch (Microservices Queue changes, healthchecks, text-followup preprocessor and handler)
  • There should be no changes in build.yml and docker compose files (other than setting logging env variable)
  • No change in dockerfiles apart from copying config folder
  • For the preprocessors/handlers where are setting debug log level, need to make sure we are not removing it - need to confirm if it still prints debug statements if you set log level to PII

Please feel free to raise a new PR if that's easier for you - just make sure you don't change any other code which is not related to logging!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing text-followup preprocessor and handler?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, these should not removed from docker compose

text-followup:
environment:
LOG_PII: "true"
- SERVER_NAME=unicorn.cim.mcgill.ca
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we set PII_LOGGING_ENABLED true here?

# Copy the build output from the previous stage to the Nginx HTML directory
COPY --from=build /app/dist/editor/ /usr/share/nginx/html

# Add a static health check file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep health checks

COPY /handlers/high-charts/ /usr/src/app
RUN npm ci

COPY /handlers/high-charts/package*.json ./
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is not required

EXPOSE 8080

USER node

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add back healthcheck

if (data["preprocessors"] === undefined) {
data["preprocessors"] = {};
}
let currentPriorityGroup: number | undefined = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add back this code

configure_logging()

app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, just confirm if removing this will still log debug statements?

"ajv": "^8.9.0",
"express": "^4.19.2",
"uuid": "^8.3.2"
"node-fetch": "^2.7.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are adding extra packages and they are not related to logging.
sure you still need them?

@@ -1,6 +1,6 @@
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime

RUN apt-get update && apt-get install -y libsndfile1 espeak-ng build-essential curl && rm -rf /var/lib/apt/lists/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add back healthchecks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better method for making sure jsonschema logging does not dump PII into logs

3 participants