Skip to content

Commit

Permalink
fix: switch protoc IPATH order (#227)
Browse files Browse the repository at this point in the history
* add monitoring proto

* fix:Switch protoc IPath Order

Problem Descirpt:
monitoring protos are both under common library google-gax and googleapis, protoc confuse which file to pick.

* Switch order of proto path to form a protoc command in start_script.sh

* Add unit test for monitoring library

* fix the linter

* fix: updated linkinator config

* fix: delete BUILD.bazel

* fix: delete alert.proto

* fix: delete alert_service.proto

* fix: delete artman yaml

* fix: delete notification_service.proto

* fix: delete common.proto

* fix: delete dropped_labels.proto

* fix: delete group.proto

* fix: delete group_service.proto

* fix: delete metric.proto

* fix: delete metric_service.proto

* fix: delete monitoring.yaml

* fix: delete monitoring_gapic.yaml

* fix: delete monitoring_grpc_service_config.json

* fix: delete mutation_record.proto

* fix: delete notification.proto

Co-authored-by: Alexander Fenster <github@fenster.name>
  • Loading branch information
summer-ji-eng and alexander-fenster committed Feb 5, 2020
1 parent e99f416 commit abff60f
Show file tree
Hide file tree
Showing 21 changed files with 1,816 additions and 1 deletion.
2 changes: 1 addition & 1 deletion typescript/src/start_script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const commonProtoPath = argv.commonProtoPath || GOOGLE_GAX_PROTOS_DIR;
// run protoc command to generate client library
const cliPath = path.join(__dirname, 'cli.js');
const protocCommand = [
`-I${commonProtoPath}`,
`--plugin=protoc-gen-typescript_gapic=${cliPath}`,
`--typescript_gapic_out=${outputDir}`,
];
Expand All @@ -89,6 +88,7 @@ if (mainServiceName) {
}
protocCommand.push(...protoDirsArg);
protocCommand.push(...protoFiles);
protocCommand.push(`-I${commonProtoPath}`);
try {
execFileSync(`protoc`, protocCommand, { stdio: 'inherit' });
} catch (err) {
Expand Down
397 changes: 397 additions & 0 deletions typescript/test/protos/google/monitoring/v3/service.proto

Large diffs are not rendered by default.

337 changes: 337 additions & 0 deletions typescript/test/protos/google/monitoring/v3/service_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.monitoring.v3;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/service.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
option java_multiple_files = true;
option java_outer_classname = "ServiceMonitoringServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";

// The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
// managing and querying aspects of a workspace's services. These include the
// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
// of categorized Health Metrics.
service ServiceMonitoringService {
option (google.api.default_host) = "monitoring.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/monitoring,"
"https://www.googleapis.com/auth/monitoring.read";

// Create a `Service`.
rpc CreateService(CreateServiceRequest) returns (Service) {
option (google.api.http) = {
post: "/v3/{parent=*/*}/services"
body: "service"
};
option (google.api.method_signature) = "parent,service";
}

// Get the named `Service`.
rpc GetService(GetServiceRequest) returns (Service) {
option (google.api.http) = {
get: "/v3/{name=*/*/services/*}"
};
option (google.api.method_signature) = "name";
}

// List `Service`s for this workspace.
rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
option (google.api.http) = {
get: "/v3/{parent=*/*}/services"
};
option (google.api.method_signature) = "parent";
}

// Update this `Service`.
rpc UpdateService(UpdateServiceRequest) returns (Service) {
option (google.api.http) = {
patch: "/v3/{service.name=*/*/services/*}"
body: "service"
};
option (google.api.method_signature) = "service";
}

// Soft delete this `Service`.
rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=*/*/services/*}"
};
option (google.api.method_signature) = "name";
}

// Create a `ServiceLevelObjective` for the given `Service`.
rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
body: "service_level_objective"
};
option (google.api.method_signature) = "parent,service_level_objective";
}

// Get a `ServiceLevelObjective` by name.
rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
};
option (google.api.method_signature) = "name";
}

// List the `ServiceLevelObjective`s for the given `Service`.
rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) {
option (google.api.http) = {
get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives"
};
option (google.api.method_signature) = "parent";
}

// Update the given `ServiceLevelObjective`.
rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) {
option (google.api.http) = {
patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}"
body: "service_level_objective"
};
option (google.api.method_signature) = "service_level_objective";
}

// Delete the given `ServiceLevelObjective`.
rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}"
};
option (google.api.method_signature) = "name";
}
}

// The `CreateService` request.
message CreateServiceRequest {
// Required. Resource name of the parent workspace.
// Of the form `projects/{project_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Service"
}
];

// Optional. The Service id to use for this Service. If omitted, an id will be
// generated instead. Must match the pattern [a-z0-9\-]+
string service_id = 3;

// Required. The `Service` to create.
Service service = 2 [(google.api.field_behavior) = REQUIRED];
}

// The `GetService` request.
message GetServiceRequest {
// Required. Resource name of the `Service`.
// Of the form `projects/{project_id}/services/{service_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
}

// The `ListServices` request.
message ListServicesRequest {
// Required. Resource name of the parent `Workspace`.
// Of the form `projects/{project_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "monitoring.googleapis.com/Service"
}
];

// A filter specifying what `Service`s to return. The filter currently
// supports the following fields:
//
// - `identifier_case`
// - `app_engine.module_id`
// - `cloud_endpoints.service`
// - `cluster_istio.location`
// - `cluster_istio.cluster_name`
// - `cluster_istio.service_namespace`
// - `cluster_istio.service_name`
//
// `identifier_case` refers to which option in the identifier oneof is
// populated. For example, the filter `identifier_case = "CUSTOM"` would match
// all services with a value for the `custom` field. Valid options are
// "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO".
string filter = 2;

// A non-negative number that is the maximum number of results to return.
// When 0, use default page size.
int32 page_size = 3;

// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;
}

// The `ListServices` response.
message ListServicesResponse {
// The `Service`s matching the specified filter.
repeated Service services = 1;

// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `pageToken` in the next call to this method.
string next_page_token = 2;
}

// The `UpdateService` request.
message UpdateServiceRequest {
// Required. The `Service` to draw updates from.
// The given `name` specifies the resource to update.
Service service = 1 [(google.api.field_behavior) = REQUIRED];

// A set of field paths defining which fields to use for the update.
google.protobuf.FieldMask update_mask = 2;
}

// The `DeleteService` request.
message DeleteServiceRequest {
// Required. Resource name of the `Service` to delete.
// Of the form `projects/{project_id}/services/{service_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];
}

// The `CreateServiceLevelObjective` request.
message CreateServiceLevelObjectiveRequest {
// Required. Resource name of the parent `Service`.
// Of the form `projects/{project_id}/services/{service_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];

// Optional. The ServiceLevelObjective id to use for this
// ServiceLevelObjective. If omitted, an id will be generated instead. Must
// match the pattern [a-z0-9\-]+
string service_level_objective_id = 3;

// Required. The `ServiceLevelObjective` to create.
// The provided `name` will be respected if no `ServiceLevelObjective` exists
// with this name.
ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED];
}

// The `GetServiceLevelObjective` request.
message GetServiceLevelObjectiveRequest {
// Required. Resource name of the `ServiceLevelObjective` to get.
// Of the form
// `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/ServiceLevelObjective"
}
];

// View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
ServiceLevelObjective.View view = 2;
}

// The `ListServiceLevelObjectives` request.
message ListServiceLevelObjectivesRequest {
// Required. Resource name of the parent `Service`.
// Of the form `projects/{project_id}/services/{service_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/Service"
}
];

// A filter specifying what `ServiceLevelObjective`s to return.
string filter = 2;

// A non-negative number that is the maximum number of results to return.
// When 0, use default page size.
int32 page_size = 3;

// If this field is not empty then it must contain the `nextPageToken` value
// returned by a previous call to this method. Using this field causes the
// method to return additional results from the previous method call.
string page_token = 4;

// View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
ServiceLevelObjective.View view = 5;
}

// The `ListServiceLevelObjectives` response.
message ListServiceLevelObjectivesResponse {
// The `ServiceLevelObjective`s matching the specified filter.
repeated ServiceLevelObjective service_level_objectives = 1;

// If there are more results than have been returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `pageToken` in the next call to this method.
string next_page_token = 2;
}

// The `UpdateServiceLevelObjective` request.
message UpdateServiceLevelObjectiveRequest {
// Required. The `ServiceLevelObjective` to draw updates from.
// The given `name` specifies the resource to update.
ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED];

// A set of field paths defining which fields to use for the update.
google.protobuf.FieldMask update_mask = 2;
}

// The `DeleteServiceLevelObjective` request.
message DeleteServiceLevelObjectiveRequest {
// Required. Resource name of the `ServiceLevelObjective` to delete.
// Of the form
// `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "monitoring.googleapis.com/ServiceLevelObjective"
}
];
}
43 changes: 43 additions & 0 deletions typescript/test/protos/google/monitoring/v3/span_context.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.monitoring.v3;

option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
option java_multiple_files = true;
option java_outer_classname = "SpanContextProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";

// The context of a span, attached to google.api.Distribution.Exemplars
// in google.api.Distribution values during aggregation.
//
// It contains the name of a span with format:
// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
message SpanContext {
// The resource name of the span in the following format:
//
// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
//
// [TRACE_ID] is a unique identifier for a trace within a project;
// it is a 32-character hexadecimal encoding of a 16-byte array.
//
// [SPAN_ID] is a unique identifier for a span within a trace; it
// is a 16-character hexadecimal encoding of an 8-byte array.
string span_name = 1;
}

0 comments on commit abff60f

Please sign in to comment.