census-instrumentation / opencensus-website

opencensus.io website content
https://opencensus.io
Apache License 2.0
42 stars 155 forks source link

Documentation on tag key restrictions do not match Stackdriver. #666

Open kunalq opened 5 years ago

kunalq commented 5 years ago

The documentation states that valid ASCII printable characters "between 32 and 126, inclusive" are valid tag keys for metrics; in fact, Stackdriver appears to accept only alphanumeric characters.

I received the following error when attempting to include forward slashes in the label (to match our tracing labels):

Apr 11, 2019 1:40:29 PM io.opencensus.exporter.stats.stackdriver.StackdriverExporterWorker registerMetricDescriptor
WARNING: ApiException thrown when creating MetricDescriptor.
com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Field metricDescriptor.labels[0].key had an invalid value of "foo/bar": Label key contains invalid characters.
        at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:49)
        at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
        at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
        at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
        at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
        at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1052)
        at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:398)
[snip]

Doc in question: https://github.com/census-instrumentation/opencensus-website/blob/master/content/tag/key.md

songy23 commented 5 years ago

The characters that you can use in OpenCensus tags are a superset (not subset) of the ones in Stackdriver/Prometheus. If you know all your metrics will only be exported to Stackdriver, please conform to Stackdriver restrictions when creating tags.