About An instrumented microservice in Go - it'll give you some Honeycomb data to play with.

Intro to Observability: OpenTelemetry in Go

This application is here for you to try out tracing. It consists of a microservice that calls itself, so you can simulate a whole microservice ecosystem with just one service!

What to do

Shortest route: Remix this app on Glitch.

Run locally

If you use VSCode Devcontainers, this repository is set up for that.

Otherwise, we expect golang to be set up.

Configure tracing to Honeycomb

Create a .env file:

cp .env.example .env

In .env, populate these environment variables:

HONEYCOMB_API_KEY=replace-this-with-a-real-api-key
HONEYCOMB_DATASET=otel-go
SERVICE_NAME=fibonacci-microservice

Get a Honeycomb API Key from your Team Settings in Honeycomb. (find this by clicking on your profile in the lower-left corner.)

You can name the Honeycomb Dataset anything you want.

You can choose any Service Name you want.

Start the app

./init.sh

This runs src/main.go.

See the results

Run the app. Activate the sequence of numbers. Go to Honeycomb and choose the Dataset you configured.

How many traces are there?

How many spans are in the traces?

Why are there so many??

Which trace has the most, and why is it different?

2. Customize a span

Let's make it easier to see what the "index" query parameter is.

In the fibHandler function in main.go, after parsing the index from the query, add it as a custom attribute (search for "CUSTOM ATTRIBUTE" in main.go):

trace.SpanFromContext(ctx).SetAttributes(attribute.Int("parameter.index", i))

Restart the app, make the sequence go, and find that field on the new spans.

Can you make the trace waterfall view show the index? What pattern does it show?

3. Create a custom span

Make the calculation into its own span, to see how much of the time spent on this service is the meat: adding the fibonacci numbers.

In fibHandler, surround the addition statement with a span start and end (seach for "CUSTOM SPAN" to find it):

	tr := otel.Tracer("calculator")
	ctx, span := tr.Start(ctx, "calculation")
  // interesting code here
	defer span.End()

After a restart, do your traces show this extra span? Do you see the name of your method? What percentage of the service time is spend in it?

Owner
Honeycomb
Observability for Production Systems. Debug using Events, Traces, and Logs in one tool. Instrument code automatically, surface outliers instantly.
Honeycomb
Similar Resources

TinySQL is a course designed to teach you how to implement a distributed relational database in Go

TinySQL TinySQL is a course designed to teach you how to implement a distributed relational database in Go. TinySQL is also the name of the simplifed

Nov 7, 2021

An automated tutorial to teach you about Go!

Golings Welcome to Golings, an automated Go tutorial program (inspired by Rustlings and Haskelling). This program has some small exercises where you c

Dec 31, 2021

Solving structy.net data structures & algorithms programming problems in Go (with Tests)

structy.net Solving structy.net data structures & algorithms programming problems in Go (with Tests) I. Introduction 000. hey programmer 001. max-valu

Oct 18, 2022

`go-redash-query` is a simple library to get structed data from `redash query` sources

go-redash-query go-redash-query is a simple library to get structed data from redash query sources Example Source table id name email 1 Dannyhann rhrn

May 22, 2022

Axiom Honeycomb Proxy ships logs to Axiom and Honeycomb simultaneously.

Axiom Honeycomb Proxy Table of Contents Introduction Usage Contributing License Introduction Axiom Honeycomb Proxy ships logs to Axiom and Honeycomb s

Dec 6, 2021

k6-to-honeycomb is a program that sends k6 results into Honeycomb for visualization and analysis.

k6-to-honeycomb is a program that sends k6 results into Honeycomb for visualization and analysis.

k6-to-honeycomb k6-to-honeycomb is a program that sends k6 results into Honeycomb for visualization and analysis. Getting Started k6-to-honeycomb is a

Jul 14, 2022

A simple scraper to export data from buildkite to honeycomb using opentelemetry SDK

A simple scraper to export data from buildkite to honeycomb using opentelemetry SDK

A quick scraper program that let you export builds on BuildKite as OpenTelemetry data and then send them to honeycomb.io for slice-n-dice high cardinality analysis.

Jul 7, 2022

A simple blog framework built with GO. Uses HTML files and a JSON dict to give you more control over your content.

Go-Blog A simple template based blog framework. Instructions Built for GO version: 1 See the Documentation or Getting Started pages in the wiki. Notes

Sep 10, 2022

A simple blog framework built with GO. Uses HTML files and a JSON dict to give you more control over your content.

Go-Blog A simple template based blog framework. Instructions Built for GO version: 1 See the Documentation or Getting Started pages in the wiki. Notes

Sep 10, 2022

Give it an URI and it will open it how you want.

url_handler Give it an url and it will open it how you want. Browers are anoying so when I can, I open links with dedicated programs. I started out us

Jan 8, 2022

Cole - Cole can use his sixth sense to give you metrics about your Grafana dashboards

Cole Cole can use his sixth sense to give you metrics about your Grafana dashboa

