Skip to content

Commit

Permalink
Fix spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot committed May 31, 2024
1 parent 92f1115 commit 1720d73
Show file tree
Hide file tree
Showing 20 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ linters-settings:
- name: constant-logical-expr
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
# TODO (#3372) reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280
# TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280
- name: context-as-argument
disabled: true
arguments:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ See the [contributing documentation](./CONTRIBUTING.md).
OpenTelemetry Go Automatic Instrumentation is licensed under the terms of the [Apache Software License version 2.0].
See the [license file](./LICENSE) for more details.

Third-party licesnes and copyright notices can be found in the [LICENSES directory](./LICENSES).
Third-party licenses and copyright notices can be found in the [LICENSES directory](./LICENSES).

[OpenTelemetry]: https://opentelemetry.io/
[Go]: https://go.dev/
Expand Down
2 changes: 1 addition & 1 deletion docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ The offsets-tracker generates the [offset_results.json](../internal/pkg/inject/o

### Uretprobes

One of the basic requirments of OpenTelemetry spans is to contain start timestamp and end timestamp. Getting those timestamps is possible by placing an eBPF code at the start and the end of the instrumented function. eBPF supports this requirement via uprobes and uretprobes. Uretprobes are used to invoke eBPF code at the end of the function. Unfortunately, uretprobes and Go [do not play well together](https://github.com/golang/go/issues/22008).
One of the basic requirements of OpenTelemetry spans is to contain start timestamp and end timestamp. Getting those timestamps is possible by placing an eBPF code at the start and the end of the instrumented function. eBPF supports this requirement via uprobes and uretprobes. Uretprobes are used to invoke eBPF code at the end of the function. Unfortunately, uretprobes and Go [do not play well together](https://github.com/golang/go/issues/22008).

We overcome this issue by analyzing the target binary and detecting all the return statements in the instrumented functions. We then place a uprobe at the end of each return statement. This uprobe invokes the eBPF code that collects the end timestamp.

Expand Down
2 changes: 1 addition & 1 deletion internal/include/go_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static __always_inline void stop_tracking_span(struct span_context *sc, struct s
void *ctx = bpf_map_lookup_elem(&tracked_spans_by_sc, sc);
if (ctx == NULL)
{
bpf_printk("stop_tracking_span: cant find span context");
bpf_printk("stop_tracking_span: can't find span context");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions internal/include/libbpf/bpf_helper_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3398,7 +3398,7 @@ static long (*bpf_load_hdr_opt)(struct bpf_sock_ops *skops, void *searchby_res,
*
* **-EEXIST** if the option already exists.
*
* **-EFAULT** on failrue to parse the existing header options.
* **-EFAULT** on failure to parse the existing header options.
*
* **-EPERM** if the helper cannot be used under the current
* *skops*\ **->op**.
Expand Down Expand Up @@ -3736,7 +3736,7 @@ static __u64 (*bpf_ktime_get_coarse_ns)(void) = (void *) 160;
/*
* bpf_ima_inode_hash
*
* Returns the stored IMA hash of the *inode* (if it's avaialable).
* Returns the stored IMA hash of the *inode* (if it's available).
* If the hash is larger than *size*, then only *size*
* bytes will be copied to *dst*
*
Expand Down Expand Up @@ -3772,7 +3772,7 @@ static struct socket *(*bpf_sock_from_file)(struct file *file) = (void *) 162;
* actual packet size (resulting in negative packet size) will in
* principle not exceed the MTU, why it is not considered a
* failure. Other BPF-helpers are needed for performing the
* planned size change, why the responsability for catch a negative
* planned size change, why the responsibility for catch a negative
* packet size belong in those helpers.
*
* Specifying *ifindex* zero means the MTU check is performed
Expand Down
4 changes: 2 additions & 2 deletions internal/include/libbpf/bpf_tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ struct pt_regs;
* BPF_PROG is a convenience wrapper for generic tp_btf/fentry/fexit and
* similar kinds of BPF programs, that accept input arguments as a single
* pointer to untyped u64 array, where each u64 can actually be a typed
* pointer or integer of different size. Instead of requring user to write
* pointer or integer of different size. Instead of requiring user to write
* manual casts and work with array elements by index, BPF_PROG macro
* allows user to declare a list of named and typed input arguments in the
* same syntax as for normal C function. All the casting is hidden and
Expand Down Expand Up @@ -468,7 +468,7 @@ struct pt_regs;
* tp_btf/fentry/fexit BPF programs. It hides the underlying platform-specific
* low-level way of getting kprobe input arguments from struct pt_regs, and
* provides a familiar typed and named function arguments syntax and
* semantics of accessing kprobe input paremeters.
* semantics of accessing kprobe input parameters.
*
* Original struct pt_regs* context is preserved as 'ctx' argument. This might
* be necessary when using BPF helpers like bpf_perf_event_output().
Expand Down
2 changes: 1 addition & 1 deletion internal/include/libbpf/btf.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ LIBBPF_API void btf_dump__free(struct btf_dump *d);
LIBBPF_API int btf_dump__dump_type(struct btf_dump *d, __u32 id);

struct btf_dump_emit_type_decl_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* optional field name for type declaration, e.g.:
* - struct my_struct <FNAME>
Expand Down
18 changes: 9 additions & 9 deletions internal/include/libbpf/libbpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct bpf_object_open_attr {
};

struct bpf_object_open_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* object name override, if provided:
* - for object open from file, this will override setting object
Expand Down Expand Up @@ -246,7 +246,7 @@ LIBBPF_API struct bpf_link *
bpf_program__attach(struct bpf_program *prog);

struct bpf_perf_event_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* custom user-provided value fetchable through bpf_get_attach_cookie() */
__u64 bpf_cookie;
Expand All @@ -261,7 +261,7 @@ bpf_program__attach_perf_event_opts(struct bpf_program *prog, int pfd,
const struct bpf_perf_event_opts *opts);

struct bpf_kprobe_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* custom user-provided value fetchable through bpf_get_attach_cookie() */
__u64 bpf_cookie;
Expand All @@ -282,7 +282,7 @@ bpf_program__attach_kprobe_opts(struct bpf_program *prog,
const struct bpf_kprobe_opts *opts);

struct bpf_uprobe_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* offset of kernel reference counted USDT semaphore, added in
* a6ca88b241d5 ("trace_uprobe: support reference counter in fd-based uprobe")
Expand All @@ -306,7 +306,7 @@ bpf_program__attach_uprobe_opts(struct bpf_program *prog, pid_t pid,
const struct bpf_uprobe_opts *opts);

struct bpf_tracepoint_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
/* custom user-provided value fetchable through bpf_get_attach_cookie() */
__u64 bpf_cookie;
Expand Down Expand Up @@ -646,7 +646,7 @@ struct ring_buffer;
typedef int (*ring_buffer_sample_fn)(void *ctx, void *data, size_t size);

struct ring_buffer_opts {
size_t sz; /* size of this struct, for forward/backward compatiblity */
size_t sz; /* size of this struct, for forward/backward compatibility */
};

#define ring_buffer_opts__last_field sz
Expand Down Expand Up @@ -877,7 +877,7 @@ LIBBPF_API void bpf_object__detach_skeleton(struct bpf_object_skeleton *s);
LIBBPF_API void bpf_object__destroy_skeleton(struct bpf_object_skeleton *s);

struct gen_loader_opts {
size_t sz; /* size of this struct, for forward/backward compatiblity */
size_t sz; /* size of this struct, for forward/backward compatibility */
const char *data;
const char *insns;
__u32 data_sz;
Expand All @@ -895,13 +895,13 @@ enum libbpf_tristate {
};

struct bpf_linker_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
};
#define bpf_linker_opts__last_field sz

struct bpf_linker_file_opts {
/* size of this struct, for forward/backward compatiblity */
/* size of this struct, for forward/backward compatibility */
size_t sz;
};
#define bpf_linker_file_opts__last_field sz
Expand Down
2 changes: 1 addition & 1 deletion internal/include/libbpf/xsk.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static inline __u32 xsk_prod_nb_free(struct xsk_ring_prod *r, __u32 nb)
* cached_cons is r->size bigger than the real consumer pointer so
* that this addition can be avoided in the more frequently
* executed code that computs free_entries in the beginning of
* this function. Without this optimization it whould have been
* this function. Without this optimization it would have been
* free_entries = r->cached_prod - r->cached_cons + r->size.
*/
r->cached_cons = libbpf_smp_load_acquire(r->consumer);
Expand Down
2 changes: 1 addition & 1 deletion internal/include/otel_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ volatile const u64 attr_type_int64slice;
volatile const u64 attr_type_float64slice;
volatile const u64 attr_type_stringslice;

/* Defintions should mimic structs defined in go.opentelemetry.io/otel/attribute */
/* Definitions should mimic structs defined in go.opentelemetry.io/otel/attribute */

typedef struct go_otel_attr_value {
u64 vtype;
Expand Down
2 changes: 1 addition & 1 deletion internal/include/uprobe.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
struct span_context psc;

// Common flow for uprobe return:
// 1. Find consistend key for the current uprobe context
// 1. Find consistent key for the current uprobe context
// 2. Use the key to lookup for the uprobe context in the uprobe_context_map
// 3. Update the end time of the found span
// 4. Submit the constructed event to the agent code using perf buffer events_map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int uprobe_FetchMessage(struct pt_regs *ctx) {
3. Blocking wait for message
4. internal kafka code after blocking
5. Return from FetchMessage
Steps 2-4 are executed in a seperate goroutine from the one the user of the library.
Steps 2-4 are executed in a separate goroutine from the one the user of the library.
*/
void *reader = get_argument(ctx, 1);
void *context_data_ptr = get_Go_context(ctx, 3, 0, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static __always_inline int inject_kafka_header(void *message, struct kafka_heade

static __always_inline long collect_kafka_attributes(void *message, struct message_attributes_t *attrs, bool collect_topic) {
if (collect_topic) {
// Topic might be globaly set for a writer, or per message
// Topic might be globally set for a writer, or per message
get_go_string_from_user_ptr((void *)(message + message_topic_pos), attrs->topic, sizeof(attrs->topic));
}

Expand Down Expand Up @@ -188,7 +188,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
// https://github.com/segmentio/kafka-go/blob/v0.2.3/message.go#L24C2-L24C6
// 2. the time.Time struct is 24 bytes. This looks to be correct for all the reasnobaly latest versions according to
// https://github.com/golang/go/blame/master/src/time/time.go#L135
// In the future if more libraries will need to get structs sizes we probably want to have simillar
// In the future if more libraries will need to get structs sizes we probably want to have similar
// mechanism to the one we have for the offsets
u16 msg_size = message_time_pos + 8 + 8 + 8;
__builtin_memcpy(current_sc.TraceID, kafka_request->TraceID, TRACE_ID_SIZE);
Expand All @@ -198,7 +198,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
if (i >= msgs_array_len) {
break;
}
// Optionaly collect the topic, and always collect key
// Optionally collect the topic, and always collect key
collect_kafka_attributes(msg_ptr, &kafka_request->msgs[i], !global_topic);
// Generate span id for each message
generate_random_bytes(kafka_request->msgs[i].SpanID, SPAN_ID_SIZE);
Expand All @@ -216,7 +216,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {


bpf_map_update_elem(&kafka_events, &key, kafka_request, 0);
// don't need to start tracking the span, as we don't have a context to propagate localy
// don't need to start tracking the span, as we don't have a context to propagate locally
return 0;
}

Expand All @@ -237,6 +237,6 @@ int uprobe_WriteMessages_Returns(struct pt_regs *ctx) {

bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU, kafka_request, sizeof(*kafka_request));
bpf_map_delete_elem(&kafka_events, &key);
// don't need to stop tracking the span, as we don't have a context to propagate localy
// don't need to stop tracking the span, as we don't have a context to propagate locally
return 0;
}
2 changes: 1 addition & 1 deletion internal/pkg/instrumentation/probe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (i *Base[BPFObj, BPFEvent]) Close() error {
// shutdown to avoid leaking system resources.
type UprobeFunc[BPFObj any] func(symbol string, exec *link.Executable, target *process.TargetDetails, obj *BPFObj) ([]link.Link, error)

// Uprobe is an eBPF program that is attached in the entry point and/or the reutrn of a function.
// Uprobe is an eBPF program that is attached in the entry point and/or the return of a function.
type Uprobe[BPFObj any] struct {
// Sym is the symbol name of the function to attach the eBPF program to.
Sym string
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/process/ptrace/ptrace_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewTracedProgram(pid int, logger logr.Logger) (*TracedProgram, error) {
tidMap := make(map[int]bool)
retryCount := make(map[int]int)

// iterate over the thread group, until it doens't change
// iterate over the thread group, until it doesn't change
//
// we have tried several ways to ensure that we have stopped all the tasks:
// 1. iterating over and over again to make sure all of them are tracee
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/structfield/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func find[T any](slice *[]*T, f func(*T) bool) *T {
// mergeSorted merges the two sorted slices slice0 and slice1 using the cmp
// function to compare elements.
//
// The cmp function needs to return negative values when a<b, possitive values
// The cmp function needs to return negative values when a<b, positive values
// when a>b, and 0 when a==b.
func mergeSorted[T any](slice0, slice1 []T, cmp func(a, b T) int) []T {
merged := make([]T, 0, len(slice0)+len(slice1))
Expand Down
2 changes: 1 addition & 1 deletion internal/test/e2e/gin/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SCOPE="go.opentelemetry.io/auto/net/http"
assert_equal "$result" '"/hello-gin"'
}

@test "server :: includes hhttp.response.status_code attribute" {
@test "server :: includes http.response.status_code attribute" {
result=$(server_span_attributes_for ${SCOPE} | jq "select(.key == \"http.response.status_code\").value.intValue")
assert_equal "$result" '"200"'
}
Expand Down
2 changes: 1 addition & 1 deletion internal/test/e2e/nethttp/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SCOPE="go.opentelemetry.io/auto/net/http"
assert_equal "$result" '"/hello/42"'
}

@test "server :: includes hhttp.response.status_code attribute" {
@test "server :: includes http.response.status_code attribute" {
result=$(server_span_attributes_for ${SCOPE} | jq "select(.key == \"http.response.status_code\").value.intValue")
assert_equal "$result" '"200"'
}
Expand Down
2 changes: 1 addition & 1 deletion internal/test/e2e/nethttp_custom/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SCOPE="go.opentelemetry.io/auto/net/http"
assert_equal "$result" '"/hello"'
}

@test "server :: includes hhttp.response.status_code attribute" {
@test "server :: includes http.response.status_code attribute" {
result=$(server_span_attributes_for ${SCOPE} | jq "select(.key == \"http.response.status_code\").value.intValue")
assert_equal "$result" '"200"'
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/inspect/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (i *Inspector) AddManifest(manifest Manifest) error {

goVer := manifest.Application.GoVerions
if goVer == nil {
// Passsing nil to newBuilder will mean the application is built with
// Passing nil to newBuilder will mean the application is built with
// the latest version of Go.
b := newBuilder(i.log, i.client, nil)
for _, ver := range manifest.Application.Versions {
Expand Down

0 comments on commit 1720d73

Please sign in to comment.