Skip to content

Commit 3409a6f

Browse files
committed
Merge branch 'main' into ece/add-checks-get-timeseries
2 parents b56a04d + 08288ff commit 3409a6f

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

tools/get_attribute_values.go

+15-18
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import (
1111
)
1212

1313
type GetAttributeValuesHandlerArgs struct {
14-
Type model.MetricType `json:"type" jsonschema:"required,description=The type of telemetry data to get the attribute keys and values for. Either 'logs' or 'trace' or 'metric'."`
15-
TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to use while getting the possible values of log attributes. e.g. if you want to get values for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"`
16-
Attribute string `json:"attribute" jsonschema:"required,description=The attribute key to get the possible values for. Possible values for attribute should be obtained from get_attribute_keys tool call for the same type"`
17-
MetricName string `json:"metricName" jsonschema:"description=REQUIRED IF THE TYPE IS 'metric'. The name of the metric to get the possible attribute keys and values."`
18-
Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply before getting the possible values. For example if you want to get the possible values for attribute key service.name where the environment is X you would set the Filters as {environment: [X]}"`
19-
ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate possible values an attribute can take. Log attributes matching the exclude filters will not be returned. For example if you want the possible values for attribute key service.name where the attribute environment is not X then you would set the ExcludeFilters as {environment: [X]}"`
14+
Type model.MetricType `json:"type" jsonschema:"required,description=The type of telemetry data to get the attribute keys and values for. Either 'logs' or 'trace' or 'metric' or 'kubernetes_resource'"`
15+
TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to use while getting the possible values of log attributes. e.g. if you want to get values for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"`
16+
Attribute string `json:"attribute" jsonschema:"required,description=The attribute key to get the possible values for. Possible values for attribute should be obtained from get_attribute_keys tool call for the same type"`
17+
MetricName string `json:"metricName" jsonschema:"description=REQUIRED IF THE TYPE IS 'metric'. The name of the metric to get the possible attribute keys and values."`
18+
Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply before getting the possible values. For example if you want to get the possible values for an attribute key where the environment is X you would set the Filters as {environment: [X]}"`
2019
}
2120

2221
func GetAttributeValuesHandler(ctx context.Context, arguments GetAttributeValuesHandlerArgs) (*mcpgolang.ToolResponse, error) {
@@ -25,7 +24,7 @@ func GetAttributeValuesHandler(ctx context.Context, arguments GetAttributeValues
2524
return nil, fmt.Errorf("error calculating time range: %v", err)
2625
}
2726

28-
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, arguments.ExcludeFilters, []string{}, nil)
27+
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, map[string][]string{}, []string{}, nil)
2928
if err != nil {
3029
return nil, err
3130
}
@@ -37,33 +36,31 @@ func GetAttributeValuesHandler(ctx context.Context, arguments GetAttributeValues
3736

3837
switch arguments.Type {
3938
case model.Logs:
40-
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, arguments.ExcludeFilters, []string{}, nil)
39+
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, map[string][]string{}, []string{}, nil)
4140
if err != nil {
4241
return nil, err
4342
}
4443
modelRequest := model.LogSummaryRequest{
45-
StartTime: startTime,
46-
EndTime: endTime,
47-
Filters: arguments.Filters,
48-
ExcludeFilters: arguments.ExcludeFilters,
44+
StartTime: startTime,
45+
EndTime: endTime,
46+
Filters: arguments.Filters,
4947
}
5048
request.Logs = &modelRequest
5149
break
5250
case model.Trace:
53-
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, arguments.ExcludeFilters, []string{}, nil)
51+
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, map[string][]string{}, []string{}, nil)
5452
if err != nil {
5553
return nil, err
5654
}
5755
modelRequest := model.TracesSummaryRequest{
58-
StartTime: startTime,
59-
EndTime: endTime,
60-
Filters: arguments.Filters,
61-
ExcludeFilters: arguments.ExcludeFilters,
56+
StartTime: startTime,
57+
EndTime: endTime,
58+
Filters: arguments.Filters,
6259
}
6360
request.Trace = &modelRequest
6461
break
6562
case model.Metric:
66-
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, arguments.ExcludeFilters, []string{}, &model.GetMetricAttributesRequest{
63+
err = CheckAttributes(ctx, arguments.Type, arguments.Filters, map[string][]string{}, []string{}, &model.GetMetricAttributesRequest{
6764
StartTime: startTime,
6865
EndTime: endTime,
6966
MetricName: arguments.MetricName,

tools/get_traces.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ func GetTracesHandler(ctx context.Context, arguments GetTracesHandlerArgs) (*mcp
2929
}
3030

3131
request := model.GetTracesRequest{
32-
StartTime: startTime,
33-
EndTime: endTime,
34-
Filters: arguments.Filters,
35-
ExcludeFilters: arguments.ExcludeFilters,
32+
StartTime: startTime,
33+
EndTime: endTime,
34+
Filters: arguments.Filters,
3635
}
3736

3837
body, err := getTracesMetoroCall(ctx, request)

0 commit comments

Comments
 (0)