Nov 9, 2022

Go-api-template - A rough template to give you a starting point for your API

Golang API Template This is only a rough template to give you a starting point f

Jan 14, 2022

A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.

A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.

Goku API gateway is a microservice gateway developed based on golang. It can achieve the purposes of high-performance HTTP API forwarding, multi tenant management, API access control, etc. it has a powerful custom plug-in system, which can be expanded by itself, and can quickly help enterprises manage API services and improve the stability and security of API services.

Dec 29, 2022

Simple project in Go to play around with some CRUD operations using a PostgreSQL database and pgx

Record Store November 2021 I started learning Go a few weeks ago and this is my first proper project using Go. I wanted to use it to get to grips with

Nov 26, 2021

Give your dependencies stars on GitHub! 🌟

Give stars to your dependencies of Go repositories and say thank you to developers!!

May 29, 2022

The phylosophy behind readyGo is "A Simple configuration should give a working project.".

The phylosophy behind readyGo is

The phylosophy behind readyGo is "A Simple configuration should give a working project.". readyGo is a command line interface( probably the name of re

Oct 30, 2021

Give developers an easy way to create and integrate bank processing into their own software products

Give developers an easy way to create and integrate bank processing into their own software products

Community · Blog moov-io/bankcron Moov's mission is to give developers an easy way to create and integrate bank processing into their own software pro

Sep 27, 2022

If you accept that 1 day is 24 hours in some situations, you might want to parse it in Go too.

relaxduration If you accept that 1 day is 24 hours in some situations, you might want to parse it in Go too. This package tries to handle situations w

Dec 7, 2022

66 is two player game played with playing cards and from now on you can play it from browser with your friends.

altmis-alti 66 is two player game played with playing cards and this project provides multiplayer game space from browser. How to run? Clone the proje

Feb 1, 2022
Comments
  • Use the go distro! Plus some cleanup

    Use the go distro! Plus some cleanup

    As the title says, this uses the go distro. Plus some code formatting (run with the standard formatter) and exporting the service name (which was not exported).

  • Updating the instructions to set the api key first as the app won't start without it set

    Updating the instructions to set the api key first as the app won't start without it set

    Which problem is this PR solving?

    Updating the instructions to set the api key first as the app won't start without it set

    Short description of the changes

    1. The Go app fails on startup if the API key isn't set, so tweaked the order of instructions to put setting the API key env variable ahead of starting the app
    2. Adding additional verbiage and a screenshot for the Gitpod setup

    How to verify that this has the expected result

    Run through the Gitpod instructions and ensure the app starts and data gets to Honeycomb

  • [WIP] README Updates

    [WIP] README Updates

    Signed-off-by: Mary Jinglewski [email protected]

    README.md updates to standardize and reflect the workflow for the Intro to Observability Workshops.

    Still TO DO:

    • [ ] Standardize across repos
    • [ ] Check localhost numbers
    • [ ] One last pass of formatting
Small microservice to apply filters to images

Small microservice to apply filters to images How to use Send an image file as p

Dec 21, 2021
Some examples for the programming language Go.

Golang_Examples Bubblesort: simple implementation of bubble sort algorithm in Go Level: Beginner GenericStack: a stack (LIFO collection) that can hold

Jul 28, 2022
Binaryscarf generates double-knitting patterns for some corpus of input text.

binaryscarf binaryscarf generates double-knit patterns for some corpus of input text. The layout follows the same style as described here. Output is s

Dec 31, 2022
This is a brief tutorial I created for a couple friends to show how to do some stuff in go and ethereum. Feel free to do any PRs with suggestions

golang-tutorial This is a brief tutorial I created for a couple friends to show how to do some stuff in Go and Ethereum. Milestones Create the environ

Aug 29, 2022
The repository intent is store some Go Lang codes.

⚠️ Go programming course ⚠️ This repository was created to share the Learn How To Code: Google's Go (golang) Programming Language code created by Todd

Jan 16, 2022
Mastering-go-exercises - Some code examples from Mihalis Tsoukalos book titled Mastering GO

Mastering go exercises This is a training repository. Here are some code example

Feb 16, 2022
The go language version developed based on hashlips_art_engine. Added and deleted some functions
The go language version developed based on hashlips_art_engine. Added and deleted some functions

golips_art_engine The inspiration for this tool is based on HashLips Art Engine. Our official links ?? Twitter ?? Discord ?? NFT Why building a new to

Jul 28, 2022
💯 Materials to help you rock your next coding interview

Tech Interview Handbook Credits: Illustration by @leftaligned Read on the website Black Lives Matter. Support the Equal Justice Initiative What is thi

Jan 4, 2023
This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts.
This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts.

Tutorial This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts. Let’s take a deeper look at min

Jun 1, 2022
This is an example of a keep-it-simple directory layout for Go projects that was created using DDD principles, please copy and share if you like it.

DDD Go Template This project was created to illustrate a great architectural structure I developed together with @fabiorodrigues in the period I was w

Dec 5, 2022