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

Implement repository fields and support for filtered caller tracking #79

Merged
merged 14 commits into from
Nov 13, 2023

Conversation

gagbo
Copy link
Member

@gagbo gagbo commented Nov 2, 2023

Description

Add missing parts to meet the upcoming Autometrics 1.0 spec

Checklist

  • The CHANGELOG is updated.
  • The open-telemetry example in repository works fine:
    • the docker compose file is valid
    • the application compiles and run
    • alerts are getting triggered in Prometheus
  • The prometheus example in repository works fine:
    • the docker compose file is valid
    • the application compiles and run
    • alerts are getting triggered in Prometheus
    • exemplars are accessible on the graph

@gagbo gagbo force-pushed the am-38-implement-golang-details branch 2 times, most recently from e0fa6f4 to 2a3a4d6 Compare November 3, 2023 14:36
gagbo added 6 commits November 3, 2023 16:02
The parent tracking is span-based (using `(TraceID, SpanId)` as keys)

It falls back to the previous method (`runtime.Callers()` analysis) if
the function id for a given span is missing from the global state.

To prevent the global state from ballooning memory usage, the entries
in the span-to-functionIDs table are deleted as part of the cleanup
code in `Instrument` (that is why some goroutines outliving their
callers with weird scheduling might miss the function id in the
global state.)

This solution deals well with functions spawning multiple goroutines,
but the caller info will be "enhanced" (i.e. with Autometrics annotated
functions in the parent field) only if the context created by
autometrics.PreInstrument is properly passed to callees, which is
a task followed in #78

Fixes: AM-42
This allow library users to reuse the context augmented with Autometrics, so the tracing and caller information can be a lot more precise

Fixes: #78
@gagbo gagbo force-pushed the am-38-implement-golang-details branch from 2a3a4d6 to daa9f85 Compare November 3, 2023 15:03
gagbo added 7 commits November 6, 2023 10:15
Instead of erroring out when some arguments cannot be inspected for context inspection, we log the information.
This will fix the builds that are downloaded, but not the ones from go install
The context of a HTTP request is not assignable, so we need to read from the existing context and create a new one
}
}
} else {
// TODO: log that autometrics cannot detect multi-nested contexts instead of errorring
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u got a todo here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I'll do that later, I don't know the "Go" way of writing logs in library packages

@gagbo gagbo merged commit 560c75c into main Nov 13, 2023
7 checks passed
@gagbo gagbo deleted the am-38-implement-golang-details branch November 13, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants