diff --git a/vercel/assets/dashboards/vercel_overview.json b/vercel/assets/dashboards/vercel_overview.json index 643532f7d9..a9ba712a3b 100644 --- a/vercel/assets/dashboards/vercel_overview.json +++ b/vercel/assets/dashboards/vercel_overview.json @@ -46,7 +46,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -90,7 +90,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -129,7 +129,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -182,7 +182,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -224,7 +224,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -267,14 +267,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -316,14 +316,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -366,14 +366,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -416,14 +416,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -466,14 +466,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -522,14 +522,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -593,7 +593,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -641,7 +641,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -685,7 +685,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -792,7 +792,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -851,7 +851,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" }, @@ -865,7 +865,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -923,7 +923,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -992,14 +992,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -1049,7 +1049,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" }, @@ -1063,7 +1063,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -1118,7 +1118,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" }, @@ -1132,7 +1132,7 @@ "group_by": [], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } @@ -1254,14 +1254,14 @@ "sort": { "aggregation": "cardinality", "order": "desc", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "should_exclude_missing": true } ], "compute": { "aggregation": "cardinality", - "metric": "@requestId" + "metric": "@vercel.requestId" }, "storage": "hot" } diff --git a/vercel/assets/logs/vercel.yaml b/vercel/assets/logs/vercel.yaml index df38095597..1136d9deee 100644 --- a/vercel/assets/logs/vercel.yaml +++ b/vercel/assets/logs/vercel.yaml @@ -3,6 +3,61 @@ id: vercel backend_only: false facets: + - facetType: list + groups: + - Vercel + name: Vercel Deployment Id + path: vercel.deploymentId + source: log + type: string + - facetType: list + groups: + - Vercel + name: Vercel Deployment Environment + path: vercel.deploymentEnv + source: log + type: string + - facetType: list + groups: + - Vercel + name: Vercel Invocation Id + path: vercel.invocationId + source: log + type: string + - facetType: list + groups: + - Vercel + name: Vercel Project Id + path: vercel.projectId + source: log + type: string + - facetType: list + groups: + - Vercel + name: Vercel Project Name + path: vercel.projectName + source: log + type: string + - groups: + - Web Access + name: URL Host + path: http.url_details.host + source: log + - groups: + - Web Access + name: URL Path + path: http.url_details.path + source: log + - groups: + - Web Access + name: URL Port + path: http.url_details.port + source: log + - groups: + - Web Access + name: URL scheme + path: http.url_details.scheme + source: log - groups: - Geoip name: City Name @@ -45,6 +100,30 @@ pipeline: filter: query: source:vercel processors: + - type: pipeline + name: Processing for URL Paths + enabled: true + filter: + query: "@proxy.scheme:* @proxy.host:* @proxy.path:* NOT @source:build" + processors: + - type: string-builder-processor + name: Build a parseable http.url from proxy scheme, host, and path + enabled: true + template: "%{proxy.scheme}://%{proxy.host}%{proxy.path}" + target: http.url + replaceMissing: true + - type: url-parser + name: Parse http.url into http.url_details + enabled: true + sources: + - http.url + target: http.url_details + - type: url-parser + name: Parse proxy.referer into http.referer_details + enabled: true + sources: + - proxy.referer + target: http.referer_details - type: grok-parser name: Parsing Lambda Report Logs enabled: true @@ -65,16 +144,19 @@ pipeline: enabled: true categories: - filter: - query: '@proxy.statusCode:[200 TO 299]' + query: '@type:stdout AND (@source:build OR (@level:info AND @type:stdout AND NOT _exists_:@http.status_code AND NOT _exists_:@proxy.statusCode))' + name: Info + - filter: + query: '@proxy.statusCode:[200 TO 299] AND NOT @level:error AND NOT @type:stderr' name: OK - filter: query: '@proxy.statusCode:[300 TO 399]' name: Notice - filter: - query: '@proxy.statusCode:[400 TO 499]' + query: '@proxy.statusCode:[400 TO 499] OR (@type:stderr AND (@source:build OR (@level:warn* AND @type:stderr AND NOT _exists_:@http.status_code AND NOT _exists_:@proxy.statusCode)))' name: Warning - filter: - query: '@proxy.statusCode:[500 TO 599]' + query: '@proxy.statusCode:[500 TO 599] OR (@level:error AND NOT @source:build AND NOT _exists_:@http.status_code AND NOT _exists_:@proxy.statusCode)' name: Error target: http.status_category - type: status-remapper @@ -82,11 +164,81 @@ pipeline: enabled: true sources: - http.status_category - - type: service-remapper - name: Define `projectName` as the official service of the log + - type: attribute-remapper + name: Map `deploymentId` to `vercel.deploymentId` + enabled: true + sources: + - deploymentId + sourceType: attribute + target: vercel.deploymentId + targetType: attribute + preserveSource: true + overrideOnConflict: false + - type: attribute-remapper + name: Map `environment` to `vercel.deploymentEnv` + enabled: true + sources: + - environment + sourceType: attribute + target: vercel.deploymentEnv + targetType: attribute + preserveSource: true + overrideOnConflict: false + - type: attribute-remapper + name: Map `invocationId` to `vercel.invocationId` + enabled: true + sources: + - invocationId + sourceType: attribute + target: vercel.invocationId + targetType: attribute + preserveSource: true + overrideOnConflict: false + - type: attribute-remapper + name: Map `projectId` to `vercel.projectId` + enabled: true + sources: + - projectId + sourceType: attribute + target: vercel.projectId + targetType: attribute + preserveSource: true + overrideOnConflict: false + - type: attribute-remapper + name: Map `projectName` to `vercel.projectName` enabled: true sources: - projectName + sourceType: attribute + target: vercel.projectName + targetType: attribute + preserveSource: true + overrideOnConflict: false + - type: service-remapper + name: Define `vercel.projectName` as the official service of the log + enabled: true + sources: + - vercel.projectName + - type: attribute-remapper + name: Define `vercel.deploymentId` as the official version of the log + enabled: true + sources: + - vercel.deploymentId + sourceType: attribute + target: version + targetType: tag + preserveSource: true + overrideOnConflict: false + - type: attribute-remapper + name: Define `vercel.deploymentEnv` as the official env of the log + enabled: true + sources: + - vercel.deploymentEnv + sourceType: attribute + target: env + targetType: tag + preserveSource: true + overrideOnConflict: false - type: attribute-remapper name: Map `host` to `url_host` enabled: true @@ -123,17 +275,19 @@ metrics: - name: vercel.functions.invocations query: source:vercel @source:lambda REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -150,17 +304,19 @@ metrics: - name: vercel.functions.errors query: source:vercel @source:lambda status:error REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -177,17 +333,19 @@ metrics: - name: vercel.functions.duration query: source:vercel @source:lambda REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -207,17 +365,19 @@ metrics: - name: vercel.functions.execution query: source:vercel @source:lambda REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -237,17 +397,19 @@ metrics: - name: vercel.functions.max_memory_used query: source:vercel @source:lambda REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -267,17 +429,19 @@ metrics: - name: vercel.functions.memorysize query: source:vercel @source:lambda REPORT groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -297,17 +461,19 @@ metrics: - name: vercel.requests query: source:vercel ((@source:lambda REPORT) OR @source:static) groupBys: - - path: '@projectName' + - path: '@vercel.projectName' tagName: project_name - path: '@path' tagName: path - path: '@branch' tagName: branch - - path: '@environment' - tagName: environment - - path: '@projectId' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.deploymentId' + tagName: deployment_id + - path: '@vercel.projectId' tagName: project_id - - path: '@statusCode' + - path: '@http.status_code' tagName: status_code - path: '@proxy.host' tagName: proxy_host @@ -322,9 +488,13 @@ metrics: - path: '@source' tagName: source - name: vercel.projects.build_count - query: source:vercel "Build completed in" + query: source:vercel "Build completed in " groupBys: - - path: '@projectName' + - path: '@vercel.deploymentEnv' + tagName: deployment_env + - path: '@vercel.projectName' tagName: project_name - - path: '@projectId' + - path: '@vercel.projectId' tagName: project_id + - path: '@vercel.deploymentId' + tagName: deployment_id diff --git a/vercel/assets/logs/vercel_tests.yaml b/vercel/assets/logs/vercel_tests.yaml index 580699343f..02fa54bcbd 100644 --- a/vercel/assets/logs/vercel_tests.yaml +++ b/vercel/assets/logs/vercel_tests.yaml @@ -3,6 +3,12 @@ tests: - sample: |- { + "traceId" : "85ea8a46-d63e-4fe3-ad03-ade7c16cd36b", + "source" : "lambda", + "message" : "START RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Version: $LATEST END RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b REPORT RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Duration: 0.58 ms Billed Duration: 1 ms Memory Size: 1024 MB Max Memory Used: 31 MB", + "invocationId" : "01A2B34CD5EF6GHIJK78LMNOPQ", + "tags" : [ "source:vercel" ], + "spanId" : "1012381427123789198737891237891", "proxy" : { "referer" : "https://verceltb.vercel.app/", "path" : "/api/date", @@ -15,22 +21,27 @@ tests: "timestamp" : 1629819797810, "statusCode" : 200 }, + "environment" : "production", "deploymentId" : "dpl_A1Hx5vjZxt2sWtMFQwbmr9xEBAD8", "host" : "verceltb-9hrosuv8e-zaphodBeeblebrox-dd.vercel.app", "id" : "AQAAAXt41IE0oGI-bAAAAABBWHQ0MU5nckFBQTBpd2dER0dtRDN3QUE", - "source" : "lambda", - "message" : "START RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Version: $LATEST END RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b REPORT RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Duration: 0.58 ms Billed Duration: 1 ms Memory Size: 1024 MB Max Memory Used: 31 MB", - "projectName": "projectName.vercel.app", - "timestamp" : "2021-08-24T15:43:17.812Z", - "tags" : [ "source:vercel" ], - "traceId" : "85ea8a46-d63e-4fe3-ad03-ade7c16cd36b", - "spanId": "1012381427123789198737891237891" + "projectName" : "projectName.vercel.app", + "projectId" : "prj_aBcdEgf12hIjklMNOpQ3RSTuvwxY", + "timestamp" : "2021-08-24T15:43:17.812Z" } result: custom: - deploymentId: "dpl_A1Hx5vjZxt2sWtMFQwbmr9xEBAD8" http: + referer_details: + host: "verceltb.vercel.app" + path: "/" + scheme: "https" status_category: "OK" + url: "https://verceltb.vercel.app/api/date" + url_details: + host: "verceltb.vercel.app" + path: "/api/date" + scheme: "https" id: "AQAAAXt41IE0oGI-bAAAAABBWHQ0MU5nckFBQTBpd2dER0dtRDN3QUE" lambda: billed_duration: 1.0 @@ -42,7 +53,6 @@ tests: network: client: geoip: {} - projectName: "projectName.vercel.app" proxy: clientIp: "64.145.79.247" host: "verceltb.vercel.app" @@ -56,16 +66,29 @@ tests: userAgent: - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36" source: "lambda" + environment: "production" + deploymentId: "dpl_A1Hx5vjZxt2sWtMFQwbmr9xEBAD8" + invocationId: "01A2B34CD5EF6GHIJK78LMNOPQ" + projectId: "prj_aBcdEgf12hIjklMNOpQ3RSTuvwxY" + projectName: "projectName.vercel.app" tags: - "source:vercel" timestamp: "2021-08-24T15:43:17.812Z" url_host: "verceltb-9hrosuv8e-zaphodBeeblebrox-dd.vercel.app" + vercel: + deploymentEnv: "production" + deploymentId: "dpl_A1Hx5vjZxt2sWtMFQwbmr9xEBAD8" + invocationId: "01A2B34CD5EF6GHIJK78LMNOPQ" + projectId: "prj_aBcdEgf12hIjklMNOpQ3RSTuvwxY" + projectName: "projectName.vercel.app" message: "START RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Version: $LATEST END RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b REPORT RequestId: 85ea8a46-d63e-4fe3-ad03-ade7c16cd36b Duration: 0.58 ms Billed Duration: 1 ms Memory Size: 1024 MB Max Memory Used: 31 MB" service: "projectName.vercel.app" - span_id: "1012381427123789198737891237891" - status: "ok" tags: - "source:LOGS_SOURCE" - timestamp: "2021-08-24T15:43:17.812Z" + - "version:dpl_a1hx5vjzxt2swtmfqwbmr9xebad8" + - "env:production" + timestamp: 1629819797812 trace_id: "85ea8a46-d63e-4fe3-ad03-ade7c16cd36b" + test_metrics: + - "vercel.projects.build_count"