Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

metrics: generate grpc-gateway related files and structs #204

Closed
odeke-em opened this issue Jul 16, 2019 · 3 comments · Fixed by #205
Closed

metrics: generate grpc-gateway related files and structs #204

odeke-em opened this issue Jul 16, 2019 · 3 comments · Fixed by #205
Assignees

Comments

@odeke-em
Copy link
Member

The Trace endpoint allows sending data serialized as JSON to the agent. There are many cases where folks want to also serialize metrics coming say from a front-end or a spot that doesn't use grpc nor protobufs so let's add support for metrics too.

@odeke-em
Copy link
Member Author

/cc @draffensperger

@odeke-em
Copy link
Member Author

I believe it would entail adding

# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the
# OpenCensus service using github.com/grpc-ecosystem/grpc-gateway.
type: google.api.Service
config_version: 3
http:
 rules:
 - selector: opencensus.proto.agent.metrics.v1.MetricsService.Export
   post: /v1/metrics
   body: "*"

to
src/opencensus/proto/agent/metrics/v1/metrics_service_http.yaml
but that'll also require regeneration of the protos of which my protoc compiler has historically radically deviated from @songy23's so kindly also paging @songy23, otherwise I'd send a PR.

@draffensperger
Copy link
Contributor

Yes, I like the idea. One big caveat with metrics sent from ephemeral clients like web browsers, internet-of-things devices, or even things like Lambda/Cloud functions:

  • It's probably not enough in those cases to just expose a way for them to write arbitrary metrics, and it could even be risky - it could allow one client to overwrite aggregated points
  • Instead what we want for those clients is the ability to write points that get aggregated up into cumulative counters and distributions by the service itself. One proof of concept we did as part of a hackathon did that where the browse clients writes a GAUGE and then the service adds it up from all clients to form a distribution / cumulative counter.

Anyway, there isn't harm in adding the gRPC gateway support, which could also help some server-side cases as well, like writing metrics from a bash script or simple Python script where they don't want to bring in gRPC or any libraries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants