github.com/grafana/synthetic-monitoring-agent@v0.64.2/pkg/pb/synthetic_monitoring/checks.proto (about)

     1  // Copyright 2020 Grafana Labs
     2  // Licensed under the Apache License, Version 2.0 (the "License");
     3  // you may not use this file except in compliance with the License.
     4  // You may obtain a copy of the License at
     5  //
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  syntax = "proto3";
    15  package synthetic_monitoring;
    16  
    17  import "gogoproto/gogo.proto";
    18  
    19  option go_package = "github.com/grafana/synthetic-monitoring-agent/pkg/pb/synthetic_monitoring";
    20  option (gogoproto.enum_stringer_all) = false;
    21  option (gogoproto.goproto_getters_all) = false;
    22  option (gogoproto.goproto_sizecache_all) = false;
    23  option (gogoproto.goproto_unkeyed_all) = false;
    24  option (gogoproto.goproto_unrecognized_all) = false;
    25  option (gogoproto.marshaler_all) = true;
    26  option (gogoproto.sizer_all) = true;
    27  option (gogoproto.unmarshaler_all) = true;
    28  
    29  service Checks {
    30    // RegisterProbe causes this probe to be reported as online with
    31    // synthetic-monitoring-api.
    32    //
    33    // The probe is identified via an authentication token provided
    34    // through a different channel by synthetic-monitoring-api.
    35    rpc RegisterProbe(ProbeInfo) returns (RegisterProbeResult) {}
    36  
    37    // GetChanges returns a list of check operations, specifying
    38    // whether to add, update or delete checks.
    39    rpc GetChanges(ProbeState) returns (stream Changes) {}
    40  
    41    // Ping sends a ping to the server and receives an
    42    // acknowledgement back.
    43    rpc Ping(PingRequest) returns (PongResponse) {}
    44  }
    45  
    46  service AdHocChecks {
    47    // RegisterProbe causes this probe to be reported as available
    48    // with synthetic-monitoring-api.
    49    //
    50    // The probe is identified via an authentication token provided
    51    // through a different channel by synthetic-monitoring-api.
    52    rpc RegisterProbe(ProbeInfo) returns (RegisterProbeResult) {}
    53  
    54    // GetAdHocChecks returns a list of checks to be run immediately.
    55    rpc GetAdHocChecks(Void) returns (stream AdHocRequest) {}
    56  }
    57  
    58  // Void is an empty message used by RPC methods that don't take
    59  // arguments.
    60  message Void {}
    61  
    62  // ProbeState message is sent by probes as the argument to GetChanges. It contains a list
    63  // of the checks and tenants already known to the probe.
    64  message ProbeState {
    65    repeated EntityRef checks = 1 [
    66      (gogoproto.nullable) = false,
    67      (gogoproto.jsontag) = "checks"
    68    ];
    69    repeated EntityRef tenants = 2 [
    70      (gogoproto.nullable) = false,
    71      (gogoproto.jsontag) = "tenants"
    72    ];
    73  }
    74  
    75  // EntityRef represents a reference to an entity (check, tenant) by it's ID and last modification time.
    76  message EntityRef {
    77    int64 id = 1 [(gogoproto.jsontag) = "id"];
    78    double lastModified = 2 [(gogoproto.jsontag) = "lastModified"];
    79  }
    80  
    81  message ProbeInfo {
    82    string Version = 1 [(gogoproto.jsontag) = "version"]; // version of the probe
    83    string Commit = 2 [(gogoproto.jsontag) = "commit"]; // commit hash used to build the probe
    84    string Buildstamp = 3 [(gogoproto.jsontag) = "buildstamp"]; // timestamp when the probe was built
    85    bool supportsProtocolSecrets = 4 [(gogoproto.jsontag) = "supportsProtocolSecrets"]; // true when protocol secrets are supported in the Agent
    86  }
    87  
    88  // PingRequest is the message sent as argument of the Ping method.
    89  message PingRequest {
    90    int64 Sequence = 1 [(gogoproto.jsontag) = "sequence"]; // sequence number
    91  }
    92  
    93  // PongResponse is the message received as response from the Ping method.
    94  message PongResponse {
    95    int64 Sequence = 1 [(gogoproto.jsontag) = "sequence"]; // sequence number
    96  }
    97  
    98  // StatusCode represents the result of registering a probe with the API.
    99  enum StatusCode {
   100    OK = 0;
   101    NOT_FOUND = 1;
   102    INVALID_ARGUMENT = 2;
   103    ALREADY_EXISTS = 3;
   104    INTERNAL_ERROR = 4;
   105    NOT_AUTHORIZED = 5;
   106  }
   107  
   108  // Status represents the result of registering a probe with the API,
   109  // including both a code as well as textual message that can be
   110  // presented to the user.
   111  message Status {
   112    StatusCode code = 1;
   113    string message = 2;
   114  }
   115  
   116  // RegisterProbeResult is the message returned by the RegisterProbe
   117  // method of the Checks service. It provides both the status of the
   118  // operation and the probe's details after successful registration.
   119  message RegisterProbeResult {
   120    Probe probe = 1 [(gogoproto.nullable) = false];
   121    Status status = 2 [(gogoproto.nullable) = false];
   122  }
   123  
   124  // Probe represents a probe.
   125  message Probe {
   126    message Capabilities {
   127      bool disableScriptedChecks = 1 [(gogoproto.jsontag) = "disableScriptedChecks"]; // probe should not run scripted checks
   128      bool disableBrowserChecks = 2 [(gogoproto.jsontag) = "disableBrowserChecks"]; // probe should not run browser checks
   129      bool enableProtocolSecrets = 3 [(gogoproto.jsontag) = "enableProtocolSecrets"]; // true when protocol secrets are enabled in the API
   130    }
   131  
   132    int64 id = 1 [(gogoproto.jsontag) = "id"]; // ID of the probe, assigned by the API
   133    int64 tenantId = 2 [(gogoproto.jsontag) = "tenantId"]; // ID of the synthetic-monitoring tenant this probe belongs to
   134    string name = 3 [(gogoproto.jsontag) = "name"]; // name of the probe
   135    float latitude = 4 [(gogoproto.jsontag) = "latitude"]; // latitude of the probe
   136    float longitude = 5 [(gogoproto.jsontag) = "longitude"]; // longitude of the probe
   137    repeated Label labels = 6 [
   138      (gogoproto.nullable) = false,
   139      (gogoproto.jsontag) = "labels"
   140    ]; // probe-specific labels applied to all metrics and events
   141    string region = 7 [(gogoproto.jsontag) = "region"]; // region of the probe, such as AMER, EMEA, APAC
   142    bool public = 8 [(gogoproto.jsontag) = "public"]; // whether the probe is private or shared with all users
   143    bool online = 9 [(gogoproto.jsontag) = "online"]; // whether the probe is currently online
   144    double onlineChange = 10 [(gogoproto.jsontag) = "onlineChange"]; // time probe started or stopped being online
   145    string version = 11 [(gogoproto.jsontag) = "version"]; // version of the probe
   146    string commit = 12 [(gogoproto.jsontag) = "commit"]; // commit hash used to build the probe
   147    string buildstamp = 13 [(gogoproto.jsontag) = "buildstamp"]; // timestamp when the probe was built
   148    bool deprecated = 14 [(gogoproto.jsontag) = "deprecated"]; // whether the probe has been deprecated
   149    double created = 100 [(gogoproto.jsontag) = "created"]; // time the probe was created
   150    double modified = 101 [(gogoproto.jsontag) = "modified"]; // last time modified
   151    Capabilities capabilities = 102 [(gogoproto.jsontag) = "capabilities"]; // probe feature enablements
   152  }
   153  
   154  service Tenants {
   155    // GetTenant returns the details of the specified tenant
   156    rpc GetTenant(TenantInfo) returns (Tenant) {}
   157  }
   158  
   159  // TenantInfo identifies the tenant for which information is being
   160  // requeted via the GetTenant method of the Tenants service.
   161  message TenantInfo {
   162    int64 id = 1;
   163  }
   164  
   165  // TenantStatus represents the status associated to particular tenant.
   166  enum TenantStatus {
   167    ACTIVE = 0;
   168    DISABLED = 1;
   169  }
   170  
   171  // LabelMode controls how user-defined labels are written to metrics and logs.
   172  //
   173  // State machine:
   174  //   PREFIXED → DUAL_WRITE   irreversible; additive (existing queries still work)
   175  //   DUAL_WRITE ↔ UNPREFIXED reversible; finalize when all policies are migrated
   176  enum LabelMode {
   177    LABEL_MODE_PREFIXED   = 0;  // default — all user labels get the label_ prefix
   178    LABEL_MODE_DUAL_WRITE = 1;  // writes both label_foo and foo; entry is irreversible from PREFIXED
   179    LABEL_MODE_UNPREFIXED = 2;  // writes foo only; reserved names silently ignored; reversible to DUAL_WRITE
   180  }
   181  
   182  // TenantLimits specifies the limits for a tenant.
   183  message TenantLimits {
   184    int64 maxChecks = 1 [(gogoproto.jsontag) = "maxChecks"];
   185    int64 maxScriptedChecks = 2 [(gogoproto.jsontag) = "maxScriptedChecks"];
   186    int64 maxMetricLabels = 3 [(gogoproto.jsontag) = "maxMetricLabels"];
   187    int64 maxLogLabels = 4 [(gogoproto.jsontag) = "maxLogLabels"];
   188    int64 maxBrowserChecks = 5 [(gogoproto.jsontag) = "maxBrowserChecks"];
   189  }
   190  
   191  // SecretStore contains details for accessing the Grafana secret store
   192  message SecretStore {
   193    string url = 1 [(gogoproto.jsontag) = "url"]; // secret service URL
   194    string token = 2 [(gogoproto.jsontag) = "token"]; // secret service token
   195    double expiry = 3 [(gogoproto.jsontag) = "expiry"]; // unix timestamp when the secret store token expires
   196  }
   197  
   198  // Tenant represents a user of synthetic-monitoring.
   199  message Tenant {
   200    int64 id = 1 [(gogoproto.jsontag) = "id"]; // unique ID
   201    int64 orgId = 2 [(gogoproto.jsontag) = "orgId"]; // grafana.com orgId
   202    RemoteInfo metricsRemote = 3 [(gogoproto.jsontag) = "metricsRemote"]; // target to send metrics to
   203    RemoteInfo eventsRemote = 4 [(gogoproto.jsontag) = "eventsRemote"]; // target to send events to
   204    int64 stackId = 5 [(gogoproto.jsontag) = "stackId"]; // grafana.com stackId
   205    TenantStatus status = 6 [(gogoproto.jsontag) = "status"]; // tenant status
   206    string reason = 7 [(gogoproto.jsontag) = "reason"]; // reason provided for the status
   207    TenantLimits limits = 8 [(gogoproto.jsontag) = "limits"]; // check and label limits
   208  
   209    repeated string costAttributionLabels = 9 [(gogoproto.jsontag) = "costAttributionLabels"]; // list of cost attribution label keys that must be set on checks
   210  
   211    LabelMode label_mode = 10 [(gogoproto.jsontag) = "labelMode"]; // controls how user-defined labels are written to metrics and logs
   212  
   213    double created = 100 [(gogoproto.jsontag) = "created"]; // time the check was created
   214    double modified = 101 [(gogoproto.jsontag) = "modified"]; // last time modified
   215    SecretStore secretStore = 102 [(gogoproto.jsontag) = "secretStore"]; // secret store details
   216  }
   217  
   218  // RemoteInfo represents an instance of the Prometheus remote write
   219  // service to send metrics or events to.
   220  message RemoteInfo {
   221    string name = 1 [(gogoproto.jsontag) = "name"]; // instance name
   222    string url = 2 [(gogoproto.jsontag) = "url"]; // instance URL
   223    string username = 3 [(gogoproto.jsontag) = "username"]; // username (instanceId)
   224    string password = 4 [(gogoproto.jsontag) = "password"]; // password (publisher API key)
   225  }
   226  
   227  // CheckOperation represents an operation to be performed on a
   228  // particular check.
   229  enum CheckOperation {
   230    CHECK_ADD = 0;
   231    CHECK_UPDATE = 1;
   232    CHECK_DELETE = 2;
   233  }
   234  
   235  // CheckChange represents one change operation for a given check.
   236  message CheckChange {
   237    CheckOperation operation = 1;
   238    Check check = 2 [(gogoproto.nullable) = false];
   239  }
   240  
   241  // Changes represents a series of changes to be applied to the workloads
   242  // running on the probe.
   243  //
   244  // When a probe connects, it will get a sequence of changes describing
   245  // all the checks associated to that probe. After the initial batch, it
   246  // will continue getting changes as they happen.
   247  //
   248  // When a tenant's credentials change, this message will contain the new
   249  // information for that tenant.
   250  message Changes {
   251    repeated CheckChange checks = 1 [
   252      (gogoproto.nullable) = false,
   253      (gogoproto.jsontag) = "checks"
   254    ];
   255    repeated Tenant tenants = 2 [
   256      (gogoproto.nullable) = false,
   257      (gogoproto.jsontag) = "tenants"
   258    ];
   259  
   260    // This field is used to signal that the list of changes should be interpreted as a diff
   261    // against the existing changes in the probe. For backwards compatibility, this will be
   262    // false if the probe didn't send a list of known changes.
   263    bool isDeltaFirstBatch = 3 [(gogoproto.jsontag) = "isDeltaFirstBatch"];
   264  }
   265  
   266  message AdHocRequest {
   267    AdHocCheck adHocCheck = 1 [
   268      (gogoproto.nullable) = false,
   269      (gogoproto.jsontag) = "adHocCheck"
   270    ];
   271    Tenant tenant = 2 [
   272      (gogoproto.nullable) = true,
   273      (gogoproto.jsontag) = "tenant"
   274    ];
   275  }
   276  
   277  // Label represents a single label in synthetic monitoring. These are
   278  // applied to the resulting metrics and logs.
   279  message Label {
   280    string name = 1 [(gogoproto.jsontag) = "name"];
   281    string value = 2 [(gogoproto.jsontag) = "value"];
   282  }
   283  
   284  // CostAttributionLabel is similar to a label, but specifically for transmitting costAttributionLabels.
   285  // The initial use case for CAL's is such that they are effectively the same as labels.
   286  // Over time that will change, so we should treat them as separate messages to ensure they do not become tightly coupled.
   287  message CostAttributionLabel {
   288    string name = 1 [(gogoproto.jsontag) = "name"];
   289    string value = 2 [(gogoproto.jsontag) = "value"];
   290  }
   291  
   292  // Check represents a check.
   293  //
   294  // The "settings" field defines the type of check.
   295  message Check {
   296    int64 id = 1 [(gogoproto.jsontag) = "id"]; // unique ID
   297    int64 tenantId = 2 [(gogoproto.jsontag) = "tenantId"]; // synthetic-monitoring tenant
   298    int64 frequency = 3 [(gogoproto.jsontag) = "frequency"]; // every X milliseconds
   299    int64 offset = 4 [(gogoproto.jsontag) = "offset"]; // ??? REMOVE???? ??? why user configured?
   300    int64 timeout = 5 [(gogoproto.jsontag) = "timeout"]; // maximum time before aborting
   301    bool enabled = 6 [(gogoproto.jsontag) = "enabled"]; // user enable/disable
   302    repeated Label labels = 7 [
   303      (gogoproto.nullable) = false,
   304      (gogoproto.jsontag) = "labels"
   305    ]; // custom labels applied to all metrics and events (ie: production)
   306    CheckSettings settings = 8 [
   307      (gogoproto.nullable) = false,
   308      (gogoproto.jsontag) = "settings"
   309    ]; // check-specific settings
   310    repeated int64 probes = 9 [(gogoproto.jsontag) = "probes"]; // list of probes where this check should run
   311    string target = 10 [(gogoproto.jsontag) = "target"]; // endpoint that this check is targeting
   312    string job = 11 [(gogoproto.jsontag) = "job"]; // name of job this check belongs to
   313    bool basicMetricsOnly = 12 [(gogoproto.jsontag) = "basicMetricsOnly"]; // include only basic metrics
   314    string alertSensitivity = 13 [(gogoproto.jsontag) = "alertSensitivity"];
   315    Channels channels = 14 [(gogoproto.jsontag) = "channels"]; // channels this check is assigned to
   316    double created = 100 [(gogoproto.jsontag) = "created"]; // time the check was created
   317    double modified = 101 [(gogoproto.jsontag) = "modified"]; // last time modified
   318  }
   319  
   320  message AdHocCheck {
   321    string id = 1 [(gogoproto.jsontag) = "id"]; // unique ID
   322    int64 tenantId = 2 [(gogoproto.jsontag) = "tenantId"]; // synthetic-monitoring tenant
   323    int64 timeout = 3 [(gogoproto.jsontag) = "timeout"]; // maximum time before aborting
   324    CheckSettings settings = 4 [
   325      (gogoproto.nullable) = false,
   326      (gogoproto.jsontag) = "settings"
   327    ]; // check-specific settings
   328    repeated int64 probes = 5 [(gogoproto.jsontag) = "probes"]; // list of probes where this check should run
   329    string target = 6 [(gogoproto.jsontag) = "target"]; // endpoint that this check is targeting
   330    Channels channels = 7 [(gogoproto.jsontag) = "channels"]; // channels this check is assigned to
   331  }
   332  
   333  // CheckSettings provides the settings for exactly one type of check.
   334  message CheckSettings {
   335    option (gogoproto.onlyone) = true;
   336    PingSettings ping = 1 [(gogoproto.jsontag) = "ping,omitempty"];
   337    HttpSettings http = 2 [(gogoproto.jsontag) = "http,omitempty"];
   338    DnsSettings dns = 3 [(gogoproto.jsontag) = "dns,omitempty"];
   339    TcpSettings tcp = 4 [(gogoproto.jsontag) = "tcp,omitempty"];
   340    TracerouteSettings traceroute = 5 [(gogoproto.jsontag) = "traceroute,omitempty"];
   341    ScriptedSettings scripted = 6 [(gogoproto.jsontag) = "scripted,omitempty"]; // experimental
   342    MultiHttpSettings multihttp = 7 [(gogoproto.jsontag) = "multihttp,omitempty"]; // experimental
   343    GrpcSettings grpc = 8 [(gogoproto.jsontag) = "grpc,omitempty"]; // experimental
   344    BrowserSettings browser = 9 [(gogoproto.jsontag) = "browser,omitempty"]; // experimental
   345  }
   346  
   347  // PingSettings provides the settings for a ping check.
   348  message PingSettings {
   349    IpVersion ipVersion = 1 [(gogoproto.jsontag) = "ipVersion"]; // IP version used in the IP layer
   350    string sourceIpAddress = 2 [(gogoproto.jsontag) = "sourceIpAddress,omitempty"]; // source IP address for the packets
   351    int64 payloadSize = 3 [(gogoproto.jsontag) = "payloadSize,omitempty"]; // size of the ICMP packet's data portion
   352    bool dontFragment = 4 [(gogoproto.jsontag) = "dontFragment"]; // set the IP don't fragment option
   353  
   354    // custom settings not present in blackbox-exporter
   355  
   356    int64 packetCount = 900 [(gogoproto.jsontag) = "packetCount"]; // number of ping packets to send
   357  }
   358  
   359  // HttpMethod represents the HTTP method used when making HTTP requests.
   360  enum HttpMethod {
   361    GET = 0;
   362    CONNECT = 1;
   363    DELETE = 2;
   364    HEAD = 3;
   365    OPTIONS = 4;
   366    POST = 5;
   367    PUT = 6;
   368    TRACE = 7;
   369    PATCH = 8;
   370  }
   371  
   372  // HttpSettings provides the settings for a HTTP check.
   373  message HttpSettings {
   374    IpVersion ipVersion = 1 [(gogoproto.jsontag) = "ipVersion"];
   375    HttpMethod method = 2 [(gogoproto.jsontag) = "method"];
   376    repeated string headers = 3 [(gogoproto.jsontag) = "headers,omitempty"];
   377    string body = 4 [(gogoproto.jsontag) = "body,omitempty"];
   378    bool noFollowRedirects = 5 [(gogoproto.jsontag) = "noFollowRedirects"];
   379  
   380    // client config
   381  
   382    TLSConfig tlsConfig = 100 [(gogoproto.jsontag) = "tlsConfig,omitempty"];
   383    BasicAuth basicAuth = 101 [(gogoproto.jsontag) = "basicAuth,omitempty"];
   384    string bearerToken = 102 [(gogoproto.jsontag) = "bearerToken,omitempty"];
   385    string proxyURL = 103 [(gogoproto.jsontag) = "proxyURL,omitempty"];
   386    OAuth2Config oauth2Config = 104 [(gogoproto.jsontag) = "oauth2Config,omitempty"];
   387    repeated string proxyConnectHeaders = 105 [(gogoproto.jsontag) = "proxyConnectHeaders,omitempty"];
   388  
   389    // validations
   390  
   391    bool failIfSSL = 200 [(gogoproto.jsontag) = "failIfSSL"];
   392    bool failIfNotSSL = 201 [(gogoproto.jsontag) = "failIfNotSSL"];
   393    repeated int32 validStatusCodes = 202 [(gogoproto.jsontag) = "validStatusCodes,omitempty"];
   394    repeated string validHTTPVersions = 203 [(gogoproto.jsontag) = "validHTTPVersions,omitempty"];
   395    repeated string failIfBodyMatchesRegexp = 204 [(gogoproto.jsontag) = "failIfBodyMatchesRegexp,omitempty"];
   396    repeated string failIfBodyNotMatchesRegexp = 205 [(gogoproto.jsontag) = "failIfBodyNotMatchesRegexp,omitempty"];
   397    repeated HeaderMatch failIfHeaderMatchesRegexp = 206 [
   398      (gogoproto.nullable) = false,
   399      (gogoproto.jsontag) = "failIfHeaderMatchesRegexp,omitempty"
   400    ];
   401    repeated HeaderMatch failIfHeaderNotMatchesRegexp = 207 [
   402      (gogoproto.nullable) = false,
   403      (gogoproto.jsontag) = "failIfHeaderNotMatchesRegexp,omitempty"
   404    ];
   405    CompressionAlgorithm compression = 208 [(gogoproto.jsontag) = "compression,omitempty"];
   406  
   407    // custom settings not present in blackbox-exporter
   408  
   409    string cacheBustingQueryParamName = 900 [(gogoproto.jsontag) = "cacheBustingQueryParamName,omitempty"];
   410    bool secretManagerEnabled = 901 [(gogoproto.jsontag) = "secretManagerEnabled,omitempty"];
   411  }
   412  
   413  // Configuration for two-legged OAuth2 (client_credentials grant type).
   414  message OAuth2Config {
   415    string clientId = 1 [(gogoproto.jsontag) = "clientId"]; // (Required) client identifier
   416    string clientSecret = 2 [(gogoproto.jsontag) = "clientSecret"]; // (Required) client secret
   417    string tokenURL = 3 [(gogoproto.jsontag) = "tokenURL"]; // (Required) URL for the token endpoint
   418    repeated string scopes = 4 [(gogoproto.jsontag) = "scopes,omitempty"]; // Service-specific list of scopes
   419    repeated Label endpointParams = 5 [
   420      (gogoproto.nullable) = false,
   421      (gogoproto.jsontag) = "endpointParams,omitempty"
   422    ]; // Extra request parameters to use with token endpoint
   423    TLSConfig tlsConfig = 6 [(gogoproto.jsontag) = "tlsConfig,omitempty"];
   424    string proxyURL = 7 [(gogoproto.jsontag) = "proxyURL,omitempty"];
   425  }
   426  
   427  // HeaderMatch represents a single header that must match in order for
   428  // the check to be considered successful.
   429  message HeaderMatch {
   430    string header = 1 [(gogoproto.jsontag) = "header,omitempty"]; // the header to match
   431    string regexp = 2 [(gogoproto.jsontag) = "regexp,omitempty"]; // a regular expression to match against the header's value
   432    bool allowMissing = 3 [(gogoproto.jsontag) = "allowMissing,omitempty"]; // consider the match successful if the header is absent
   433  }
   434  
   435  // DnsRecordType represents the DNS record types to be queried in DNS
   436  // checks.
   437  enum DnsRecordType {
   438    ANY = 0;
   439    A = 1;
   440    AAAA = 2;
   441    CNAME = 3;
   442    MX = 4;
   443    NS = 5;
   444    PTR = 6;
   445    SOA = 7;
   446    SRV = 8;
   447    TXT = 9;
   448  }
   449  
   450  // DnsProtocol represents the IP protocol to use for DNS queries.
   451  enum DnsProtocol {
   452    TCP = 0;
   453    UDP = 1;
   454  }
   455  
   456  // DNSRRValidator represents the DNS resource record validations.
   457  message DNSRRValidator {
   458    repeated string failIfMatchesRegexp = 1 [(gogoproto.jsontag) = "failIfMatchesRegexp,omitempty"];
   459    repeated string failIfNotMatchesRegexp = 2 [(gogoproto.jsontag) = "failIfNotMatchesRegexp,omitempty"];
   460  }
   461  
   462  // DnsSettings provides the settings for a DNS check.
   463  //
   464  // The way blackbox-exporter works, a DNS check tests a _server_, so the
   465  // _target_ of the check is a server address, and the check itself
   466  // contains the record to check.
   467  //
   468  // "ipVersion" is the IP version to use in the IP layer.
   469  message DnsSettings {
   470    IpVersion ipVersion = 1 [(gogoproto.jsontag) = "ipVersion"];
   471    string sourceIpAddress = 2 [(gogoproto.jsontag) = "sourceIpAddress,omitempty"];
   472    string server = 3 [(gogoproto.jsontag) = "server"];
   473    int32 port = 4 [(gogoproto.jsontag) = "port"];
   474    DnsRecordType recordType = 5 [(gogoproto.jsontag) = "recordType"];
   475    DnsProtocol protocol = 6 [(gogoproto.jsontag) = "protocol"];
   476  
   477    // validations
   478  
   479    repeated string validRCodes = 200 [(gogoproto.jsontag) = "validRCodes,omitempty"];
   480    DNSRRValidator validateAnswer = 201 [(gogoproto.jsontag) = "validateAnswerRRS,omitempty"];
   481    DNSRRValidator validateAuthority = 202 [(gogoproto.jsontag) = "validateAuthorityRRS,omitempty"];
   482    DNSRRValidator validateAdditional = 203 [(gogoproto.jsontag) = "validateAdditionalRRS,omitempty"];
   483  }
   484  
   485  // TcpSettings provides the settings for a TCP check.
   486  //
   487  // "ipVersion" is the IP version to use in the IP layer.
   488  message TcpSettings {
   489    IpVersion ipVersion = 1 [(gogoproto.jsontag) = "ipVersion"];
   490    string sourceIpAddress = 2 [(gogoproto.jsontag) = "sourceIpAddress,omitempty"];
   491    bool tls = 3 [(gogoproto.jsontag) = "tls,omitempty"];
   492    TLSConfig tlsConfig = 4 [(gogoproto.jsontag) = "tlsConfig,omitempty"];
   493    repeated TCPQueryResponse queryResponse = 5 [
   494      (gogoproto.jsontag) = "queryResponse,omitempty",
   495      (gogoproto.nullable) = false
   496    ];
   497  }
   498  
   499  // TCPQueryResponse represents a single step in a sequence of
   500  // send/expect pairs to be used when connecting to a generic TCP
   501  // service.
   502  message TCPQueryResponse {
   503    bytes send = 1 [(gogoproto.jsontag) = "send"];
   504    bytes expect = 2 [(gogoproto.jsontag) = "expect"];
   505    bool startTLS = 3 [(gogoproto.jsontag) = "startTLS,omitempty"];
   506  }
   507  
   508  // IpVersion represents the version of the IP protocol to be used in
   509  // checks.
   510  enum IpVersion {
   511    Any = 0; // use IPv6 if supported and fall back to IPv4 otherwise
   512    V4 = 1; // use IPv4 only
   513    V6 = 2; // use IPv6 only
   514  }
   515  
   516  // CompressionAlgorithm represents the compression algorithm to use.
   517  enum CompressionAlgorithm {
   518    none = 0; // no compression algorithm
   519    identity = 1; // no compression, passthru
   520    gzip = 2; // gzip
   521    br = 3; // br, brotli
   522    deflate = 4; // deflate
   523  }
   524  
   525  // TLSConfig represents the TLS data to be used when establishing a
   526  // secure connection in the protocols that support it.
   527  message TLSConfig {
   528    bool insecureSkipVerify = 1 [(gogoproto.jsontag) = "insecureSkipVerify,omitempty"];
   529    bytes CACert = 2 [(gogoproto.jsontag) = "caCert,omitempty"];
   530    bytes clientCert = 3 [(gogoproto.jsontag) = "clientCert,omitempty"];
   531    bytes clientKey = 4 [(gogoproto.jsontag) = "clientKey,omitempty"];
   532    string serverName = 5 [(gogoproto.jsontag) = "serverName,omitempty"];
   533  }
   534  
   535  // BasicAuth represents the basic authentication credentials to be used
   536  // when talking to HTTP servers.
   537  message BasicAuth {
   538    string username = 1 [(gogoproto.jsontag) = "username,omitempty"];
   539    string password = 2 [(gogoproto.jsontag) = "password,omitempty"];
   540  }
   541  
   542  message TracerouteSettings {
   543    int64 maxHops = 1 [(gogoproto.jsontag) = "maxHops"]; // Maximimum hops to make in a traceroute before exiting
   544    int64 maxUnknownHops = 2 [(gogoproto.jsontag) = "maxUnknownHops"]; // Maximum hops probe that give no response before giving up
   545    bool ptrLookup = 3 [(gogoproto.jsontag) = "ptrLookup"]; // Include reverse DNS lookup
   546    int64 hopTimeout = 4 [(gogoproto.jsontag) = "hopTimeout"]; // Timeout for individual hop pings
   547  }
   548  
   549  message ScriptedSettings {
   550    bytes script = 1 [(gogoproto.jsontag) = "script"];
   551  }
   552  
   553  // MultiHttpSettings represents the settings for the MultiHttp check type.
   554  message MultiHttpSettings {
   555    repeated MultiHttpEntry entries = 1 [(gogoproto.jsontag) = "entries"]; // One or more entries in the MultiHttp check
   556    bool logResponses = 2 [(gogoproto.jsontag) = "logResponseBodies,omitempty"]; // Whether to log the response bodies in the output.
   557  }
   558  
   559  // MultiHttpEntry represents a single entry in a MultiHttp check.
   560  message MultiHttpEntry {
   561    MultiHttpEntryRequest request = 1 [(gogoproto.jsontag) = "request,omitempty"]; // The request parameters.
   562    repeated MultiHttpEntryAssertion assertions = 2 [(gogoproto.jsontag) = "checks,omitempty"]; // Zero or more assertions to be made on the response.
   563    repeated MultiHttpEntryVariable variables = 3 [(gogoproto.jsontag) = "variables,omitempty"]; // Zero or more variables to be used in the request.
   564  }
   565  
   566  // HttpHeader represents a single HTTP header key-value pair.
   567  message HttpHeader {
   568    string name = 1 [(gogoproto.jsontag) = "name"]; // The name.
   569    string value = 2 [(gogoproto.jsontag) = "value"]; // The value.
   570  }
   571  
   572  // QueryField represents a single query field key-value pair.
   573  message QueryField {
   574    string name = 1 [(gogoproto.jsontag) = "name"]; // The name.
   575    string value = 2 [(gogoproto.jsontag) = "value"]; // The value.
   576  }
   577  
   578  // MultiHttpEntryRequest contains the settings for a single request in a MultiHttp check.
   579  message MultiHttpEntryRequest {
   580    HttpMethod method = 1 [(gogoproto.jsontag) = "method"]; // The HTTP method to use.
   581    string url = 2 [(gogoproto.jsontag) = "url"]; // The URL for the request.
   582    repeated HttpHeader headers = 3 [(gogoproto.jsontag) = "headers,omitempty"]; // Zero or more headers to be sent with the request.
   583    repeated QueryField queryFields = 4 [(gogoproto.jsontag) = "queryFields,omitempty"]; // Zero or more query fields to be sent with the request.
   584    HttpRequestBody body = 5 [(gogoproto.jsontag) = "body,omitempty"]; // The request body.
   585    // TODO(mem): we could add the HTTP version here, but that's an assertion,
   586    // there doesn't seem to be a way in k6 to specify which protocol to use
   587    // (even if the underlying Go library supports it).
   588  }
   589  
   590  // HttpRequestBody represents the body of an HTTP request.
   591  message HttpRequestBody {
   592    string contentType = 1 [(gogoproto.jsontag) = "contentType"]; // The content-type of the body.
   593    string contentEncoding = 2 [(gogoproto.jsontag) = "contentEncoding,omitempty"]; // The content-encoding of the body.
   594    bytes payload = 3 [(gogoproto.jsontag) = "payload"]; // The payload of the body.
   595  }
   596  
   597  // MultiHttpEntryAssertionType represents the type of assertion to be made.
   598  enum MultiHttpEntryAssertionType {
   599    TEXT = 0;
   600    JSON_PATH_VALUE = 1;
   601    JSON_PATH_ASSERTION = 2;
   602    REGEX_ASSERTION = 3;
   603    option (gogoproto.goproto_enum_stringer) = false;
   604  }
   605  
   606  // MultiHttpEntryAssertionSubjectVariant represents the subject of the assertion.
   607  enum MultiHttpEntryAssertionSubjectVariant {
   608    DEFAULT_SUBJECT = 0;
   609    RESPONSE_HEADERS = 1;
   610    HTTP_STATUS_CODE = 2;
   611    RESPONSE_BODY = 3;
   612    option (gogoproto.goproto_enum_stringer) = false;
   613  }
   614  
   615  // MultiHttpEntryAssertionConditionVariant represents the condition between the assertion's expression and value.
   616  enum MultiHttpEntryAssertionConditionVariant {
   617    DEFAULT_CONDITION = 0;
   618    NOT_CONTAINS = 1;
   619    EQUALS = 2;
   620    STARTS_WITH = 3;
   621    ENDS_WITH = 4;
   622    TYPE_OF = 5;
   623    CONTAINS = 6;
   624    option (gogoproto.goproto_enum_stringer) = false;
   625  }
   626  
   627  // MultiHttpEntryAssertion represents a single assertion to be made on the response.
   628  //
   629  // The `value` field specifies the _value_ that the subject and the condition
   630  // should meet, e.g. if the subject is body and the condition is contains,
   631  // value specifies the substring that should be found in the body.
   632  //
   633  // For the JSON_PATH_VALUE type, `expression` specifies the JSON path to match against `value`.
   634  //
   635  // For the JSON_PATH_ASSERTION type, `expression` specifies the JSON path to assert.
   636  //
   637  // For the TEXT type, if the subject is `RESPONSE_HEADERS`, `expression`
   638  // specifies which specific header should be used as the subject of the
   639  // operation. Headers are case-insensitive (RFC 7230, section 3.2,
   640  // https://datatracker.ietf.org/doc/html/rfc7230#section-3.2).
   641  message MultiHttpEntryAssertion {
   642    MultiHttpEntryAssertionType type = 1 [(gogoproto.jsontag) = "type"];
   643    MultiHttpEntryAssertionSubjectVariant subject = 2 [(gogoproto.jsontag) = "subject,omitempty"];
   644    MultiHttpEntryAssertionConditionVariant condition = 3 [(gogoproto.jsontag) = "condition,omitempty"];
   645    string expression = 4 [(gogoproto.jsontag) = "expression,omitempty"];
   646    string value = 5 [(gogoproto.jsontag) = "value,omitempty"];
   647  }
   648  
   649  // MultiHttpEntryVariableType represents the type of expression used to populate the variable.
   650  enum MultiHttpEntryVariableType {
   651    JSON_PATH = 0;
   652    REGEX = 1;
   653    CSS_SELECTOR = 2;
   654    option (gogoproto.goproto_enum_stringer) = false;
   655  }
   656  
   657  // MultiHttpEntryVariable represents a single variable to be used in the request.
   658  message MultiHttpEntryVariable {
   659    MultiHttpEntryVariableType type = 1 [(gogoproto.jsontag) = "type"];
   660    string name = 2 [(gogoproto.jsontag) = "name,omitempty"];
   661    string expression = 3 [(gogoproto.jsontag) = "expression,omitempty"];
   662    string attribute = 4 [(gogoproto.jsontag) = "attribute,omitempty"];
   663  }
   664  
   665  // GrpcSettings provides the settings for a gRPC check.
   666  message GrpcSettings {
   667    IpVersion ipVersion = 1 [(gogoproto.jsontag) = "ipVersion"];
   668    string service = 2 [(gogoproto.jsontag) = "service,omitempty"];
   669    bool tls = 3 [(gogoproto.jsontag) = "tls,omitempty"];
   670    TLSConfig tlsConfig = 4 [(gogoproto.jsontag) = "tlsConfig,omitempty"];
   671  }
   672  
   673  // BrowserSettings provides the settings for a browser check.
   674  message BrowserSettings {
   675    bytes script = 1 [(gogoproto.jsontag) = "script"];
   676  }
   677  
   678  // Channels represents the channels a check is assigned to.
   679  message Channels {
   680    K6Channel k6 = 1 [(gogoproto.jsontag) = "k6"];
   681  }
   682  
   683  // K6Channel represents the k6 channel a check is assigned to.
   684  message K6Channel {
   685    string id = 1 [(gogoproto.jsontag) = "id"];
   686    string manifest = 2 [(gogoproto.jsontag) = "manifest"];
   687  }
   688  
   689  service Telemetry {
   690    // PushTelemetry pushes telemetry data for all the tenants that are running
   691    // checks in the agent which belong to the same region.
   692    rpc PushTelemetry(RegionTelemetry) returns (PushTelemetryResponse) {}
   693  }
   694  
   695  // CheckClass represents the supported check classes.
   696  enum CheckClass {
   697    PROTOCOL = 0;
   698    SCRIPTED = 1;
   699    BROWSER = 2;
   700  }
   701  
   702  // RegionTelemetry represents the telemetry data for a specific region.
   703  // Groups the telemetry data for all the tenants that have checks being
   704  // executed in the agent and belong to the same region.
   705  message RegionTelemetry {
   706    string instance = 1 [(gogoproto.jsontag) = "instance"]; // Identifies the agent instance
   707    int32 regionId = 2 [(gogoproto.jsontag) = "regionId"];
   708    repeated TenantTelemetry telemetry = 3 [(gogoproto.jsontag) = "telemetry"];
   709  }
   710  
   711  // TenantTelemetry represents the telemetry data for a specific tenant.
   712  message TenantTelemetry {
   713    int64 tenantId = 1 [(gogoproto.jsontag) = "tenantId"]; // Local tenant ID
   714    repeated CheckClassTelemetry telemetry = 2 [(gogoproto.jsontag) = "telemetry"];
   715  }
   716  
   717  // CheckClassTelemetry represents the telemetry data for a specific check class.
   718  message CheckClassTelemetry {
   719    CheckClass checkClass = 1 [(gogoproto.jsontag) = "checkClass"];
   720    int32 executions = 2 [(gogoproto.jsontag) = "executions"];
   721    float duration = 3 [(gogoproto.jsontag) = "duration"];
   722    int32 sampledExecutions = 4 [(gogoproto.jsontag) = "sampledExecutions"];
   723    repeated CostAttributionLabel costAttributionLabels = 5 [
   724      (gogoproto.nullable) = false,
   725      (gogoproto.jsontag) = "costAttributionLabels"
   726    ];
   727  }
   728  
   729  // PushTelemetryResponse represents a response for a push telemetry rpc call.
   730  message PushTelemetryResponse {
   731    Status status = 1 [(gogoproto.jsontag) = "status"];
   732  }
   733  
   734  // K6 service represents a service that allows the probes to report information
   735  // on supported k6 versions.
   736  service K6 {
   737    // RegisterK6Version registers the k6 versions supported by the probe.
   738    rpc RegisterK6Version(RegisterK6VersionRequest) returns (RegisterK6VersionResponse) {}
   739  }
   740  
   741  // K6Version represents a specific k6 version supported by a probe.
   742  message K6Version {
   743    string version = 1 [(gogoproto.jsontag) = "version"]; // semantic version 2.0.0 string (e.g. 0.50.0)
   744  }
   745  
   746  message RegisterK6VersionRequest {
   747    repeated K6Version versions = 1 [
   748      (gogoproto.nullable) = false,
   749      (gogoproto.jsontag) = "versions"
   750    ];
   751  }
   752  
   753  message RegisterK6VersionResponse {
   754    Status status = 1 [
   755      (gogoproto.nullable) = false,
   756      (gogoproto.jsontag) = "status"
   757    ];
   758  }