Skip to content

Commit

Permalink
Enable destination_project_quota for logs exporter (#579)
Browse files Browse the repository at this point in the history
* Add destinationProjectQuota for logs exporter

* Add fixture for logs destination_project_quota

* Update readme

* Use empty string for map key when disabled
  • Loading branch information
damemi committed Feb 3, 2023
1 parent e169468 commit 6445f66
Show file tree
Hide file tree
Showing 4 changed files with 838 additions and 33 deletions.
4 changes: 2 additions & 2 deletions exporter/collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ By default, the exporter sends telemetry to the project specified by `project` i

### Multi-Project quota usage

The `gcp.project.id` label can be combined with the `destination_project_quota` option to attribute quota usage to the project parsed by the label. This feature is currently only available
for traces and metrics. The Collector's default service account will need `roles/serviceusage.serviceUsageConsumer` IAM permissions in the destination quota project.
The `gcp.project.id` label can be combined with the `destination_project_quota` option to attribute quota usage to the project parsed by the label. This feature is available
for traces, metrics, and logs. The Collector's default service account will need `roles/serviceusage.serviceUsageConsumer` IAM permissions in the destination quota project.

Note that this option will not work if a quota project is already defined in your Collector's GCP credentials. In this case, the telemetry will fail to export with a "project not found" error.
This can be done by manually editing your [ADC file](https://cloud.google.com/docs/authentication/application-default-credentials#personal) (if it exists) to remove the `quota_project_id` entry line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ var LogsTestCases = []TestCase{
OTLPInputFixturePath: "testdata/fixtures/logs/logs_multi_project.json",
ExpectFixturePath: "testdata/fixtures/logs/logs_multi_project_expected.json",
},
{
Name: "Multi-project logs with destination_project_quota enabled",
OTLPInputFixturePath: "testdata/fixtures/logs/logs_multi_project.json",
ExpectFixturePath: "testdata/fixtures/logs/logs_multi_project_destination_quota_expected.json",
ConfigureCollector: func(cfg *collector.Config) {
cfg.DestinationProjectQuota = true
},
},
{
Name: "Logs with scope information",
OTLPInputFixturePath: "testdata/fixtures/logs/logs_apache_error_scope.json",
Expand Down

0 comments on commit 6445f66

Please sign in to comment.