diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index faa49440a6..b9935f402a 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -79,7 +79,7 @@ jobs: go-version: '1.21' - name: Az CLI login - uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0 + uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1 with: client-id: ${{ env.AZURE_CLIENT_ID }} tenant-id: ${{ env.AZURE_TENANT_ID }} diff --git a/.github/workflows/e2e-aks.yml b/.github/workflows/e2e-aks.yml index 95a87aabaf..1c6fd61b75 100644 --- a/.github/workflows/e2e-aks.yml +++ b/.github/workflows/e2e-aks.yml @@ -38,7 +38,7 @@ jobs: with: go-version: '1.21' - name: Az CLI login - uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0 + uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1 with: client-id: ${{ env.AZURE_CLIENT_ID }} tenant-id: ${{ env.AZURE_TENANT_ID }} diff --git a/.github/workflows/run-full-validation.yml b/.github/workflows/run-full-validation.yml index 8dff1d7673..f8988431e2 100644 --- a/.github/workflows/run-full-validation.yml +++ b/.github/workflows/run-full-validation.yml @@ -67,7 +67,7 @@ jobs: go-version: '1.21' - name: Az CLI login - uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0 + uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1 with: client-id: ${{ env.AZURE_CLIENT_ID }} tenant-id: ${{ env.AZURE_TENANT_ID }} diff --git a/pkg/metrics/stats_reporter.go b/pkg/metrics/stats_reporter.go index c9ec5d984a..59c06edfb4 100644 --- a/pkg/metrics/stats_reporter.go +++ b/pkg/metrics/stats_reporter.go @@ -18,6 +18,7 @@ package metrics import ( "context" + ctxUtils "github.com/deislabs/ratify/internal/context" "github.com/sirupsen/logrus" "go.opentelemetry.io/otel/attribute" instrument "go.opentelemetry.io/otel/metric" @@ -221,6 +222,10 @@ func ReportVerifierDuration(ctx context.Context, duration int64, veriferName str Key: "error", Value: attribute.BoolValue(isError), }, + attribute.KeyValue{ + Key: "namespace", + Value: attribute.StringValue(ctxUtils.GetNamespace(ctx)), + }, )) } } @@ -230,7 +235,9 @@ func ReportVerifierDuration(ctx context.Context, duration int64, veriferName str // errorString: the error message func ReportSystemError(ctx context.Context, errorString string) { if systemErrorCount != nil { - systemErrorCount.Add(ctx, 1, instrument.WithAttributes(attribute.KeyValue{Key: "error", Value: attribute.StringValue(errorString)})) + systemErrorCount.Add(ctx, 1, instrument.WithAttributes( + attribute.KeyValue{Key: "error", Value: attribute.StringValue(errorString)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } } @@ -240,7 +247,10 @@ func ReportSystemError(ctx context.Context, errorString string) { // registryHost: the host name of the registry func ReportRegistryRequestCount(ctx context.Context, statusCode int, registryHost string) { if registryRequestCount != nil { - registryRequestCount.Add(ctx, 1, instrument.WithAttributes(attribute.KeyValue{Key: "status_code", Value: attribute.IntValue(statusCode)}, attribute.KeyValue{Key: "registry_host", Value: attribute.StringValue(registryHost)})) + registryRequestCount.Add(ctx, 1, instrument.WithAttributes( + attribute.KeyValue{Key: "status_code", Value: attribute.IntValue(statusCode)}, + attribute.KeyValue{Key: "registry_host", Value: attribute.StringValue(registryHost)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } } @@ -249,7 +259,9 @@ func ReportRegistryRequestCount(ctx context.Context, statusCode int, registryHos // resourceType: the scope of resource being exchanged (AKV or ACR) func ReportAADExchangeDuration(ctx context.Context, duration int64, resourceType string) { if aadExchangeDuration != nil { - aadExchangeDuration.Record(ctx, duration, instrument.WithAttributes(attribute.KeyValue{Key: "resource_type", Value: attribute.StringValue(resourceType)})) + aadExchangeDuration.Record(ctx, duration, instrument.WithAttributes( + attribute.KeyValue{Key: "resource_type", Value: attribute.StringValue(resourceType)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } } @@ -258,7 +270,9 @@ func ReportAADExchangeDuration(ctx context.Context, duration int64, resourceType // repository: the repository being accessed func ReportACRExchangeDuration(ctx context.Context, duration int64, repository string) { if acrExchangeDuration != nil { - acrExchangeDuration.Record(ctx, duration, instrument.WithAttributes(attribute.KeyValue{Key: "repository", Value: attribute.StringValue(repository)})) + acrExchangeDuration.Record(ctx, duration, instrument.WithAttributes( + attribute.KeyValue{Key: "repository", Value: attribute.StringValue(repository)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } } @@ -267,7 +281,9 @@ func ReportACRExchangeDuration(ctx context.Context, duration int64, repository s // certificateName: the object name of the certificate func ReportAKVCertificateDuration(ctx context.Context, duration int64, certificateName string) { if akvCertificateDuration != nil { - akvCertificateDuration.Record(ctx, duration, instrument.WithAttributes(attribute.KeyValue{Key: "certificate_name", Value: attribute.StringValue(certificateName)})) + akvCertificateDuration.Record(ctx, duration, instrument.WithAttributes( + attribute.KeyValue{Key: "certificate_name", Value: attribute.StringValue(certificateName)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } } @@ -276,6 +292,8 @@ func ReportAKVCertificateDuration(ctx context.Context, duration int64, certifica // hit: whether the blob was found in the cache func ReportBlobCacheCount(ctx context.Context, hit bool) { if cacheBlobCount != nil { - cacheBlobCount.Add(ctx, 1, instrument.WithAttributes(attribute.KeyValue{Key: "hit", Value: attribute.BoolValue(hit)})) + cacheBlobCount.Add(ctx, 1, instrument.WithAttributes( + attribute.KeyValue{Key: "hit", Value: attribute.BoolValue(hit)}, + attribute.KeyValue{Key: "namespace", Value: attribute.StringValue(ctxUtils.GetNamespace(ctx))})) } }