# Register Edge observability metrics. POST https://app.unleash-instance.example.com/api/client/metrics/edge Content-Type: application/json **Enterprise feature** Registers Edge observability metrics from downstream Edge instances to aggregate a comprehensive status view of connected Edges. Reference: https://docs.getunleash.io/api/register-edge-observability-metrics ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Register Edge observability metrics. version: endpoint_unleashEdge.registerEdgeObservabilityMetrics paths: /api/client/metrics/edge: post: operationId: register-edge-observability-metrics summary: Register Edge observability metrics. description: >- **Enterprise feature** Registers Edge observability metrics from downstream Edge instances to aggregate a comprehensive status view of connected Edges. tags: - - subpackage_unleashEdge parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '202': description: This response has no body. content: application/json: schema: $ref: >- #/components/schemas/Unleash Edge_registerEdgeObservabilityMetrics_Response_202 requestBody: description: edgeInstanceDataSchema content: application/json: schema: $ref: '#/components/schemas/edgeInstanceDataSchema' components: schemas: edgeProcessMetricsSchema: type: object properties: cpuUsage: type: number format: double description: CPU usage, in seconds, since start of process. memoryUsage: type: number format: double description: Current process_resident_memory (in bytes) usage. required: - cpuUsage - memoryUsage edgeLatencyMetricsSchema: type: object properties: avg: type: number format: double description: Average time per request in milliseconds. count: type: number format: double description: Total number of requests made. p99: type: number format: double description: 99% of requests finished within this amount of milliseconds. required: - avg - count - p99 edgeInstanceTrafficSchema: type: object properties: get: type: object additionalProperties: $ref: '#/components/schemas/edgeLatencyMetricsSchema' description: A map containing GET requests. post: type: object additionalProperties: $ref: '#/components/schemas/edgeLatencyMetricsSchema' description: A map containing POST requests. accessDenied: type: object additionalProperties: $ref: '#/components/schemas/edgeLatencyMetricsSchema' description: A map containing requests that were denied. cachedResponses: type: object additionalProperties: $ref: '#/components/schemas/edgeLatencyMetricsSchema' description: A map containing requests that had cached responses. required: - get - post - accessDenied - cachedResponses edgeUpstreamLatencySchema: type: object properties: features: $ref: '#/components/schemas/edgeLatencyMetricsSchema' metrics: $ref: '#/components/schemas/edgeLatencyMetricsSchema' edge: $ref: '#/components/schemas/edgeLatencyMetricsSchema' required: - features - metrics - edge edgeEndpointTrafficSchema: type: object properties: requests200: type: number format: double description: Number of 20x requests requests304: type: number format: double description: Number of 30x requests edgeRequestStatsSchema: type: object properties: /api/client/features: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: 20x and 30x requests to the client features endpoint /api/frontend: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: Traffic to the frontend endpoint /api/proxy: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: >- Traffic to the proxy endpoint (proxy endpoint is deprecated, use /api/frontend instead) /api/client/metrics: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: Traffic to Edge Metrics (from SDKs) /api/client/metrics/bulk: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: Traffic to Edge Metrics (from other Edge instances) /api/client/metrics/edge: $ref: '#/components/schemas/edgeEndpointTrafficSchema' description: Traffic to Edge Metrics (from other Edge instances) consumptionDataPointSchema: type: object properties: interval: type: array items: type: integer description: Time interval in milliseconds [start, end]. requests: type: number format: double description: Number of requests in this interval required: - interval - requests meteredGroupConsumptionSchema: type: object properties: meteredGroup: type: string description: Name of the metered group dataPoints: type: array items: $ref: '#/components/schemas/consumptionDataPointSchema' description: Array of consumption data points required: - meteredGroup - dataPoints connectionConsumptionSchema: type: object properties: features: type: array items: $ref: '#/components/schemas/meteredGroupConsumptionSchema' description: Feature consumption data points metrics: type: array items: $ref: '#/components/schemas/meteredGroupConsumptionSchema' description: Metrics consumption data points required: - features - metrics RequestConsumptionSchemaItems: type: object properties: meteredGroup: type: string description: Name of the metered group requests: type: number format: double description: Total number of requests for this metered group required: - meteredGroup - requests requestConsumptionSchema: type: array items: $ref: '#/components/schemas/RequestConsumptionSchemaItems' EdgeInstanceDataSchemaHosting: type: string enum: - value: hosted - value: self-hosted - value: enterprise-self-hosted edgeApiKeyRevisionIdSchema: type: object properties: environment: type: string description: The Unleash Environment this apiKey is synced for projects: type: array items: type: string description: >- The list of projects this key is valid for or * if valid for all projects revisionId: type: number format: double description: The revision id of Edge's last successful sync of this key lastUpdated: type: string format: date-time description: The timestamp of the last successful sync of this key required: - environment - projects - revisionId edgeInstanceDataSchema: type: object properties: identifier: type: string description: >- The ID of the Edge process, typically a ULID. Newly generated for each restart of the instance. appName: type: string description: >- The name of the application, configured by the user, typically persistent across restarts of Edge. region: type: - string - 'null' description: >- Which region the Edge instance is running in. Set to AWS_REGION by default (if present). edgeVersion: type: string description: Which version (semver) of Edge is the Edge instance running. processMetrics: oneOf: - $ref: '#/components/schemas/edgeProcessMetricsSchema' - type: 'null' started: type: string format: date-time description: RFC3339 timestamp for when the Edge instance was started. traffic: $ref: '#/components/schemas/edgeInstanceTrafficSchema' latencyUpstream: $ref: '#/components/schemas/edgeUpstreamLatencySchema' connectedStreamingClients: type: number format: double description: How many streaming clients are connected to the Edge instance. connectedEdges: type: array items: $ref: '#/components/schemas/edgeInstanceDataSchema' description: A list of Edge instances connected to the Edge instance. requestsSinceLastReport: $ref: '#/components/schemas/edgeRequestStatsSchema' description: >- Requests made to edge's endpoints since last report. Meant to be used for billing purposes. connectionConsumptionSinceLastReport: $ref: '#/components/schemas/connectionConsumptionSchema' description: >- Connection consumption data since last report, including features and metrics consumption. Used for long-lived backend SDKs with backend controlled number of instances. requestConsumptionSinceLastReport: $ref: '#/components/schemas/requestConsumptionSchema' description: >- Request consumption data since last report, grouped by metered group. Used for frontend SDKs with unpredictable and potentially large number of user devices running those SDKs. hosting: $ref: '#/components/schemas/EdgeInstanceDataSchemaHosting' description: >- A marker that tells Unleash whether this Edge instance is self-hosted, enterprise self-hosted, or hosted by Unleash. apiKeyRevisionIds: type: - array - 'null' items: $ref: '#/components/schemas/edgeApiKeyRevisionIdSchema' description: >- List of API keys (represented by their environment and projects) and revision ids to make it easier to track sync state of edge required: - identifier - appName - edgeVersion - started - traffic - latencyUpstream - connectedStreamingClients - connectedEdges Unleash Edge_registerEdgeObservabilityMetrics_Response_202: type: object properties: {} ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/client/metrics/edge" payload = { "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": { "get": {}, "post": {}, "accessDenied": {}, "cachedResponses": {} }, "latencyUpstream": { "features": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "metrics": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "edge": { "avg": 1.1, "count": 1.1, "p99": 34.5 } }, "connectedStreamingClients": 1.1, "connectedEdges": [ { "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": { "get": {}, "post": {}, "accessDenied": {}, "cachedResponses": {} }, "latencyUpstream": { "features": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "metrics": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "edge": { "avg": 1.1, "count": 1.1, "p99": 34.5 } }, "connectedStreamingClients": 1.1, "connectedEdges": [None] } ] } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/client/metrics/edge'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"identifier":"01ARZ3NDEKTSV4RRFFQ69G5FAV","appName":"unleash-edge-us-east-1","edgeVersion":"19.6.3","started":"2024-01-15T09:30:00Z","traffic":{"get":{},"post":{},"accessDenied":{},"cachedResponses":{}},"latencyUpstream":{"features":{"avg":1.1,"count":1.1,"p99":34.5},"metrics":{"avg":1.1,"count":1.1,"p99":34.5},"edge":{"avg":1.1,"count":1.1,"p99":34.5}},"connectedStreamingClients":1.1,"connectedEdges":[{"identifier":"01ARZ3NDEKTSV4RRFFQ69G5FAV","appName":"unleash-edge-us-east-1","edgeVersion":"19.6.3","started":"2024-01-15T09:30:00Z","traffic":{"get":{},"post":{},"accessDenied":{},"cachedResponses":{}},"latencyUpstream":{"features":{"avg":1.1,"count":1.1,"p99":34.5},"metrics":{"avg":1.1,"count":1.1,"p99":34.5},"edge":{"avg":1.1,"count":1.1,"p99":34.5}},"connectedStreamingClients":1.1,"connectedEdges":[null]}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/client/metrics/edge" payload := strings.NewReader("{\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n {\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n null\n ]\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/client/metrics/edge") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n {\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n null\n ]\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://app.unleash-instance.example.com/api/client/metrics/edge") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n {\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n null\n ]\n }\n ]\n}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/client/metrics/edge', [ 'body' => '{ "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": { "get": {}, "post": {}, "accessDenied": {}, "cachedResponses": {} }, "latencyUpstream": { "features": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "metrics": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "edge": { "avg": 1.1, "count": 1.1, "p99": 34.5 } }, "connectedStreamingClients": 1.1, "connectedEdges": [ { "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": { "get": {}, "post": {}, "accessDenied": {}, "cachedResponses": {} }, "latencyUpstream": { "features": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "metrics": { "avg": 1.1, "count": 1.1, "p99": 34.5 }, "edge": { "avg": 1.1, "count": 1.1, "p99": 34.5 } }, "connectedStreamingClients": 1.1, "connectedEdges": [ null ] } ] }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/client/metrics/edge"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n {\n \"identifier\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n \"appName\": \"unleash-edge-us-east-1\",\n \"edgeVersion\": \"19.6.3\",\n \"started\": \"2024-01-15T09:30:00Z\",\n \"traffic\": {\n \"get\": {},\n \"post\": {},\n \"accessDenied\": {},\n \"cachedResponses\": {}\n },\n \"latencyUpstream\": {\n \"features\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"metrics\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n },\n \"edge\": {\n \"avg\": 1.1,\n \"count\": 1.1,\n \"p99\": 34.5\n }\n },\n \"connectedStreamingClients\": 1.1,\n \"connectedEdges\": [\n null\n ]\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": [ "get": [], "post": [], "accessDenied": [], "cachedResponses": [] ], "latencyUpstream": [ "features": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ], "metrics": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ], "edge": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ] ], "connectedStreamingClients": 1.1, "connectedEdges": [ [ "identifier": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "appName": "unleash-edge-us-east-1", "edgeVersion": "19.6.3", "started": "2024-01-15T09:30:00Z", "traffic": [ "get": [], "post": [], "accessDenied": [], "cachedResponses": [] ], "latencyUpstream": [ "features": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ], "metrics": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ], "edge": [ "avg": 1.1, "count": 1.1, "p99": 34.5 ] ], "connectedStreamingClients": 1.1, "connectedEdges": [] ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/client/metrics/edge")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```