Browse Source

feat: PowerShell support (backend) (#67577)

<!-- Describe your PR here. -->
This adds a new SDK to the backend: PowerShell

I've implemented these changes by copying what is done for platform
elixir.

I've tested the changes locally and everything seems to work fine
AFAICT.

frontend PR: https://github.com/getsentry/sentry/pull/67576
<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

---------

Co-authored-by: Josh Ferge <josh.ferge@gmail.com>
Ivan Dlugos 11 months ago
parent
commit
2251627c94

+ 1 - 0
bin/extension_language_map.py

@@ -51,6 +51,7 @@ languages = [
     "lua",
     "ocaml",
     "hcl",
+    "powershell",
 ]
 
 EXTENSION_LANGUAGE_MAP: dict[str, str] = {}

+ 12 - 0
fixtures/integration-docs/_platforms.json

@@ -425,6 +425,18 @@
       ],
       "id": "mock",
       "name": "Mock"
+    },
+    {
+      "integrations": [
+        {
+          "link": "https://docs.getsentry.com/platforms/powershell/",
+          "type": "language",
+          "id": "powershell",
+          "name": "PowerShell"
+        }
+      ],
+      "id": "powershell",
+      "name": "PowerShell"
     }
   ]
 }

+ 6 - 0
fixtures/integration-docs/powershell.json

@@ -0,0 +1,6 @@
+{
+  "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>A <a class=\"reference external\" href=\"https://www.powershellgallery.com/packages/Sentry/\">PowerShell module</a> is available for Sentry.</p>\n</div>\n",
+  "link": "https://docs.getsentry.com/platforms/powrshell/",
+  "id": "powershell",
+  "name": "PowerShell"
+}

+ 3 - 0
src/sentry/constants.py

@@ -906,6 +906,9 @@ EXTENSION_LANGUAGE_MAP = {
     "pm": "perl",
     "psgi": "perl",
     "t": "perl",
+    "ps1": "powershell",
+    "psd1": "powershell",
+    "psm1": "powershell",
     "py": "python",
     "gyp": "python",
     "gypi": "python",

+ 1 - 1
src/sentry/issues/event.schema.json

@@ -170,7 +170,7 @@
           }
         },
         "platform": {
-          "description": " Platform identifier of this event (defaults to \"other\").\n\n A string representing the platform the SDK is submitting from. This will be used by the\n Sentry interface to customize various components in the interface, but also to enter or\n skip stacktrace processing.\n\n Acceptable values are: `as3`, `c`, `cfml`, `cocoa`, `csharp`, `elixir`, `haskell`, `go`,\n `groovy`, `java`, `javascript`, `native`, `node`, `objc`, `other`, `perl`, `php`, `python`,\n `ruby`",
+          "description": " Platform identifier of this event (defaults to \"other\").\n\n A string representing the platform the SDK is submitting from. This will be used by the\n Sentry interface to customize various components in the interface, but also to enter or\n skip stacktrace processing.\n\n Acceptable values are: `as3`, `c`, `cfml`, `cocoa`, `csharp`, `elixir`, `haskell`, `go`,\n `groovy`, `java`, `javascript`, `native`, `node`, `objc`, `other`, `perl`, `php`, `powershell`, `python`,\n `ruby`",
           "type": "string"
         },
         "project_id": {

+ 1 - 0
src/sentry/models/featureadoption.py

@@ -45,6 +45,7 @@ manager.add(11, "elixir", "Elixir", "language")
 manager.add(12, "cfml", "CFML", "language")
 manager.add(13, "groovy", "Groovy", "language")
 manager.add(14, "csp", "CSP Reports", "language")
+manager.add(15, "powershell", "PowerShell", "language")
 
 # Frameworks
 manager.add(20, "flask", "Flask", "integration", prerequisite=["python"])

+ 1 - 0
src/sentry/models/project.py

@@ -121,6 +121,7 @@ GETTING_STARTED_DOCS_PLATFORMS = [
     "php",
     "php-laravel",
     "php-symfony",
+    "powershell",
     "python",
     "python-aiohttp",
     "python-asgi",

+ 1 - 0
src/sentry/utils/platform_categories.py

@@ -79,6 +79,7 @@ BACKEND = [
     "php-monolog",
     "php-symfony",
     "php",
+    "powershell",
     "python",
     "python-aiohttp",
     "python-asgi",

+ 1 - 0
src/sentry/utils/tag_normalization.py

@@ -38,6 +38,7 @@ _KNOWN_TAGS = {
     "sentry.objc",
     "sentry.perl",
     "sentry.php",
+    "sentry.powershell",
     "sentry.python",
     "sentry.ruby",
     "sentry.rust",