Skip to content

[DECO-102] Setup logging infra - #117

Merged
kartikgupta-db merged 15 commits into
mainfrom
DECO-102-logging
Oct 7, 2022
Merged

[DECO-102] Setup logging infra#117
kartikgupta-db merged 15 commits into
mainfrom
DECO-102-logging

Conversation

@kartikgupta-db

@kartikgupta-db kartikgupta-db commented Sep 26, 2022

Copy link
Copy Markdown
Contributor

Changelist

  • Allow users to bring in their own loggers
  • Redaction based on field names
  • Dropping headers and agents based on DATABRICKS_DEBUG_HEADERS flag
  • Truncating string based on DATABRICKS_DEBUG_TRUNCATE_BYTES flag

Field Name Based Redaction

{
  "level": "debug",
  "message": "https://adb-309687753508875.15.azuredatabricks.net/api/2.0/clusters/list?can_use_client=",
  "operationId": "7f717111-1094-41a8-85df-4b410a01a250",
  "operationName": "ApiClient.request",
  "request": {
    "agent": {
      "_events": {},
      "_eventsCount": 2,
      "_sessionCache": { "list": [], "map": {} },
      "defaultPort": 443,
      "freeSockets": {},
      "keepAlive": true,
      "keepAliveMsecs": 15000,
      "maxCachedSessions": 100,
      "maxFreeSockets": 256,
      "maxSockets": null,
      "maxTotalSockets": null,
      "options": { "keepAlive": true, "keepAliveMsecs": 15000, "path": null },
      "protocol": "https:",
      "requests": {},
      "scheduling": "lifo",
      "sockets": {},
      "totalSocketCount": 0
    },
    "headers": {
      "Authorization": "***REDACTED***",
      "Content-Type": "text/json",
      "User-Agent": "vscode-extension/0.0.1 databricks-sdk-js/0.0.1 nodejs/16.14.2 os/darwin"
    },
    "method": "GET"
  },
  "timestamp": 1665129651838
}

Dropping headers and agent field based on DATABRICKS_DEBUG_HEADERS flag

{
  "level": "debug",
  "message": "https://adb-309687753508875.15.azuredatabricks.net/api/2.0/preview/scim/v2/Me",
  "operationId": "bbda1f1d-5177-4089-8dc2-b058c64eef1e",
  "operationName": "ApiClient.request",
  "request": { "method": "GET" },
  "timestamp": 1665129913774
}

Field truncation based on DATABRICKS_DEBUG_TRUNCATE_BYTES flag

This is only for representation with field length 20

{
  "level": "debug",
  "message": "https://adb-309687753508875.15.azuredatabricks.net/api/2.0/preview/scim/v2/Me",
  "operationId": "ab3f24aa-e904-4bdc-8cac-6c0c8236fba4",
  "operationName": "ApiClient.request",
  "response": {
    "active": true,
    "emails": [
      {
        "primary": true,
        "type": "work"
      }
    ],
    "externalId": "471d1718-d938-4b13-9...(16 more bytes)",
    "groups": [
      {
        "$ref": "Groups/7373105599507...(2 more bytes)",
        "display": "admins",
        "type": "direct",
        "value": "737310559950744"
      }
    ],
    "id": "4183391249163402",
    "schemas": [
      "urn:ietf:params:scim...(22 more bytes)",
      "urn:ietf:params:scim...(53 more bytes)"
    ]
  },
  "timestamp": 1665131138427
}

Loading
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.

3 participants