aboutsummaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/dimensions/PublicDimensions.java
blob: 4cbf5adc6cc66add50a6da025dfe13180e958a25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.metric.dimensions;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * The names of all dimensions that are publicly available, in addition to some dimensions that
 * are used in the process of composing these public dimensions.
 *
 * 'INTERNAL' in this context means non-public.
 *
 * @author gjoranv
 */
public final class PublicDimensions {
    private PublicDimensions() { }

    public static final String APPLICATION_ID = "applicationId";  // <tenant.app.instance>
    public static final String ZONE = "zone";

    // The public CLUSTER_ID dimension value is composed from the two non-public dimensions.
    // Node-specific.
    public static final String INTERNAL_CLUSTER_TYPE = "clustertype";
    public static final String INTERNAL_CLUSTER_ID = "clusterid";
    public static final String CLUSTER_ID = "clusterId";
    public static final String DEPLOYMENT_CLUSTER = "deploymentCluster";

    // This dimension is not currently (March 2021) added to the 'commonDimensions' allow-list below, due to the
    // limit of 10 total dimensions in public http apis. See e.g. MetricsV2Handler#MAX_DIMENSIONS.
    public static final String GROUP_ID = "groupId";

    // Internal name (instance) is confusing, so renamed to 'serviceId' for public use.
    // This is added by the metrics-proxy.
    public static final String INTERNAL_SERVICE_ID = "instance";
    public static final String SERVICE_ID = "serviceId";

    // From host-admin, currently (Jan 2020) only included for 'vespa.node' metrics
    public static final String HOSTNAME = "host";


    /**  Metric specific dimensions  **/
    public static final String API = "api";                                 // feed
    public static final String CHAIN = "chain";                             // query
    public static final String DOCUMENT_TYPE = "documenttype";              // content
    public static final String ENDPOINT = "endpoint";                       // query
    public static final String GC_NAME = "gcName";                          // container
    public static final String HTTP_METHOD = "httpMethod";                  // container
    public static final String OPERATION = "operation";                     // feed
    public static final String RANK_PROFILE = "rankProfile";                // content
    public static final String REASON = "reason";                           // query (degraded etc.)
    public static final String STATUS = "status";                           // feed
    public static final String THREADPOOL = "threadpool";                   // container
    private static final String LOGLEVEL = "loglevel";                      // log line metrics
    private static final String SERVICE = "service";                        // log line metrics
    private static final String CHAIN_ID = "chainId";                       // container
    private static final String REQUEST_SERVER_NAME = "requestServerName";  // container
    public static final String HANDLER_NAME = "handler-name";               // container
    public static final String FIELD = "field";                             // content


    // Dimensions that are valid (but not necessarily used) for all metrics.
    public static List<String> commonDimensions =
            List.of(APPLICATION_ID,
                    CLUSTER_ID,
                    HOSTNAME,
                    SERVICE_ID,
                    ZONE);

    // Dimensions that are only used for a subset of metrics.
    public static List<String> metricDimensions =
        List.of(API,
                CHAIN,
                DOCUMENT_TYPE,
                ENDPOINT,
                GC_NAME,
                HTTP_METHOD,
                OPERATION,
                RANK_PROFILE,
                REASON,
                STATUS,
                THREADPOOL,
                LOGLEVEL,
                SERVICE,
                CHAIN_ID,
                REQUEST_SERVER_NAME,
                HANDLER_NAME);


    /**
     * All public dimensions, common dimensions first, then dimensions for individual metrics
     */
    public static final List<String> publicDimensions = Stream.concat(commonDimensions.stream(), metricDimensions.stream())
            .toList();

}