This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

CreateCustomMetrics

1 - 1.1

post /v1/metrics/custom

Description

Create Custom Metrics. The request body of this API can receive data in either camelCase or snake_case.

State ACTIVE (CURRENT)

VersionSupported Until
1.1-

Parameters

TypeNameDescriptionSchemaDefault
bodybody
required

MetricCustomRequest

Responses

HTTP CodeDescriptionSchema
202AcceptedNone
400Bad RequestNone
401UnauthorizedNone
403ForbiddenNone

Example HTTP request

Request path

/v1/metrics/custom

Request header

"Scp-Accesskey = 2sd2gg=2agbdSD26svcD",
"Scp-Signature = fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=",
"Scp-Timestamp = 1605290625682",
"Scp-ClientType = Openapi",
"Accept-Language = en-US",
"Scp-Api-Version = servicewatch 1.1"

Request body

{
    "resource_metrics": [
        {
            "resource": {
                "attributes": [
                    {
                        "key": "",
                        "value": {
                            "array_value": "",
                            "bool_value": "",
                            "byte_value": "",
                            "double_value": "",
                            "int_value": "",
                            "kvlist_value": "",
                            "string_value": ""
                        }
                    }
                ]
            },
            "scope_metrics": [
                {
                    "metrics": [
                        {
                            "description": "The total number of bytes read successfully.",
                            "gauge": {
                                "data_points": [
                                    {
                                        "as_double": 0.75,
                                        "as_int": 10,
                                        "attributes": [
                                            {
                                                "key": "",
                                                "value": {
                                                    "array_value": "",
                                                    "bool_value": "",
                                                    "byte_value": "",
                                                    "double_value": "",
                                                    "int_value": "",
                                                    "kvlist_value": "",
                                                    "string_value": ""
                                                }
                                            }
                                        ],
                                        "start_time_unix_nano": "1753776789854000000",
                                        "time_unix_nano": "1753776789854000000"
                                    }
                                ]
                            },
                            "name": "node_disk_read_bytes_total",
                            "sum": {
                                "aggregation_temporality": "2",
                                "data_points": [
                                    {
                                        "as_double": 0.75,
                                        "as_int": 10,
                                        "attributes": [
                                            {
                                                "key": "",
                                                "value": {
                                                    "array_value": "",
                                                    "bool_value": "",
                                                    "byte_value": "",
                                                    "double_value": "",
                                                    "int_value": "",
                                                    "kvlist_value": "",
                                                    "string_value": ""
                                                }
                                            }
                                        ],
                                        "start_time_unix_nano": "1753776789854000000",
                                        "time_unix_nano": "1753776789854000000"
                                    }
                                ],
                                "is_monotonic": true
                            },
                            "unit": "Bytes"
                        }
                    ],
                    "scope": {
                        "name": "ServiceWatch-Agent",
                        "version": "1.0.0"
                    }
                }
            ]
        }
    ]
}

Example HTTP response

Response 202