Zum Hauptinhalt springen

Samples auflisten

Endpunkte [GET]:
EndpunktBeschreibung
/api/[app_id]/samples.jsonGibt ALLE Sample-Typen zurück
/api/[app_id]/samples/performance.jsonGibt Performance-Samples zurück
/api/[app_id]/samples/errors.jsonGibt Error-Samples zurück
Parameter:
ParamTypBeschreibung
action_idstringBeispiel: BlogPostsController-hash-show
exceptionstringBeispiel: NoMethodError
sincetimestamp/integerAlle Zeiten sind in UTC
beforetimestamp/integerAlle Zeiten sind in UTC
limitintegerDie Anzahl der zurückgegebenen Einträge (Standard 10)
count_onlyboolean(true/false) Nur die Anzahl zurückgeben
Maskieren Sie Actions, indem Sie Folgendes ersetzen:
  • # durch -hash-
  • / durch -slash-
  • . durch -dot-
So wird aus BlogPostsController#show: BlogPostsController-hash-show Ein Beispiel für eine vollständige Anfrage wäre:
Shell
https://appsignal.com/api/5114f7e38c5ce90000000011/samples.json?token=HseUe&action_id=AccountsController-hash-index&exception=ActionView::Template::Error&since=1374843246

Ergebnis

Dieser Endpunkt gibt das folgende JSON zurück (ein Slow-Sample und ein Error-Sample):
{
  "count": 2,
  "log_entries": [
    {
      "id": "51f29e7b183d700800150358_SlowController#show_1476962400",
      "action": "SlowController#show",
      "path": "/slow-request",
      "duration": 3182.545407,
      "status": 200,
      "time": 1476962400,
      "is_exception": false,
      "exception": {
        "name": null
      }
    },
    {
      "id": "57f653fa16b7e24cb0dc9e2b_ErrorController#trigger_1475761080",
      "action": "ErrorController#trigger",
      "path": "/error-request",
      "duration": null,
      "status": null,
      "time": 1475761080,
      "is_exception": true,
      "exception": {
        "name": "ActionView::Template::Error"
      }
    }
  ]
}

Sample anzeigen

Endpunkt [GET]: /api/[app_id]/samples/[id].json Parameter:
ParamTypBeschreibung
idstringBereinigte Sample-ID (Beispiel: 51f29e7b183d700800150358_SlowController-hash-show_1476962400)

Ergebnis

Dies ist ein SLOW-Logeintrag:
{
  "id": "51f29e7b183d700800150358_SlowController#show_1476962400",
  "action": "slow#request",
  "db_runtime": 500.0,
  "duration": 300.0,
  "environment": {},
  "hostname": "app1",
  "is_exception": null,
  "kind": "http_request",
  "params": {},
  "path": "/blog",
  "request_format": "html",
  "request_method": "GET",
  "session_data": {},
  "status": "200",
  "view_runtime": 500.0,
  "time": 1002700800,
  "end": 978339601,
  "allocation_count": 110101,
  "events": [
      {
          "action": "query",
          "duration": 250.0,
          "group": "mongoid",
          "name": "query.mongoid",
          "payload": {
              "query": "this is a mongoid query"
          },
          "time": 0,
          "end": 0
          "digest": 00000,
          "allocation_count": 1010101

      }
  ],
  "exception": null
}
Dies ist ein ERROR-Logeintrag:
{
  "id": "57f653fa16b7e24cb0dc9e2b_ErrorController#trigger_1475761080",
  "action": "Error#trigger",
  "db_runtime": 500.0,
  "duration": null,
  "environment": {
    "HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh"
  },
  "hostname": "app1",
  "is_exception": true,
  "kind": "http_request",
  "params": {
    "id": 1,
    "get": "something"
  },
  "path": "/blog",
  "request_format": "html",
  "request_method": "GET",
  "session_data": {
    "current_user_id": 1
  },
  "status": "200",
  "view_runtime": 500.0,
  "time": 1002700800,
  "end": 978339601,
  "events": [],
  "tags": {
    "user": "john doe",
    "id": 1
  },
  "exception": {
    "message": "The method was not found",
    "name": "NoMethodError",
    "backtrace": ["Backtrace line 1", "Backtrace line 2", "Backtrace line 3"]
  }
}
Hinweis: Wenn Sie erweiterte Abfragen benötigen, z. B. das Suchen von Samples nach Tag, können Sie dies mit unserer GraphQL-API tun. Schauen Sie sich die GraphQL-API-Dokumentation für Abfragebeispiele und weitere Details an.