Naming a manual OTel Tracer [closed] - go

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 days ago.
Improve this question
I'm using OpenTelemetry for manually instrumenting a Go codebase. Trying to follow the guidance from the Manual Instrumentation docs, I named the Tracer with the name of the package and the service struct owning the Tracer, e.g. tp.Tracer("orders.Controller"). I'm not clear if this is the right naming or not. The docs say this name should be the Instrumentation library, not the Instrumented library. For manual instrumentation, these are surely the same thing.
Am I good, or should I be naming these something else?

The tracer name is used to group together spans, traces, metrics, and so on that belong to the same scope. You can have one serviceName for your entire application or you can have multiple serviceName with a smaller scope to be more specific. It's up to you. The serviceName can be seen as a namespace that groups together stuff that has the same scope. I'm gonna mention three things to help you better understand:
If you use more than one serviceName, you've to remember this when you set the tracer name on each span you're going to collect.
It's a good practice to put the serviceName as an attribute to each span (usually, it's done in the global instantiation of the collector).
In your third-party metrics receiver (such as NewRelic) you could use the serviceName for grouping purposes. Keep in mind this when you're about to take the decision.
Hope to help you better understand your doubts!

Related

Laravel - Is there a pattern for creating complex scheduled tasks? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 days ago.
Improve this question
I am creating several scheduled tasks within my Laravel site using the schedule() function within the Console/Kernel object. It acceptable to place simple logic in the schedule() function (based on the explanation from the Laravel site):
$schedule->call(function () {
DB::table('recent_users')->delete();
})->daily();
However, if the logic needs to be more complicated (100 lines of code or more to decide which models to focus on) basic programming rules instructs us to break the code up into additional functions and classes, which can be then be called by schedule(). However, I am a bit confused as to where these functions/classes go. A few possibilities:
A Controller function, even though it does not use a route?
A trait, used by the Kernel?
Console command, even though it's never called from the console?
A helper?
(edit) Other classes that share the Kernel's namespace?
Another kind of class that functions like a Controller, but internally only? (Something that I am not aware of.)
Where do these classes/functions go?
====
There are many established patterns can be regarded as correct or incorrect, based on Laravel's intended use, regardless of opinion. Also, there are many valid ways in which Laravel can be used. Within this context, there are many opinions on the best way to do things, many of which could be considered correct. That said, there are framework design patterns which are beyond the scrutiny of opinion (for now.) We use routes to link URLs to Controllers (not jobs.) We access models from the controllers and not the other way around. My question is intended to discover an established pattern that I am not aware of, and not to debate opinions regarding these patterns.
Basically, I want to avoid building my site in a way that with prove blatantly embarrassing in the future, (especially regarding lesser well known site elements, such as jobs, scheduling and console commands) simply because I did not know Laravel facts.

Implementing redis in go [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying implement redis basic functionality like below in Go.
GET
SET
ZADD
ZCARD
ZCOUNT
ZRANGE
SAVE
If you want to implement a Go server offering some Redis features, it is quite easy. You need to decide about the goroutine model, then implement/reuse some data structures (map and skiplist), then implement the Redis protocol (which is simple enough).
I would suggest a goroutine model with 2 goroutines per client connection, plus one goroutine to implement the Redis engine and manage the data structures. The benefit of this model is you can easily support pipelining and the atomicity property of Redis commands without any explicit locking. This model is well adapted if you want to later extend the scope by supporting blocking commands (such as the ones useful for queues).
Now, if you also want to mimic the same exact Redis behavior, this is more complex. Especially, saving the data in background leveraging the OS copy-on-write mechanism will be difficult with Go (since forking does not work). For a memory database, foreground saving is always easy. Background saving is extremely difficult.
You may also want to have a look at the following attempts, and simplify/enrich them to match your goals:
https://github.com/siddontang/ledisdb
https://github.com/felixge/go-redis
https://github.com/docker/go-redis-server

Ruby Custom Classes, How do you know what to initialize? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to write a small dictionary Ruby app where I can look up existing entries, add and remove entries (ALL ENTRIES ARE PUT INTO A HASH). So right now I'm creating a Dictionary class and I'm not quite sure what exactly should be 'initialized' method.
I'm still pretty new to Ruby, so if someone could explain what should be initialized at the beginning of a class I'd be extremely grateful.
How do you know what to initialize?
Time and experience. In general, #new should:
Initialize instance variables.
Configure any object defaults.
Register itself with observers.
Housekeeping tasks needed to reach a minimal "ready" state.
Sometimes an object needs to do a lot more work to be "ready" (whatever that means for your class), and #new can just as easily do too little as too much. Finding the right balance for your application is what matters, so feel free to open new questions here or on Code Review Stack Exchange with more concrete questions and some actual code.

retrieving subset of FHIR resource [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
All,
I'm interested in the ability to retrieve a specific element within a FHIR resource using a single URL call. For example, suppose I'm interested in the gender of my patients. I would read the using the URL, without having to walk the XML node path every time. Right now, this functionality does not appear to exist. What do you think about the usefulness of this? Would like to get a sense of the community interest. Thanks.
-Jeff
For the default query mechanism, you can't bring anything back other than the full resource. (And don't even have a guarantee that the desired element will be present on all instances of the resource unless that element was part of your search criteria - in which case, why bother asking? :>). There's a new mechanism for defining custom queries. Refer to _query in the search/query section of the FHIR spec. However, it's not clear whether this will allow retrieval of anything other than full resource instances either.
This functionality does not exist at this time. It's on the wishlist, and we're trying to decide whether we can frame it in a sensible and safe fashion. The case you describe is relatively obvious, but many others aren't. And, in fact, when I think about it, it's not really clear to me how it works. what do you get back? just the gender element? so the server needs to - in effect - do the node walk for you, and you get, instead, to deal with a profusion of different schemas. It's not really obvious to me that this is a net saving for the client, and it's certainly a greater cost for the server.

Work Item naming conventions [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
What naming conventions do you use when creating work items in your task/bug tracking tools?
For example:
Do you prefix the items with an area/subject?
How do you begin scenarios/use cases? E.g., "The department manager can..."
How do you make it easier to detect duplicates?
Your project management, bug tracking and time management (if different from the pm tool) should follow the same pattern, no matter what the pattern is. I usually like to do a top down approach: project-application-page (for example: Amazon-Order Entry-Confirmation Page) - if the project/task management, bug and time management all follow the same pattern then you can track tasks to open issues to time spent easily. After the page you enter a short descriptive text of the issue. In the description area, you need to state:
environment (OS/browser)
version being tested
server environment (dev, QA, or production)
the bug (screen captures help greatly)
the expected results (what you expected to happen)
level of issue (show stopper to nice-to-have-but-will-never-get-done)

Resources