Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketch out how metrics should be documented for each language SIG #1746

Closed
cartermp opened this issue Sep 14, 2022 · 7 comments
Closed

Sketch out how metrics should be documented for each language SIG #1746

cartermp opened this issue Sep 14, 2022 · 7 comments
Labels
docs e1-hours Effort: < 8 hrs enhancement New feature or request

Comments

@cartermp
Copy link
Contributor

In the last maintainer's meeting, we discussed the looming lack-of-metrics problem. Several SIG maintainers said that they won't consider metrics as fully released until there's docs. Yay! But they'd like some help.

The ask was that we come up with the general framework by which they can contribute some code. For example:

  • Should there be metrics in getting started for each language? If so, where?
  • Where should we show how to initialize metrics in code?
  • What concepts in metrics should get documented with code samples?
  • Should there be dedicated metrics pages, or should metrics be on the same page as tracing?

If we can get this sketched out, then several SIG maintainers (Go, JS) offered to contribute some basic docs and code samples that demonstrate how to initialize and use metrics APIs correctly. I mentioned that I can usually run with things once I have the initialization code done right, since it's not too hard to use APIs in a sample app and produce copy-pasteable snippets from there.

We can then go to a language SIG with this and work with them to get metrics documented soon!

@cartermp cartermp added enhancement New feature or request e1-hours Effort: < 8 hrs labels Sep 14, 2022
@svrnm
Copy link
Member

svrnm commented Sep 14, 2022

Should there be metrics in getting started for each language? If so, where?

I would like seeing traces & metrics (and later logs and other potential signals) being combined in one "getting started", starting with traces for sure, but then going on with metrics is the natural flow and also shows that we think as them belonging together.

Where should we show how to initialize metrics in code?

I think some of the SIGs are working on automatic things, so we can do it again like with traces: here is what you get automatically, here is what you can do manually, etc.

What concepts in metrics should get documented with code samples?

Some/Most languages have a http example already, so doing some calls per minute, average response time, error rate, etc is a good starting point.

Should there be dedicated metrics pages, or should metrics be on the same page as tracing?

if possible: same.

@cartermp
Copy link
Contributor Author

cartermp commented Sep 17, 2022

(follow python example for each language: https://opentelemetry.io/docs/instrumentation/python/getting-started/)

Getting started

words

Installation

install everything you need / set up an environment for it if the language calls for it

Create sample http server

No instrumentation; just an http server that does a dice roll

Add automatic instrumentation / Add instrumentation libraries

(title differs depending on if language has autoinstrumentation)

At a minimum, instruments the http call. Most likely to create a span since most libraries do that today.

Run the instrumented app

Show how to run, show sample output

Add manual instrumentation to automatic instrumentation

words

Add tracing

Show how to create a span that connects with autoinstrumentation, run the app again, show example output

Add metrics

✨✨ HELP NEEDED! ✨✨

Show how to create a counter and up that counter on every request

Send telemetry to an OpenTelemetry Collector

words

Configure and run a local collector

example of configuring and running the collector such that it logs telemetry output

Modify the command to export spans and metrics via OTLP

show how to export to the collector via otlp exporter

Run the application

same as previous run, but this time shows collector output

Next steps

Point to autoinstrumentation/libraries article(s) and manual instrumentation article and exporters article

@cartermp
Copy link
Contributor Author

cartermp commented Sep 17, 2022

(In existing manual instrumentation article)

Manual instrumentation

words

Tracing

...all the tracing stuff that's mostly documented now

Metrics

words

Initialization

✨✨ HELP NEEDED! ✨✨

Show how to correctly initialize metrics for manual instrumentation. Some things to consider:

  • How to do it the "most correct" way
  • resource attributes? which ones?
  • should metrics get initialized differently based on if you have instrumentation libraries or autoinstrumentation configured?
  • Explain what a meter is? Or should that go in language-agnostic concept docs and get linked to?

Example (likely not very good, but illustrative):

from opentelemetry import metrics

# probably some code that sets up resources?
# something else?

meter = metrics.get_meter(__name__)

Synchronous and asynchronous instruments

✨✨ Help needed less, but still appreciated ✨✨

Explain synchronous and asynchronous instruments? Or should this just go into language-agnostic concept docs?

work_counter = meter.create_counter(
    "work.counter", unit="1", description="Counts the amount of work done"
)

work_counter.add(1)

Using Counters

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what a counter is/link to a definition, show code sample on how to create and use

Using Asynchronous Counters

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what an async counter is/link to a definition, show code sample on how to create and use

Using Histograms

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what a histogram is/link to a definition, show code sample on how to create and use

Using UpDownCounters

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what a UpDownCounters is/link to a definition, show code sample on how to create and use

Using Asynchronous UpDownCounters

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what a async UpDownCounters is/link to a definition, show code sample on how to create and use

Using Asynchronous Gauges

✨✨ Help needed less, but still appreciated ✨✨

Briefly say what a async gauge is/link to a definition, show code sample on how to create and use

Adding attributes to an instrument

✨✨ Help needed less, but still appreciated ✨✨

Show example(s) of adding attributes to one or more of the above instruments, with a code sample

Next steps

Link to exporters page
Link to instrumentation libraries and/or autoinstrumentation page

@svrnm
Copy link
Member

svrnm commented Sep 19, 2022

ok... that's much more than metrics 😆 but I like it... can you put that maybe in 2 markdown files (maybe in archetypes or some "temp" place), so that commenting is a little bit easier?

@avillela
Copy link
Contributor

avillela commented Oct 6, 2022

@svrnm @cartermp I'm currently doing some Python metrics work, and I've done a bunch of Python traces work, so I'd be happy to document both sides. 😁

@svrnm
Copy link
Member

svrnm commented Oct 7, 2022

@svrnm @cartermp I'm currently doing some Python metrics work, and I've done a bunch of Python traces work, so I'd be happy to document both sides. 😁

awesome! There's already a bunch of stuff for python on tracing, and a little bit on metrics. So, while you work on that, double check if the python tracing stuff is up-to-date & if things can be added and for the metrics extend it to whatever is missing.

@cartermp
Copy link
Contributor Author

This one can get closed, as we have a format now (and several documented languages!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs e1-hours Effort: < 8 hrs enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants